Skip to content

Commit

Permalink
rebase codes
Browse files Browse the repository at this point in the history
  • Loading branch information
shuaizhang committed Oct 11, 2019
1 parent dbdfb22 commit 395dcce
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 26 deletions.
3 changes: 2 additions & 1 deletion cmd/thanos/dedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/thanos-io/thanos/pkg/compact/dedup"
"github.com/thanos-io/thanos/pkg/extflag"
"github.com/thanos-io/thanos/pkg/objstore/client"
"github.com/thanos-io/thanos/pkg/runutil"
"gopkg.in/alecthomas/kingpin.v2"
Expand Down Expand Up @@ -38,7 +39,7 @@ func registerDedup(m map[string]setupFunc, app *kingpin.Application, name string
}

func runDedup(g *run.Group, logger log.Logger, reg *prometheus.Registry, dataDir string, replicaLabel string,
consistencyDelay time.Duration, blockSyncConcurrency int, objStoreConfig *pathOrContent, component string) error {
consistencyDelay time.Duration, blockSyncConcurrency int, objStoreConfig *extflag.PathOrContent, component string) error {
confContentYaml, err := objStoreConfig.Content()
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions pkg/compact/dedup/dedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"os"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/thanos-io/thanos/pkg/objstore"
)

Expand Down
12 changes: 6 additions & 6 deletions pkg/compact/dedup/dedup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (

"github.com/go-kit/kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/tsdb"
"github.com/prometheus/tsdb/chunkenc"
"github.com/prometheus/tsdb/chunks"
"github.com/prometheus/tsdb/index"
"github.com/prometheus/tsdb/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/index"
"github.com/prometheus/prometheus/tsdb/labels"
"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/objstore"
"github.com/thanos-io/thanos/pkg/testutil"
Expand Down Expand Up @@ -135,7 +135,7 @@ func getBlockSampleSeries(t *testing.T, logger log.Logger, blockDir string) map[
var samples []*Sample
for _, c := range chks {
chk, _ := cr.Chunk(c.Ref)
iterator := chk.Iterator()
iterator := chk.Iterator(nil)
for iterator.Next() {
timestamp, value := iterator.At()
samples = append(samples, &Sample{
Expand Down
8 changes: 4 additions & 4 deletions pkg/compact/dedup/merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/go-kit/kit/log/level"
"github.com/oklog/ulid"
"github.com/pkg/errors"
"github.com/prometheus/tsdb"
"github.com/prometheus/tsdb/chunks"
"github.com/prometheus/tsdb/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/labels"
"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/compact"
Expand Down Expand Up @@ -476,7 +476,7 @@ func (rm *ReplicaMerger) deleteRemoteBlock(id *ulid.ULID) error {
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
if err := block.Delete(ctx, rm.bkt, *id); err != nil {
if err := block.Delete(ctx, rm.logger, rm.bkt, *id); err != nil {
rm.metrics.operateRemoteStorageFailures.WithLabelValues("delete", rm.bkt.Name(), id.String()).Inc()
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/compact/dedup/merger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/go-kit/kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/testutil"
)
Expand Down
15 changes: 7 additions & 8 deletions pkg/compact/dedup/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/tsdb"
"github.com/prometheus/tsdb/chunkenc"
"github.com/prometheus/tsdb/chunks"
tsdberrors "github.com/prometheus/tsdb/errors"
"github.com/prometheus/tsdb/index"
"github.com/prometheus/tsdb/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
tsdberrors "github.com/prometheus/prometheus/tsdb/errors"
"github.com/prometheus/prometheus/tsdb/index"
"github.com/prometheus/prometheus/tsdb/labels"
"github.com/thanos-io/thanos/pkg/compact/downsample"
)

Expand Down Expand Up @@ -216,7 +216,6 @@ func (ss *SampleSeries) toChunk(at downsample.AggrType, minTime, maxTime int64)
}, nil
}


func (ss *SampleSeries) toChunks(at downsample.AggrType) ([]chunks.Meta, error) {
samples := ss.data[at]
if len(samples) == 0 {
Expand Down Expand Up @@ -337,7 +336,7 @@ func (r *SampleReader) readDownSamples(tr *tsdb.TimeRange) (map[downsample.AggrT

func (r *SampleReader) parseSamples(c chunkenc.Chunk, tr *tsdb.TimeRange) []*Sample {
samples := make([]*Sample, 0)
iterator := c.Iterator()
iterator := c.Iterator(nil)
for iterator.Next() {
timestamp, value := iterator.At()
if timestamp < tr.Min {
Expand Down
4 changes: 2 additions & 2 deletions pkg/compact/dedup/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

"github.com/go-kit/kit/log"
"github.com/prometheus/tsdb/chunkenc"
"github.com/prometheus/tsdb/labels"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/labels"
"github.com/thanos-io/thanos/pkg/compact/downsample"
"github.com/thanos-io/thanos/pkg/testutil"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/compact/dedup/replica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/go-kit/kit/log"
"github.com/oklog/ulid"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/tsdb"
"github.com/prometheus/tsdb/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/labels"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/objstore"
"github.com/thanos-io/thanos/pkg/objstore/inmem"
Expand Down

0 comments on commit 395dcce

Please sign in to comment.