From 24458586518816f26b994bbd7ad7e916f43f5150 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 19 Sep 2022 15:24:17 +0200 Subject: [PATCH 01/16] Adding hashes to raw chunks and populating it from bucket store Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 17 +++--- pkg/store/bucket_test.go | 94 ++++++++++++++++++++++++++++++++ pkg/store/storepb/rpc.pb.go | 100 +++++++++++++++++----------------- pkg/store/storepb/types.pb.go | 97 +++++++++++++++++++++------------ pkg/store/storepb/types.proto | 1 + 5 files changed, 217 insertions(+), 92 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 1fd7494e01..c38d6d9851 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -9,6 +9,7 @@ import ( "context" "encoding/binary" "fmt" + "github.com/cespare/xxhash" "io" "math" "os" @@ -318,8 +319,8 @@ type BucketStore struct { enableSeriesResponseHints bool } -func (b *BucketStore) validate() error { - if b.blockSyncConcurrency < minBlockSyncConcurrency { +func (s *BucketStore) validate() error { + if s.blockSyncConcurrency < minBlockSyncConcurrency { return errBlockSyncConcurrencyNotValid } return nil @@ -893,7 +894,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} return nil } if in.Encoding() != downsample.ChunkEncAggr { @@ -913,7 +914,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} case storepb.Aggr_SUM: x, err := ac.Get(downsample.AggrSum) if err != nil { @@ -923,7 +924,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} case storepb.Aggr_MIN: x, err := ac.Get(downsample.AggrMin) if err != nil { @@ -933,7 +934,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} case storepb.Aggr_MAX: x, err := ac.Get(downsample.AggrMax) if err != nil { @@ -943,7 +944,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} case storepb.Aggr_COUNTER: x, err := ac.Get(downsample.AggrCounter) if err != nil { @@ -953,7 +954,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b} + out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} } } return nil diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index f51f9d6236..d55c1f61b2 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -8,6 +8,7 @@ import ( "context" "encoding/binary" "fmt" + "github.com/cespare/xxhash" "io" "math" "math/rand" @@ -2132,6 +2133,99 @@ func TestLabelNamesAndValuesHints(t *testing.T) { } } +func TestSeries_ChuncksHaveHashRepresentation(t *testing.T) { + tb := testutil.NewTB(t) + + tmpDir := t.TempDir() + + headOpts := tsdb.DefaultHeadOptions() + headOpts.ChunkDirRoot = filepath.Join(tmpDir, "block") + + h, err := tsdb.NewHead(nil, nil, nil, headOpts, nil) + testutil.Ok(t, err) + defer func() { testutil.Ok(t, h.Close()) }() + + series := labels.FromStrings("__name__", "test") + app := h.Appender(context.Background()) + for ts := int64(0); ts < 10_000; ts++ { + _, err := app.Append(0, series, ts, float64(ts)) + testutil.Ok(t, err) + } + testutil.Ok(t, app.Commit()) + + blk := createBlockFromHead(t, headOpts.ChunkDirRoot, h) + + thanosMeta := metadata.Thanos{ + Labels: labels.Labels{{Name: "ext1", Value: "1"}}.Map(), + Downsample: metadata.ThanosDownsample{Resolution: 0}, + Source: metadata.TestSource, + } + + _, err = metadata.InjectThanos(log.NewNopLogger(), filepath.Join(headOpts.ChunkDirRoot, blk.String()), thanosMeta, nil) + testutil.Ok(t, err) + + // Create a bucket and upload the block there. + bktDir := filepath.Join(tmpDir, "bucket") + bkt, err := filesystem.NewBucket(bktDir) + testutil.Ok(t, err) + defer func() { testutil.Ok(t, bkt.Close()) }() + + instrBkt := objstore.WithNoopInstr(bkt) + logger := log.NewNopLogger() + testutil.Ok(t, block.Upload(context.Background(), logger, bkt, filepath.Join(headOpts.ChunkDirRoot, blk.String()), metadata.NoneFunc)) + + // Instance a real bucket store we'll use to query the series. + fetcher, err := block.NewMetaFetcher(logger, 10, instrBkt, tmpDir, nil, nil) + testutil.Ok(tb, err) + + indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{}) + testutil.Ok(tb, err) + + store, err := NewBucketStore( + instrBkt, + fetcher, + tmpDir, + NewChunksLimiterFactory(100000/MaxSamplesPerChunk), + NewSeriesLimiterFactory(0), + NewGapBasedPartitioner(PartitionerMaxGapSize), + 10, + false, + DefaultPostingOffsetInMemorySampling, + true, + false, + 0, + WithLogger(logger), + WithIndexCache(indexCache), + ) + testutil.Ok(tb, err) + testutil.Ok(tb, store.SyncBlocks(context.Background())) + + reqMinTime := math.MinInt64 + reqMaxTime := math.MaxInt64 + + req := &storepb.SeriesRequest{ + MinTime: int64(reqMinTime), + MaxTime: int64(reqMaxTime), + Matchers: []storepb.LabelMatcher{ + {Type: storepb.LabelMatcher_EQ, Name: "__name__", Value: "test"}, + }, + } + + srv := newStoreSeriesServer(context.Background()) + err = store.Series(req, srv) + testutil.Ok(t, err) + testutil.Assert(t, len(srv.SeriesSet) == 1) + + for _, rawChunk := range srv.SeriesSet[0].Chunks { + hash := rawChunk.Raw.Hash + decodedChunk, err := chunkenc.FromData(chunkenc.EncXOR, rawChunk.Raw.Data) + testutil.Ok(t, err) + + expectedHash := xxhash.Sum64(decodedChunk.Bytes()) + testutil.Equals(t, expectedHash, hash) + } +} + func labelNamesFromSeriesSet(series []*storepb.Series) []string { labelsMap := map[string]struct{}{} diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index bf670d0f63..586fcd8d1a 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -1275,14 +1275,14 @@ func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.Replica != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Replica)) + i = encodeVariantRpc(dAtA, i, uint64(m.Replica)) i-- dAtA[i] = 0x18 } if len(m.Tenant) > 0 { i -= len(m.Tenant) copy(dAtA[i:], m.Tenant) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Tenant))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Tenant))) i-- dAtA[i] = 0x12 } @@ -1294,7 +1294,7 @@ func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1354,24 +1354,24 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a } } if m.StoreType != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.StoreType)) + i = encodeVariantRpc(dAtA, i, uint64(m.StoreType)) i-- dAtA[i] = 0x20 } if m.MaxTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MaxTime)) + i = encodeVariantRpc(dAtA, i, uint64(m.MaxTime)) i-- dAtA[i] = 0x18 } if m.MinTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MinTime)) + i = encodeVariantRpc(dAtA, i, uint64(m.MinTime)) i-- dAtA[i] = 0x10 } @@ -1383,7 +1383,7 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { return 0, err } - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1419,7 +1419,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x6a @@ -1431,18 +1431,18 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x62 } if m.Range != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Range)) + i = encodeVariantRpc(dAtA, i, uint64(m.Range)) i-- dAtA[i] = 0x58 } if m.Step != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Step)) + i = encodeVariantRpc(dAtA, i, uint64(m.Step)) i-- dAtA[i] = 0x50 } @@ -1453,7 +1453,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x4a @@ -1469,7 +1469,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x40 } if m.PartialResponseStrategy != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x38 } @@ -1497,12 +1497,12 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i -= j4 copy(dAtA[i:], dAtA5[:j4]) - i = encodeVarintRpc(dAtA, i, uint64(j4)) + i = encodeVariantRpc(dAtA, i, uint64(j4)) i-- dAtA[i] = 0x2a } if m.MaxResolutionWindow != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MaxResolutionWindow)) + i = encodeVariantRpc(dAtA, i, uint64(m.MaxResolutionWindow)) i-- dAtA[i] = 0x20 } @@ -1514,19 +1514,19 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if m.MaxTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MaxTime)) + i = encodeVariantRpc(dAtA, i, uint64(m.MaxTime)) i-- dAtA[i] = 0x10 } if m.MinTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.MinTime)) + i = encodeVariantRpc(dAtA, i, uint64(m.MinTime)) i-- dAtA[i] = 0x8 } @@ -1560,7 +1560,7 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a @@ -1572,7 +1572,7 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 @@ -1584,13 +1584,13 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.StepMillis != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.StepMillis)) + i = encodeVariantRpc(dAtA, i, uint64(m.StepMillis)) i-- dAtA[i] = 0x8 } @@ -1621,7 +1621,7 @@ func (m *ShardInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Labels[iNdEx]) copy(dAtA[i:], m.Labels[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) i-- dAtA[i] = 0x22 } @@ -1637,12 +1637,12 @@ func (m *ShardInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x18 } if m.TotalShards != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.TotalShards)) + i = encodeVariantRpc(dAtA, i, uint64(m.TotalShards)) i-- dAtA[i] = 0x10 } if m.ShardIndex != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.ShardIndex)) + i = encodeVariantRpc(dAtA, i, uint64(m.ShardIndex)) i-- dAtA[i] = 0x8 } @@ -1672,7 +1672,7 @@ func (m *Func) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } @@ -1703,7 +1703,7 @@ func (m *Grouping) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Labels[iNdEx]) copy(dAtA[i:], m.Labels[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) i-- dAtA[i] = 0x1a } @@ -1742,7 +1742,7 @@ func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.Millis != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Millis)) + i = encodeVariantRpc(dAtA, i, uint64(m.Millis)) i-- dAtA[i] = 0x8 } @@ -1795,7 +1795,7 @@ func (m *SeriesResponse_Series) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1811,7 +1811,7 @@ func (m *SeriesResponse_Warning) MarshalToSizedBuffer(dAtA []byte) (int, error) i := len(dAtA) i -= len(m.Warning) copy(dAtA[i:], m.Warning) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Warning))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Warning))) i-- dAtA[i] = 0x12 return len(dAtA) - i, nil @@ -1830,7 +1830,7 @@ func (m *SeriesResponse_Hints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1865,7 +1865,7 @@ func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 @@ -1878,23 +1878,23 @@ func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a } if m.End != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.End)) + i = encodeVariantRpc(dAtA, i, uint64(m.End)) i-- dAtA[i] = 0x20 } if m.Start != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Start)) + i = encodeVariantRpc(dAtA, i, uint64(m.Start)) i-- dAtA[i] = 0x18 } if m.PartialResponseStrategy != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x10 } @@ -1938,7 +1938,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1947,7 +1947,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Warnings) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Warnings[iNdEx]) copy(dAtA[i:], m.Warnings[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -1956,7 +1956,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Names[iNdEx]) copy(dAtA[i:], m.Names[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Names[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Names[iNdEx]))) i-- dAtA[i] = 0xa } @@ -1992,7 +1992,7 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x3a @@ -2005,23 +2005,23 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 } if m.End != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.End)) + i = encodeVariantRpc(dAtA, i, uint64(m.End)) i-- dAtA[i] = 0x28 } if m.Start != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Start)) + i = encodeVariantRpc(dAtA, i, uint64(m.Start)) i-- dAtA[i] = 0x20 } if m.PartialResponseStrategy != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x18 } @@ -2038,7 +2038,7 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Label) > 0 { i -= len(m.Label) copy(dAtA[i:], m.Label) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Label))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Label))) i-- dAtA[i] = 0xa } @@ -2072,7 +2072,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) + i = encodeVariantRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -2081,7 +2081,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Warnings) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Warnings[iNdEx]) copy(dAtA[i:], m.Warnings[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -2090,7 +2090,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Values[iNdEx]) copy(dAtA[i:], m.Values[iNdEx]) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Values[iNdEx]))) + i = encodeVariantRpc(dAtA, i, uint64(len(m.Values[iNdEx]))) i-- dAtA[i] = 0xa } @@ -2098,7 +2098,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { +func encodeVariantRpc(dAtA []byte, offset int, v uint64) int { offset -= sovRpc(v) base := offset for v >= 1<<7 { diff --git a/pkg/store/storepb/types.pb.go b/pkg/store/storepb/types.pb.go index ee028f4a33..271a785bf5 100644 --- a/pkg/store/storepb/types.pb.go +++ b/pkg/store/storepb/types.pb.go @@ -116,6 +116,7 @@ func (LabelMatcher_Type) EnumDescriptor() ([]byte, []int) { type Chunk struct { Type Chunk_Encoding `protobuf:"varint,1,opt,name=type,proto3,enum=thanos.Chunk_Encoding" json:"type,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Hash uint64 `protobuf:"varint,3,opt,name=hash,proto3" json:"hash,omitempty"` } func (m *Chunk) Reset() { *m = Chunk{} } @@ -286,40 +287,41 @@ func init() { func init() { proto.RegisterFile("store/storepb/types.proto", fileDescriptor_121fba57de02d8e0) } var fileDescriptor_121fba57de02d8e0 = []byte{ - // 522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0xc1, 0x6f, 0xd3, 0x3e, - 0x14, 0xc7, 0xe3, 0x24, 0x4d, 0x5b, 0xff, 0xf6, 0x43, 0xc1,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0x83, 0x93, 0x7a, 0x50, 0x5d, 0xac, 0x63, 0x74, 0x08, - 0x5b, 0x1f, 0xc9, 0xa2, 0xa4, 0x7a, 0x4e, 0x5d, 0x5c, 0xbd, 0x04, 0x43, 0x68, 0xab, 0x3a, 0xe4, - 0x40, 0x73, 0x72, 0xe1, 0x1a, 0x6a, 0x73, 0xce, 0x26, 0x17, 0x2e, 0x50, 0x09, 0x3c, 0x71, 0x4d, - 0x9d, 0xc0, 0x13, 0xd7, 0x3a, 0x0e, 0xe1, 0xa3, 0x37, 0x24, 0x97, 0x8c, 0x2c, 0x30, 0x2d, 0x32, - 0xc1, 0x0b, 0x7a, 0x29, 0x73, 0x22, 0x69, 0xb2, 0x42, 0x1d, 0x68, 0xbf, 0x1d, 0xe1, 0x33, 0xd7, - 0x40, 0x5d, 0xd8, 0x1a, 0x8d, 0xcf, 0xf1, 0xd4, 0x05, 0xe3, 0x27, 0xeb, 0x5f, 0xbe, 0xb1, 0xde, - 0xf8, 0xe0, 0x76, 0xe3, 0x83, 0x9f, 0x1b, 0x1f, 0x7c, 0xde, 0xfa, 0xc6, 0xed, 0xd6, 0x37, 0xbe, - 0x6f, 0x7d, 0xe3, 0xaa, 0x5d, 0x5f, 0xa2, 0x99, 0xa3, 0xaf, 0xc1, 0xb3, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xd5, 0x63, 0x3a, 0x23, 0x5c, 0x03, 0x00, 0x00, + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0xf5, 0xda, 0x8e, 0x93, 0xcc, 0xaf, 0x3f, 0x64, 0x96, 0x0a, 0xdc, 0x1e, 0x9c, 0xc8, 0x08, + 0x11, 0x55, 0xaa, 0x2d, 0x15, 0x8e, 0x5c, 0x12, 0x94, 0x1b, 0xb4, 0x74, 0x1b, 0x09, 0xd4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d5, 0x65, 0x18, 0xd3, 0x43, 0x68, + 0xdd, 0xf1, 0x59, 0x29, 0xd0, 0xa7, 0x2e, 0xab, 0x7f, 0x9c, 0x01, 0xe8, 0x55, 0x1e, 0x35, 0x40, + 0x1d, 0x5f, 0x9a, 0x4a, 0xb5, 0x39, 0xe7, 0xe3, 0x4b, 0x93, 0x54, 0x00, 0x1b, 0x9b, 0x2a, 0x02, + 0x6c, 0x6c, 0x6a, 0x27, 0x2e, 0x3c, 0x79, 0xc7, 0x73, 0x19, 0xf1, 0x19, 0x13, 0x45, 0x96, 0x26, + 0x85, 0xb8, 0x92, 0x39, 0x97, 0x22, 0x58, 0xd0, 0x0e, 0xe8, 0xef, 0x87, 0xec, 0xdc, 0x54, 0x68, + 0x17, 0x5a, 0xc3, 0xd1, 0x05, 0x9b, 0x98, 0x64, 0xf4, 0x6c, 0xf9, 0xcb, 0x56, 0x96, 0x6b, 0x9b, + 0xdc, 0xaf, 0x6d, 0xf2, 0x73, 0x6d, 0x93, 0xcf, 0x1b, 0x5b, 0xb9, 0xdf, 0xd8, 0xca, 0xf7, 0x8d, + 0xad, 0x5c, 0xb7, 0x9b, 0xe7, 0x35, 0x35, 0xf0, 0x81, 0xbc, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x13, 0xe7, 0xb3, 0x25, 0x76, 0x03, 0x00, 0x00, } func (m *Chunk) Marshal() (dAtA []byte, err error) { @@ -342,6 +344,11 @@ func (m *Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Hash != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x18 + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -579,6 +586,9 @@ func (m *Chunk) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.Hash != 0 { + n += 1 + sovTypes(uint64(m.Hash)) + } return n } @@ -750,6 +760,25 @@ func (m *Chunk) Unmarshal(dAtA []byte) error { m.Data = []byte{} } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + m.Hash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hash |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/pkg/store/storepb/types.proto b/pkg/store/storepb/types.proto index d80e1af1ba..3739e23b8f 100644 --- a/pkg/store/storepb/types.proto +++ b/pkg/store/storepb/types.proto @@ -26,6 +26,7 @@ message Chunk { } Encoding type = 1; bytes data = 2; + uint64 hash = 3 [(gogoproto.nullable) = true]; } message Series { From 44d21de169b2815235b97332bf39fdb940353cd1 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Tue, 20 Sep 2022 10:00:16 +0200 Subject: [PATCH 02/16] Adding flag on SeriesRequest to control whether to calculate or not hashes Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 3 +- pkg/store/bucket_test.go | 3 +- pkg/store/prometheus.go | 5 +- pkg/store/storepb/rpc.pb.go | 302 ++++++++++++++++++++---------------- pkg/store/storepb/rpc.proto | 3 + 5 files changed, 180 insertions(+), 136 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index c38d6d9851..e9b4cda5ea 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -9,7 +9,6 @@ import ( "context" "encoding/binary" "fmt" - "github.com/cespare/xxhash" "io" "math" "os" @@ -20,6 +19,8 @@ import ( "sync" "time" + "github.com/cespare/xxhash" + "github.com/alecthomas/units" "github.com/go-kit/log" "github.com/go-kit/log/level" diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index d55c1f61b2..fd33d38e82 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -8,7 +8,6 @@ import ( "context" "encoding/binary" "fmt" - "github.com/cespare/xxhash" "io" "math" "math/rand" @@ -23,6 +22,8 @@ import ( "testing" "time" + "github.com/cespare/xxhash" + "github.com/go-kit/log" "github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/types" diff --git a/pkg/store/prometheus.go b/pkg/store/prometheus.go index 25aaafef9f..2d0e900afe 100644 --- a/pkg/store/prometheus.go +++ b/pkg/store/prometheus.go @@ -15,6 +15,8 @@ import ( "strings" "sync" + "github.com/cespare/xxhash" + "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/timestamp" @@ -412,6 +414,7 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( // has one difference. Prometheus has Chunk_UNKNOWN Chunk_Encoding = 0 vs we start from // XOR as 0. Compensate for that here: Type: storepb.Chunk_Encoding(chk.Type - 1), + Hash: xxhash.Sum64(chk.Data), }, } seriesStats.Samples += thanosChks[i].Raw.XORNumSamples() @@ -512,7 +515,7 @@ func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerC chks = append(chks, storepb.AggrChunk{ MinTime: samples[0].Timestamp, MaxTime: samples[chunkSize-1].Timestamp, - Raw: &storepb.Chunk{Type: enc, Data: cb}, + Raw: &storepb.Chunk{Type: enc, Data: cb, Hash: xxhash.Sum64(cb)}, }) samples = samples[chunkSize:] diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index 586fcd8d1a..7da5ae70b8 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -292,6 +292,8 @@ type SeriesRequest struct { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo *ShardInfo `protobuf:"bytes,13,opt,name=shard_info,json=shardInfo,proto3" json:"shard_info,omitempty"` + // Control whether the store should calculate the checksum/hash of chunks + CalculateChunkChecksums bool `protobuf:"varint,14,opt,name=calculate_chunk_checksums,json=calculateChunkChecksums,proto3" json:"calculate_chunk_checksums,omitempty"` } func (m *SeriesRequest) Reset() { *m = SeriesRequest{} } @@ -830,89 +832,90 @@ func init() { func init() { proto.RegisterFile("store/storepb/rpc.proto", fileDescriptor_a938d55a388af629) } var fileDescriptor_a938d55a388af629 = []byte{ - // 1298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5d, 0x6f, 0x13, 0x47, - 0x17, 0xf6, 0x7a, 0xbd, 0xfe, 0x38, 0x4e, 0xf2, 0x9a, 0xc1, 0xc0, 0xc6, 0x48, 0x8e, 0xdf, 0x7d, - 0xf5, 0x4a, 0x11, 0xa2, 0x36, 0x35, 0x15, 0x52, 0x2b, 0x6e, 0x92, 0x60, 0x48, 0x54, 0x62, 0xca, - 0x38, 0x21, 0x2d, 0x55, 0x65, 0xad, 0xed, 0xc9, 0x7a, 0xc5, 0x7a, 0x77, 0xd9, 0x99, 0x6d, 0xe2, - 0xdb, 0xf6, 0xbe, 0xaa, 0xfa, 0x13, 0xfa, 0x2b, 0xfa, 0x13, 0xb8, 0x2b, 0x57, 0x55, 0xd5, 0x0b, - 0xd4, 0xc2, 0x1f, 0xa9, 0xe6, 0x63, 0xd7, 0xde, 0x34, 0x40, 0x11, 0xdc, 0x44, 0x73, 0x9e, 0xe7, - 0xcc, 0x99, 0xf3, 0xed, 0x0d, 0x5c, 0xa1, 0x2c, 0x88, 0x48, 0x47, 0xfc, 0x0d, 0x47, 0x9d, 0x28, - 0x1c, 0xb7, 0xc3, 0x28, 0x60, 0x01, 0x2a, 0xb2, 0xa9, 0xed, 0x07, 0xb4, 0xb1, 0x9e, 0x55, 0x60, - 0xf3, 0x90, 0x50, 0xa9, 0xd2, 0xa8, 0x3b, 0x81, 0x13, 0x88, 0x63, 0x87, 0x9f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0xdd, 0xb8, 0x74, 0x06, 0x55, 0x1f, 0xe4, 0xb9, 0xed, 0xff, 0x3f, 0xfb, - 0xab, 0x99, 0x7b, 0xf6, 0xb2, 0xa9, 0x3d, 0x7f, 0xd9, 0xd4, 0xfe, 0x7c, 0xd9, 0xd4, 0x7e, 0x7c, - 0xd5, 0xcc, 0x3d, 0x7f, 0xd5, 0xcc, 0xfd, 0xfe, 0xaa, 0x99, 0x7b, 0x5c, 0x52, 0xff, 0x13, 0x8c, - 0x8a, 0xa2, 0x67, 0x6e, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x02, 0x42, 0x0e, 0xd0, 0x7d, 0x0c, - 0x00, 0x00, + // 1325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6e, 0x13, 0x47, + 0x14, 0xf6, 0x7a, 0xbd, 0xfe, 0x39, 0x4e, 0x5c, 0x33, 0x18, 0xd8, 0x18, 0xc9, 0x71, 0x5d, 0x55, + 0x8a, 0x10, 0xb5, 0xa9, 0xa9, 0x90, 0x5a, 0x71, 0x93, 0x04, 0x43, 0xa2, 0x12, 0x53, 0xc6, 0x09, + 0x69, 0xa9, 0x2a, 0x6b, 0x6d, 0x4f, 0xd6, 0xab, 0xac, 0x77, 0x97, 0x9d, 0xd9, 0x26, 0xbe, 0x6d, + 0xef, 0xab, 0x8a, 0x47, 0xe8, 0x53, 0xf4, 0x11, 0xb8, 0x2b, 0x97, 0x55, 0x2f, 0x50, 0x0b, 0x2f, + 0x52, 0xcd, 0xcf, 0xae, 0xbd, 0x69, 0x80, 0x22, 0xb8, 0x89, 0xe6, 0x7c, 0xdf, 0x99, 0x33, 0xe7, + 0xdf, 0x1b, 0xb8, 0x42, 0x99, 0x1f, 0x92, 0x8e, 0xf8, 0x1b, 0x8c, 0x3a, 0x61, 0x30, 0x6e, 0x07, + 0xa1, 0xcf, 0x7c, 0x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2, 0x5d, + 0x89, 0x5f, 0xdb, 0xb4, 0xed, 0x10, 0x2f, 0xf1, 0xe8, 0x2b, 0x58, 0x0b, 0xac, 0x90, 0x39, 0x96, + 0xcb, 0x5f, 0x11, 0x95, 0x1f, 0x4e, 0x1c, 0x6a, 0x8d, 0x5c, 0x32, 0x31, 0xf3, 0x4d, 0x6d, 0xa3, + 0x88, 0xaf, 0x28, 0x85, 0xb8, 0x33, 0xee, 0x28, 0x1a, 0x7d, 0x7f, 0xce, 0x5d, 0xca, 0x42, 0x8b, + 0x11, 0x7b, 0x6e, 0x16, 0x44, 0x59, 0xd6, 0xe3, 0x87, 0xbf, 0x49, 0xdb, 0x18, 0x28, 0xb5, 0xff, + 0x18, 0x8f, 0x09, 0xb4, 0x0e, 0x65, 0x7a, 0xec, 0x04, 0xc3, 0xf1, 0x34, 0xf2, 0x8e, 0xa9, 0x59, + 0x14, 0xae, 0x00, 0x87, 0xb6, 0x05, 0x82, 0xae, 0x81, 0x31, 0x75, 0x3c, 0x46, 0xcd, 0x52, 0x53, + 0x13, 0x09, 0x95, 0x13, 0xd8, 0x8e, 0x27, 0xb0, 0xbd, 0xe9, 0xcd, 0xb1, 0x54, 0x41, 0x08, 0x72, + 0x94, 0x91, 0xc0, 0x04, 0x91, 0x36, 0x71, 0x46, 0x35, 0x30, 0x42, 0xcb, 0xb3, 0x89, 0x59, 0x16, + 0xa0, 0x14, 0xd0, 0x4d, 0x28, 0x3f, 0x89, 0x48, 0x38, 0x1f, 0x4a, 0xdb, 0x2b, 0xc2, 0x36, 0x8a, + 0xa3, 0x78, 0xc8, 0xa9, 0x1d, 0xce, 0x60, 0x78, 0x92, 0x9c, 0xd1, 0x0d, 0x00, 0x3a, 0xb5, 0xc2, + 0xc9, 0xd0, 0xf1, 0x8e, 0x7c, 0x73, 0x55, 0xdc, 0x59, 0x34, 0x24, 0x67, 0xc4, 0x64, 0x95, 0x68, + 0x7c, 0xe4, 0x69, 0x1f, 0x5b, 0xee, 0x38, 0x72, 0x2d, 0x46, 0x64, 0x88, 0xc3, 0xf1, 0x94, 0x8c, + 0x8f, 0x69, 0x34, 0xa3, 0x66, 0x45, 0xa6, 0x3d, 0x51, 0x10, 0x01, 0x6f, 0xc7, 0x74, 0xeb, 0x37, + 0x0d, 0x60, 0xe1, 0x88, 0x48, 0x14, 0x23, 0xc1, 0x70, 0xe6, 0xb8, 0xae, 0x43, 0x55, 0x53, 0x02, + 0x87, 0xf6, 0x04, 0x82, 0x9a, 0x90, 0x3b, 0x8a, 0xbc, 0xb1, 0xe8, 0xc9, 0xf2, 0xa2, 0x15, 0xee, + 0x46, 0xde, 0x18, 0x0b, 0x06, 0x5d, 0x87, 0xa2, 0x1d, 0xfa, 0x51, 0xe0, 0x78, 0xb6, 0xe8, 0xac, + 0x72, 0xb7, 0x1a, 0x6b, 0xdd, 0x53, 0x38, 0x4e, 0x34, 0xd0, 0x27, 0x71, 0xe2, 0x0c, 0xa1, 0x9a, + 0xec, 0x05, 0xcc, 0x41, 0x95, 0xc7, 0xd6, 0x09, 0x94, 0x92, 0xc0, 0x85, 0x8b, 0x2a, 0x3f, 0x13, + 0x72, 0x9a, 0xb8, 0x28, 0xf9, 0x09, 0x39, 0x45, 0x1f, 0xc3, 0x0a, 0xf3, 0x99, 0xe5, 0x0e, 0x05, + 0x46, 0xd5, 0xf8, 0x94, 0x05, 0x26, 0xcc, 0x50, 0x54, 0x81, 0xec, 0x68, 0x2e, 0x16, 0x41, 0x11, + 0x67, 0x47, 0x73, 0xbe, 0xf0, 0xd4, 0x7a, 0xca, 0x35, 0x75, 0xbe, 0xf0, 0xa4, 0xd4, 0xaa, 0x43, + 0x8e, 0x47, 0xc6, 0x4b, 0xee, 0x59, 0x6a, 0x48, 0x4b, 0x58, 0x9c, 0x5b, 0x5d, 0x28, 0xc6, 0xf1, + 0x28, 0x7b, 0xda, 0x39, 0xf6, 0xf4, 0x94, 0xbd, 0x75, 0x30, 0x44, 0x60, 0x5c, 0x21, 0x95, 0x62, + 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c, 0x15, 0x5a, 0x4b, 0x55, 0x71, + 0x79, 0x4b, 0xd5, 0xeb, 0xe7, 0x51, 0xea, 0xfd, 0xbb, 0x50, 0x5e, 0x2a, 0x2b, 0x4a, 0xab, 0xa6, + 0x86, 0xa7, 0x7e, 0xf5, 0x5c, 0x4e, 0xda, 0xe9, 0xf6, 0xa1, 0x22, 0xbe, 0xbe, 0xf9, 0x54, 0xc8, + 0x64, 0xdc, 0x86, 0x32, 0x26, 0x33, 0x9f, 0x11, 0x81, 0xa3, 0x24, 0xfc, 0xe5, 0x8f, 0xf4, 0xfa, + 0xa5, 0x33, 0xa8, 0xfa, 0x98, 0xcf, 0x6c, 0x7d, 0xfa, 0xec, 0x9f, 0x46, 0xe6, 0xd9, 0xcb, 0x86, + 0xf6, 0xfc, 0x65, 0x43, 0xfb, 0xfb, 0x65, 0x43, 0xfb, 0xf5, 0x55, 0x23, 0xf3, 0xfc, 0x55, 0x23, + 0xf3, 0xe7, 0xab, 0x46, 0xe6, 0x71, 0x41, 0xfd, 0x3f, 0x31, 0xca, 0x8b, 0x9e, 0xb9, 0xf9, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x85, 0x56, 0x61, 0x30, 0xb9, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1275,14 +1278,14 @@ func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.Replica != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Replica)) + i = encodeVarintRpc(dAtA, i, uint64(m.Replica)) i-- dAtA[i] = 0x18 } if len(m.Tenant) > 0 { i -= len(m.Tenant) copy(dAtA[i:], m.Tenant) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Tenant))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Tenant))) i-- dAtA[i] = 0x12 } @@ -1294,7 +1297,7 @@ func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1354,24 +1357,24 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a } } if m.StoreType != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.StoreType)) + i = encodeVarintRpc(dAtA, i, uint64(m.StoreType)) i-- dAtA[i] = 0x20 } if m.MaxTime != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.MaxTime)) + i = encodeVarintRpc(dAtA, i, uint64(m.MaxTime)) i-- dAtA[i] = 0x18 } if m.MinTime != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.MinTime)) + i = encodeVarintRpc(dAtA, i, uint64(m.MinTime)) i-- dAtA[i] = 0x10 } @@ -1383,7 +1386,7 @@ func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { return 0, err } - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1412,6 +1415,16 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.CalculateChunkChecksums { + i-- + if m.CalculateChunkChecksums { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } if m.ShardInfo != nil { { size, err := m.ShardInfo.MarshalToSizedBuffer(dAtA[:i]) @@ -1419,7 +1432,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x6a @@ -1431,18 +1444,18 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x62 } if m.Range != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Range)) + i = encodeVarintRpc(dAtA, i, uint64(m.Range)) i-- dAtA[i] = 0x58 } if m.Step != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Step)) + i = encodeVarintRpc(dAtA, i, uint64(m.Step)) i-- dAtA[i] = 0x50 } @@ -1453,7 +1466,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x4a @@ -1469,7 +1482,7 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x40 } if m.PartialResponseStrategy != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x38 } @@ -1497,12 +1510,12 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i -= j4 copy(dAtA[i:], dAtA5[:j4]) - i = encodeVariantRpc(dAtA, i, uint64(j4)) + i = encodeVarintRpc(dAtA, i, uint64(j4)) i-- dAtA[i] = 0x2a } if m.MaxResolutionWindow != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.MaxResolutionWindow)) + i = encodeVarintRpc(dAtA, i, uint64(m.MaxResolutionWindow)) i-- dAtA[i] = 0x20 } @@ -1514,19 +1527,19 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if m.MaxTime != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.MaxTime)) + i = encodeVarintRpc(dAtA, i, uint64(m.MaxTime)) i-- dAtA[i] = 0x10 } if m.MinTime != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.MinTime)) + i = encodeVarintRpc(dAtA, i, uint64(m.MinTime)) i-- dAtA[i] = 0x8 } @@ -1560,7 +1573,7 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a @@ -1572,7 +1585,7 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 @@ -1584,13 +1597,13 @@ func (m *QueryHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } if m.StepMillis != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.StepMillis)) + i = encodeVarintRpc(dAtA, i, uint64(m.StepMillis)) i-- dAtA[i] = 0x8 } @@ -1621,7 +1634,7 @@ func (m *ShardInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Labels[iNdEx]) copy(dAtA[i:], m.Labels[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) i-- dAtA[i] = 0x22 } @@ -1637,12 +1650,12 @@ func (m *ShardInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x18 } if m.TotalShards != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.TotalShards)) + i = encodeVarintRpc(dAtA, i, uint64(m.TotalShards)) i-- dAtA[i] = 0x10 } if m.ShardIndex != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.ShardIndex)) + i = encodeVarintRpc(dAtA, i, uint64(m.ShardIndex)) i-- dAtA[i] = 0x8 } @@ -1672,7 +1685,7 @@ func (m *Func) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Name))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } @@ -1703,7 +1716,7 @@ func (m *Grouping) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Labels[iNdEx]) copy(dAtA[i:], m.Labels[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Labels[iNdEx]))) i-- dAtA[i] = 0x1a } @@ -1742,7 +1755,7 @@ func (m *Range) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.Millis != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Millis)) + i = encodeVarintRpc(dAtA, i, uint64(m.Millis)) i-- dAtA[i] = 0x8 } @@ -1795,7 +1808,7 @@ func (m *SeriesResponse_Series) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -1811,7 +1824,7 @@ func (m *SeriesResponse_Warning) MarshalToSizedBuffer(dAtA []byte) (int, error) i := len(dAtA) i -= len(m.Warning) copy(dAtA[i:], m.Warning) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Warning))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Warning))) i-- dAtA[i] = 0x12 return len(dAtA) - i, nil @@ -1830,7 +1843,7 @@ func (m *SeriesResponse_Hints) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1865,7 +1878,7 @@ func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 @@ -1878,23 +1891,23 @@ func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a } if m.End != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.End)) + i = encodeVarintRpc(dAtA, i, uint64(m.End)) i-- dAtA[i] = 0x20 } if m.Start != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Start)) + i = encodeVarintRpc(dAtA, i, uint64(m.Start)) i-- dAtA[i] = 0x18 } if m.PartialResponseStrategy != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x10 } @@ -1938,7 +1951,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -1947,7 +1960,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Warnings) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Warnings[iNdEx]) copy(dAtA[i:], m.Warnings[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -1956,7 +1969,7 @@ func (m *LabelNamesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Names[iNdEx]) copy(dAtA[i:], m.Names[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Names[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Names[iNdEx]))) i-- dAtA[i] = 0xa } @@ -1992,7 +2005,7 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x3a @@ -2005,23 +2018,23 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 } if m.End != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.End)) + i = encodeVarintRpc(dAtA, i, uint64(m.End)) i-- dAtA[i] = 0x28 } if m.Start != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.Start)) + i = encodeVarintRpc(dAtA, i, uint64(m.Start)) i-- dAtA[i] = 0x20 } if m.PartialResponseStrategy != 0 { - i = encodeVariantRpc(dAtA, i, uint64(m.PartialResponseStrategy)) + i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- dAtA[i] = 0x18 } @@ -2038,7 +2051,7 @@ func (m *LabelValuesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Label) > 0 { i -= len(m.Label) copy(dAtA[i:], m.Label) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Label))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Label))) i-- dAtA[i] = 0xa } @@ -2072,7 +2085,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVariantRpc(dAtA, i, uint64(size)) + i = encodeVarintRpc(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -2081,7 +2094,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Warnings) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Warnings[iNdEx]) copy(dAtA[i:], m.Warnings[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Warnings[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -2090,7 +2103,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Values[iNdEx]) copy(dAtA[i:], m.Values[iNdEx]) - i = encodeVariantRpc(dAtA, i, uint64(len(m.Values[iNdEx]))) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Values[iNdEx]))) i-- dAtA[i] = 0xa } @@ -2098,7 +2111,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVariantRpc(dAtA []byte, offset int, v uint64) int { +func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { offset -= sovRpc(v) base := offset for v >= 1<<7 { @@ -2234,6 +2247,9 @@ func (m *SeriesRequest) Size() (n int) { l = m.ShardInfo.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.CalculateChunkChecksums { + n += 2 + } return n } @@ -3300,6 +3316,26 @@ func (m *SeriesRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CalculateChunkChecksums", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CalculateChunkChecksums = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index 72afaba8ed..9f5e4c39f6 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -122,6 +122,9 @@ message SeriesRequest { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo shard_info = 13; + + // Control whether the store should calculate the checksum/hash of chunks + bool calculate_chunk_checksums = 14; } From e0afef28ea2a15e873dcc77542a7469d5376567d Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Tue, 20 Sep 2022 10:15:07 +0200 Subject: [PATCH 03/16] Only calculate hash on series request for bucket when needed Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 56 ++++++++++++++++++++++++---------------- pkg/store/bucket_test.go | 55 +++++++++++++++++++++++++++------------ pkg/store/prometheus.go | 32 +++++++++++++++++------ 3 files changed, 97 insertions(+), 46 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index e9b4cda5ea..e83bae273c 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -787,17 +787,18 @@ func (s *bucketSeriesSet) Err() error { // blockSeries returns series matching given matchers, that have some data in given time range. func blockSeries( ctx context.Context, - extLset labels.Labels, // External labels added to the returned series labels. - indexr *bucketIndexReader, // Index reader for block. - chunkr *bucketChunkReader, // Chunk reader for block. - matchers []*labels.Matcher, // Series matchers. - chunksLimiter ChunksLimiter, // Rate limiter for loading chunks. - seriesLimiter SeriesLimiter, // Rate limiter for loading series. - skipChunks bool, // If true, chunks are not loaded. - minTime, maxTime int64, // Series must have data in this time range to be returned. - loadAggregates []storepb.Aggr, // List of aggregates to load when loading chunks. + extLset labels.Labels, + indexr *bucketIndexReader, + chunkr *bucketChunkReader, + matchers []*labels.Matcher, + chunksLimiter ChunksLimiter, + seriesLimiter SeriesLimiter, + skipChunks bool, + minTime, maxTime int64, + loadAggregates []storepb.Aggr, shardMatcher *storepb.ShardMatcher, emptyPostingsCount prometheus.Counter, + calculateChunkHash bool, ) (storepb.SeriesSet, *queryStats, error) { ps, err := indexr.ExpandedPostings(ctx, matchers) if err != nil { @@ -882,20 +883,21 @@ func blockSeries( return newBucketSeriesSet(res), indexr.stats, nil } - if err := chunkr.load(ctx, res, loadAggregates); err != nil { + if err := chunkr.load(ctx, res, loadAggregates, calculateChunkHash); err != nil { return nil, nil, errors.Wrap(err, "load chunks") } return newBucketSeriesSet(res), indexr.stats.merge(chunkr.stats), nil } -func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error)) error { +func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error), calculateChecksum bool) error { + if in.Encoding() == chunkenc.EncXOR { b, err := save(in.Bytes()) if err != nil { return err } - out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} return nil } if in.Encoding() != downsample.ChunkEncAggr { @@ -915,7 +917,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_SUM: x, err := ac.Get(downsample.AggrSum) if err != nil { @@ -925,7 +927,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_MIN: x, err := ac.Get(downsample.AggrMin) if err != nil { @@ -935,7 +937,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_MAX: x, err := ac.Get(downsample.AggrMax) if err != nil { @@ -945,7 +947,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_COUNTER: x, err := ac.Get(downsample.AggrCounter) if err != nil { @@ -955,12 +957,19 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: xxhash.Sum64(b)} + out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} } } return nil } +func hashChunk(b []byte, doHash bool) uint64 { + if !doHash { + return 0 + } + return xxhash.Sum64(b) +} + // debugFoundBlockSetOverview logs on debug level what exactly blocks we used for query in terms of // labels and resolution. This is important because we allow mixed resolution results, so it is quite crucial // to be aware what exactly resolution we see on query. @@ -1097,6 +1106,7 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_Serie req.Aggregates, shardMatcher, s.metrics.emptyPostingCount, + req.CalculateChunkChecksums, ) if err != nil { return errors.Wrapf(err, "fetch series for block %s", b.meta.ULID) @@ -1318,6 +1328,7 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq nil, nil, s.metrics.emptyPostingCount, + false, ) if err != nil { return errors.Wrapf(err, "fetch series for block %s", b.meta.ULID) @@ -1486,6 +1497,7 @@ func (s *BucketStore) LabelValues(ctx context.Context, req *storepb.LabelValuesR nil, nil, s.metrics.emptyPostingCount, + false, ) if err != nil { return errors.Wrapf(err, "fetch series for block %s", b.meta.ULID) @@ -2558,7 +2570,7 @@ func (r *bucketChunkReader) addLoad(id chunks.ChunkRef, seriesEntry, chunk int) } // load loads all added chunks and saves resulting aggrs to res. -func (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs []storepb.Aggr) error { +func (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs []storepb.Aggr, calculateChunkChecksum bool) error { g, ctx := errgroup.WithContext(ctx) for seq, pIdxs := range r.toLoad { @@ -2574,7 +2586,7 @@ func (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs [ p := p indices := pIdxs[p.ElemRng[0]:p.ElemRng[1]] g.Go(func() error { - return r.loadChunks(ctx, res, aggrs, seq, p, indices) + return r.loadChunks(ctx, res, aggrs, seq, p, indices, calculateChunkChecksum) }) } } @@ -2583,7 +2595,7 @@ func (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs [ // loadChunks will read range [start, end] from the segment file with sequence number seq. // This data range covers chunks starting at supplied offsets. -func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, aggrs []storepb.Aggr, seq int, part Part, pIdxs []loadIdx) error { +func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, aggrs []storepb.Aggr, seq int, part Part, pIdxs []loadIdx, calculateChunkChecksum bool) error { fetchBegin := time.Now() // Get a reader for the required range. @@ -2662,7 +2674,7 @@ func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, a // There is also crc32 after the chunk, but we ignore that. chunkLen = n + 1 + int(chunkDataLen) if chunkLen <= len(cb) { - err = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), rawChunk(cb[n:chunkLen]), aggrs, r.save) + err = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), rawChunk(cb[n:chunkLen]), aggrs, r.save, calculateChunkChecksum) if err != nil { return errors.Wrap(err, "populate chunk") } @@ -2693,7 +2705,7 @@ func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, a r.stats.chunksFetchCount++ r.stats.ChunksFetchDurationSum += time.Since(fetchBegin) r.stats.ChunksFetchedSizeSum += units.Base2Bytes(len(*nb)) - err = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), rawChunk((*nb)[n:]), aggrs, r.save) + err = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), rawChunk((*nb)[n:]), aggrs, r.save, calculateChunkChecksum) if err != nil { r.block.chunkPool.Put(nb) return errors.Wrap(err, "populate chunk") diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index fd33d38e82..5b15bb6899 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -2204,26 +2204,49 @@ func TestSeries_ChuncksHaveHashRepresentation(t *testing.T) { reqMinTime := math.MinInt64 reqMaxTime := math.MaxInt64 - req := &storepb.SeriesRequest{ - MinTime: int64(reqMinTime), - MaxTime: int64(reqMaxTime), - Matchers: []storepb.LabelMatcher{ - {Type: storepb.LabelMatcher_EQ, Name: "__name__", Value: "test"}, + testCases := []struct { + name string + calculateChecksum bool + }{ + { + name: "calculate checksum", + calculateChecksum: true, + }, + { + name: "do not calculate checksum", + calculateChecksum: false, }, } - srv := newStoreSeriesServer(context.Background()) - err = store.Series(req, srv) - testutil.Ok(t, err) - testutil.Assert(t, len(srv.SeriesSet) == 1) + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + req := &storepb.SeriesRequest{ + MinTime: int64(reqMinTime), + MaxTime: int64(reqMaxTime), + Matchers: []storepb.LabelMatcher{ + {Type: storepb.LabelMatcher_EQ, Name: "__name__", Value: "test"}, + }, + CalculateChunkChecksums: tc.calculateChecksum, + } - for _, rawChunk := range srv.SeriesSet[0].Chunks { - hash := rawChunk.Raw.Hash - decodedChunk, err := chunkenc.FromData(chunkenc.EncXOR, rawChunk.Raw.Data) - testutil.Ok(t, err) + srv := newStoreSeriesServer(context.Background()) + err = store.Series(req, srv) + testutil.Ok(t, err) + testutil.Assert(t, len(srv.SeriesSet) == 1) - expectedHash := xxhash.Sum64(decodedChunk.Bytes()) - testutil.Equals(t, expectedHash, hash) + for _, rawChunk := range srv.SeriesSet[0].Chunks { + hash := rawChunk.Raw.Hash + decodedChunk, err := chunkenc.FromData(chunkenc.EncXOR, rawChunk.Raw.Data) + testutil.Ok(t, err) + + if tc.calculateChecksum { + expectedHash := xxhash.Sum64(decodedChunk.Bytes()) + testutil.Equals(t, expectedHash, hash) + } else { + testutil.Equals(t, uint64(0), hash) + } + } + }) } } @@ -2421,7 +2444,7 @@ func benchmarkBlockSeriesWithConcurrency(b *testing.B, concurrency int, blockMet indexReader := blk.indexReader() chunkReader := blk.chunkReader() - seriesSet, _, err := blockSeries(ctx, nil, indexReader, chunkReader, matchers, chunksLimiter, seriesLimiter, req.SkipChunks, req.MinTime, req.MaxTime, req.Aggregates, nil, dummyCounter) + seriesSet, _, err := blockSeries(ctx, nil, indexReader, chunkReader, matchers, chunksLimiter, seriesLimiter, req.SkipChunks, req.MinTime, req.MaxTime, req.Aggregates, nil, dummyCounter, false) testutil.Ok(b, err) // Ensure at least 1 series has been returned (as expected). diff --git a/pkg/store/prometheus.go b/pkg/store/prometheus.go index 2d0e900afe..e276fd3d5b 100644 --- a/pkg/store/prometheus.go +++ b/pkg/store/prometheus.go @@ -235,13 +235,13 @@ func (p *PrometheusStore) Series(r *storepb.SeriesRequest, s storepb.Store_Serie // remote read. contentType := httpResp.Header.Get("Content-Type") if strings.HasPrefix(contentType, "application/x-protobuf") { - return p.handleSampledPrometheusResponse(s, httpResp, queryPrometheusSpan, extLset) + return p.handleSampledPrometheusResponse(s, httpResp, queryPrometheusSpan, extLset, r.CalculateChunkChecksums) } if !strings.HasPrefix(contentType, "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse") { return errors.Errorf("not supported remote read content type: %s", contentType) } - return p.handleStreamedPrometheusResponse(s, shardMatcher, httpResp, queryPrometheusSpan, extLset) + return p.handleStreamedPrometheusResponse(s, shardMatcher, httpResp, queryPrometheusSpan, extLset, r.CalculateChunkChecksums) } func (p *PrometheusStore) queryPrometheus(s storepb.Store_SeriesServer, r *storepb.SeriesRequest) error { @@ -295,7 +295,7 @@ func (p *PrometheusStore) queryPrometheus(s storepb.Store_SeriesServer, r *store Samples: prompb.SamplesFromSamplePairs(vector.Values), } - chks, err := p.chunkSamples(series, MaxSamplesPerChunk) + chks, err := p.chunkSamples(series, MaxSamplesPerChunk, r.CalculateChunkChecksums) if err != nil { return err } @@ -311,7 +311,13 @@ func (p *PrometheusStore) queryPrometheus(s storepb.Store_SeriesServer, r *store return nil } -func (p *PrometheusStore) handleSampledPrometheusResponse(s storepb.Store_SeriesServer, httpResp *http.Response, querySpan tracing.Span, extLset labels.Labels) error { +func (p *PrometheusStore) handleSampledPrometheusResponse( + s storepb.Store_SeriesServer, + httpResp *http.Response, + querySpan tracing.Span, + extLset labels.Labels, + calculateChecksums bool, +) error { level.Debug(p.logger).Log("msg", "started handling ReadRequest_SAMPLED response type.") resp, err := p.fetchSampledResponse(s.Context(), httpResp) @@ -339,7 +345,7 @@ func (p *PrometheusStore) handleSampledPrometheusResponse(s storepb.Store_Series continue } - aggregatedChunks, err := p.chunkSamples(e, MaxSamplesPerChunk) + aggregatedChunks, err := p.chunkSamples(e, MaxSamplesPerChunk, calculateChecksums) if err != nil { return err } @@ -361,6 +367,7 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( httpResp *http.Response, querySpan tracing.Span, extLset labels.Labels, + calculateChecksums bool, ) error { level.Debug(p.logger).Log("msg", "started handling ReadRequest_STREAMED_XOR_CHUNKS streamed read response.") @@ -404,7 +411,12 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( seriesStats.CountSeries(series.Labels) thanosChks := make([]storepb.AggrChunk, len(series.Chunks)) + for i, chk := range series.Chunks { + hash := uint64(0) + if calculateChecksums { + hash = xxhash.Sum64(chk.Data) + } thanosChks[i] = storepb.AggrChunk{ MaxTime: chk.MaxTimeMs, MinTime: chk.MinTimeMs, @@ -414,7 +426,7 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( // has one difference. Prometheus has Chunk_UNKNOWN Chunk_Encoding = 0 vs we start from // XOR as 0. Compensate for that here: Type: storepb.Chunk_Encoding(chk.Type - 1), - Hash: xxhash.Sum64(chk.Data), + Hash: hash, }, } seriesStats.Samples += thanosChks[i].Raw.XORNumSamples() @@ -498,7 +510,7 @@ func (p *PrometheusStore) fetchSampledResponse(ctx context.Context, resp *http.R return &data, nil } -func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerChunk int) (chks []storepb.AggrChunk, err error) { +func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerChunk int, calculateChecksums bool) (chks []storepb.AggrChunk, err error) { samples := series.Samples for len(samples) > 0 { @@ -512,10 +524,14 @@ func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerC return nil, status.Error(codes.Unknown, err.Error()) } + hash := uint64(0) + if calculateChecksums { + hash = xxhash.Sum64(cb) + } chks = append(chks, storepb.AggrChunk{ MinTime: samples[0].Timestamp, MaxTime: samples[chunkSize-1].Timestamp, - Raw: &storepb.Chunk{Type: enc, Data: cb, Hash: xxhash.Sum64(cb)}, + Raw: &storepb.Chunk{Type: enc, Data: cb, Hash: hash}, }) samples = samples[chunkSize:] From b5f5b2f463f84c086bf72f15cc2c2954559bf4e1 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Tue, 20 Sep 2022 10:54:53 +0200 Subject: [PATCH 04/16] implement e2e test for prometheus store Signed-off-by: Pedro Tanaka fixing flaky e2e tests Signed-off-by: Pedro Tanaka fix integration test for prometheus Signed-off-by: Pedro Tanaka --- pkg/store/prometheus_test.go | 69 +++++++++++++++++++++++++++++++++ test/e2e/query_frontend_test.go | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/pkg/store/prometheus_test.go b/pkg/store/prometheus_test.go index 45939294f7..6c3797dccc 100644 --- a/pkg/store/prometheus_test.go +++ b/pkg/store/prometheus_test.go @@ -11,6 +11,8 @@ import ( "testing" "time" + "github.com/cespare/xxhash" + "github.com/pkg/errors" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/timestamp" @@ -430,6 +432,73 @@ func TestPrometheusStore_Series_MatchExternalLabel(t *testing.T) { testutil.Equals(t, 0, len(srv.SeriesSet)) } +func TestPrometheusStore_Series_ChunkHashCalculation_Integration(t *testing.T) { + defer testutil.TolerantVerifyLeak(t) + + p, err := e2eutil.NewPrometheus() + testutil.Ok(t, err) + defer func() { testutil.Ok(t, p.Stop()) }() + + baseT := timestamp.FromTime(time.Now()) / 1000 * 1000 + + a := p.Appender() + _, err = a.Append(0, labels.FromStrings("a", "b"), baseT+100, 1) + testutil.Ok(t, err) + _, err = a.Append(0, labels.FromStrings("a", "b"), baseT+200, 2) + testutil.Ok(t, err) + _, err = a.Append(0, labels.FromStrings("a", "b"), baseT+300, 3) + testutil.Ok(t, err) + testutil.Ok(t, a.Commit()) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + testutil.Ok(t, p.Start()) + + u, err := url.Parse(fmt.Sprintf("http://%s", p.Addr())) + testutil.Ok(t, err) + + proxy, err := NewPrometheusStore(nil, nil, promclient.NewDefaultClient(), u, component.Sidecar, + func() labels.Labels { return labels.FromStrings("region", "eu-west") }, + func() (int64, int64) { return 0, math.MaxInt64 }, nil) + testutil.Ok(t, err) + srv := newStoreSeriesServer(ctx) + + testutil.Ok(t, proxy.Series(&storepb.SeriesRequest{ + MinTime: baseT + 101, + MaxTime: baseT + 300, + CalculateChunkChecksums: true, + Matchers: []storepb.LabelMatcher{ + {Name: "a", Value: "b"}, + {Type: storepb.LabelMatcher_EQ, Name: "region", Value: "eu-west"}, + }, + }, srv)) + testutil.Equals(t, 1, len(srv.SeriesSet)) + + for _, chunk := range srv.SeriesSet[0].Chunks { + got := chunk.Raw.Hash + want := xxhash.Sum64(chunk.Raw.Data) + testutil.Equals(t, want, got) + } + + // by default do not calculate the checksums + testutil.Ok(t, proxy.Series(&storepb.SeriesRequest{ + MinTime: baseT + 101, + MaxTime: baseT + 300, + Matchers: []storepb.LabelMatcher{ + {Name: "a", Value: "b"}, + {Type: storepb.LabelMatcher_EQ, Name: "region", Value: "eu-west"}, + }, + CalculateChunkChecksums: false, + }, srv)) + testutil.Equals(t, 2, len(srv.SeriesSet)) + for _, chunk := range srv.SeriesSet[1].Chunks { + got := chunk.Raw.Hash + want := uint64(0) + testutil.Equals(t, want, got) + } +} + func TestPrometheusStore_Info(t *testing.T) { defer testutil.TolerantVerifyLeak(t) diff --git a/test/e2e/query_frontend_test.go b/test/e2e/query_frontend_test.go index fdf54c304f..e6871801ee 100644 --- a/test/e2e/query_frontend_test.go +++ b/test/e2e/query_frontend_test.go @@ -594,7 +594,7 @@ func TestRangeQueryShardingWithRandomData(t *testing.T) { func TestRangeQueryDynamicHorizontalSharding(t *testing.T) { t.Parallel() - e, err := e2e.NewDockerEnvironment("query-frontend") + e, err := e2e.NewDockerEnvironment("query-frontend-dynamic-shards") testutil.Ok(t, err) t.Cleanup(e2ethanos.CleanScenario(t, e)) From 2f38f444df73b487bf3e507b187cacba13ce2204 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Tue, 20 Sep 2022 11:52:52 +0200 Subject: [PATCH 05/16] calculating hash on TSDB Series() request as well Signed-off-by: Pedro Tanaka Final fix on error linting Signed-off-by: Pedro Tanaka --- pkg/store/tsdb.go | 1 + pkg/store/tsdb_test.go | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/pkg/store/tsdb.go b/pkg/store/tsdb.go index 9a6096192b..985473e081 100644 --- a/pkg/store/tsdb.go +++ b/pkg/store/tsdb.go @@ -197,6 +197,7 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer Raw: &storepb.Chunk{ Type: storepb.Chunk_Encoding(chk.Chunk.Encoding() - 1), // Proto chunk encoding is one off to TSDB one. Data: chk.Chunk.Bytes(), + Hash: hashChunk(chk.Chunk.Bytes(), r.CalculateChunkChecksums), }, } frameBytesLeft -= c.Size() diff --git a/pkg/store/tsdb_test.go b/pkg/store/tsdb_test.go index ff3d69a5d2..f4523948ee 100644 --- a/pkg/store/tsdb_test.go +++ b/pkg/store/tsdb_test.go @@ -12,6 +12,7 @@ import ( "sort" "testing" + "github.com/cespare/xxhash" "github.com/go-kit/log" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/storage" @@ -61,6 +62,61 @@ func TestTSDBStore_Info(t *testing.T) { testutil.Equals(t, int64(math.MaxInt64), resp.MaxTime) } +func TestTSDBStore_Series_ChunkChecksum(t *testing.T) { + defer testutil.TolerantVerifyLeak(t) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + db, err := e2eutil.NewTSDB() + defer func() { testutil.Ok(t, db.Close()) }() + testutil.Ok(t, err) + + tsdbStore := NewTSDBStore(nil, db, component.Rule, labels.FromStrings("region", "eu-west")) + + appender := db.Appender(context.Background()) + + for i := 1; i <= 3; i++ { + _, err = appender.Append(0, labels.FromStrings("a", "1"), int64(i), float64(i)) + testutil.Ok(t, err) + } + err = appender.Commit() + testutil.Ok(t, err) + + srv := newStoreSeriesServer(ctx) + + req := &storepb.SeriesRequest{ + MinTime: 1, + MaxTime: 3, + Matchers: []storepb.LabelMatcher{ + {Type: storepb.LabelMatcher_EQ, Name: "a", Value: "1"}, + }, + } + err = tsdbStore.Series(req, srv) + testutil.Ok(t, err) + + for _, chk := range srv.SeriesSet[0].Chunks { + testutil.Equals(t, uint64(0), chk.Raw.Hash) + } + + req = &storepb.SeriesRequest{ + MinTime: 1, + MaxTime: 3, + Matchers: []storepb.LabelMatcher{ + {Type: storepb.LabelMatcher_EQ, Name: "a", Value: "1"}, + }, + CalculateChunkChecksums: true, + } + + err = tsdbStore.Series(req, srv) + testutil.Ok(t, err) + + for _, chk := range srv.SeriesSet[1].Chunks { + want := xxhash.Sum64(chk.Raw.Data) + testutil.Equals(t, want, chk.Raw.Hash) + } +} + func TestTSDBStore_Series(t *testing.T) { defer testutil.TolerantVerifyLeak(t) From 31808708fc88cd799ce668e22e24291f649e59bc Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Wed, 21 Sep 2022 11:34:08 +0200 Subject: [PATCH 06/16] Using sync.Pool to avoid gc pressure Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 28 ++++++++++++++++++++-------- pkg/store/storepb/rpc.proto | 2 +- pkg/store/tsdb.go | 4 +++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index e83bae273c..60e0326ace 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -9,6 +9,7 @@ import ( "context" "encoding/binary" "fmt" + "hash" "io" "math" "os" @@ -892,12 +893,20 @@ func blockSeries( func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error), calculateChecksum bool) error { + hp := sync.Pool{ + New: func() interface{} { + return xxhash.New() + }, + } + hasher := hp.Get().(hash.Hash64) + defer hp.Put(hasher) + if in.Encoding() == chunkenc.EncXOR { b, err := save(in.Bytes()) if err != nil { return err } - out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} return nil } if in.Encoding() != downsample.ChunkEncAggr { @@ -917,7 +926,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_SUM: x, err := ac.Get(downsample.AggrSum) if err != nil { @@ -927,7 +936,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_MIN: x, err := ac.Get(downsample.AggrMin) if err != nil { @@ -937,7 +946,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_MAX: x, err := ac.Get(downsample.AggrMax) if err != nil { @@ -947,7 +956,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_COUNTER: x, err := ac.Get(downsample.AggrCounter) if err != nil { @@ -957,17 +966,20 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} } } return nil } -func hashChunk(b []byte, doHash bool) uint64 { +func hashChunk(i hash.Hash64, b []byte, doHash bool) uint64 { if !doHash { return 0 } - return xxhash.Sum64(b) + i.Reset() + // Write never returns an error on the hasher implementation + _, _ = i.Write(b) + return i.Sum64() } // debugFoundBlockSetOverview logs on debug level what exactly blocks we used for query in terms of diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index 9f5e4c39f6..838dbba037 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -123,7 +123,7 @@ message SeriesRequest { // shard of blocks instead of entire blocks. ShardInfo shard_info = 13; - // Control whether the store should calculate the checksum/hash of chunks + // Control whether the store should calculate the checksum/hash of chunks, bool calculate_chunk_checksums = 14; } diff --git a/pkg/store/tsdb.go b/pkg/store/tsdb.go index 985473e081..63f8e27cc1 100644 --- a/pkg/store/tsdb.go +++ b/pkg/store/tsdb.go @@ -10,6 +10,8 @@ import ( "sort" "sync" + "github.com/cespare/xxhash" + "github.com/go-kit/log" "github.com/pkg/errors" "github.com/prometheus/prometheus/model/labels" @@ -197,7 +199,7 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer Raw: &storepb.Chunk{ Type: storepb.Chunk_Encoding(chk.Chunk.Encoding() - 1), // Proto chunk encoding is one off to TSDB one. Data: chk.Chunk.Bytes(), - Hash: hashChunk(chk.Chunk.Bytes(), r.CalculateChunkChecksums), + Hash: hashChunk(xxhash.New(), chk.Chunk.Bytes(), r.CalculateChunkChecksums), }, } frameBytesLeft -= c.Size() From abeaa0c3c9f8bd55446c045bcb4d3a9c53d04e55 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Wed, 21 Sep 2022 11:38:03 +0200 Subject: [PATCH 07/16] Fixing whitespace Signed-off-by: Pedro Tanaka --- pkg/store/storepb/rpc.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index 7da5ae70b8..93ed030a1b 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -292,7 +292,7 @@ type SeriesRequest struct { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo *ShardInfo `protobuf:"bytes,13,opt,name=shard_info,json=shardInfo,proto3" json:"shard_info,omitempty"` - // Control whether the store should calculate the checksum/hash of chunks + // Control whether the store should calculate the checksum/hash of chunks, CalculateChunkChecksums bool `protobuf:"varint,14,opt,name=calculate_chunk_checksums,json=calculateChunkChecksums,proto3" json:"calculate_chunk_checksums,omitempty"` } From 55cae3661db79ac174f60c338bc89c14ec0df91d Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Thu, 22 Sep 2022 08:49:34 +0200 Subject: [PATCH 08/16] Fixing nit on proto Signed-off-by: Pedro Tanaka --- pkg/store/storepb/rpc.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index 838dbba037..bd8f467276 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -123,7 +123,7 @@ message SeriesRequest { // shard of blocks instead of entire blocks. ShardInfo shard_info = 13; - // Control whether the store should calculate the checksum/hash of chunks, + // Control whether the store should calculate the checksum/hash of chunks. bool calculate_chunk_checksums = 14; } From 36313336f2fb22d6d6835d532fa4d29b8a15e5b8 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Thu, 22 Sep 2022 08:54:05 +0200 Subject: [PATCH 09/16] Fixing hashpool Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 33 ++++++++++++++------------------- pkg/store/storepb/rpc.pb.go | 2 +- pkg/store/tsdb.go | 4 +--- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 60e0326ace..9c3eb278c7 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -103,6 +103,7 @@ const ( var ( errBlockSyncConcurrencyNotValid = errors.New("the block sync concurrency must be equal or greater than 1.") + hashPool = sync.Pool{New: func() interface{} { return xxhash.New() }} ) type bucketStoreMetrics struct { @@ -892,21 +893,12 @@ func blockSeries( } func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error), calculateChecksum bool) error { - - hp := sync.Pool{ - New: func() interface{} { - return xxhash.New() - }, - } - hasher := hp.Get().(hash.Hash64) - defer hp.Put(hasher) - if in.Encoding() == chunkenc.EncXOR { b, err := save(in.Bytes()) if err != nil { return err } - out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} return nil } if in.Encoding() != downsample.ChunkEncAggr { @@ -926,7 +918,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_SUM: x, err := ac.Get(downsample.AggrSum) if err != nil { @@ -936,7 +928,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_MIN: x, err := ac.Get(downsample.AggrMin) if err != nil { @@ -946,7 +938,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_MAX: x, err := ac.Get(downsample.AggrMax) if err != nil { @@ -956,7 +948,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} case storepb.Aggr_COUNTER: x, err := ac.Get(downsample.AggrCounter) if err != nil { @@ -966,20 +958,23 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} + out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} } } return nil } -func hashChunk(i hash.Hash64, b []byte, doHash bool) uint64 { +func hashChunk(b []byte, doHash bool) uint64 { + hasher := hashPool.Get().(hash.Hash64) + defer hashPool.Put(hasher) + if !doHash { return 0 } - i.Reset() + hasher.Reset() // Write never returns an error on the hasher implementation - _, _ = i.Write(b) - return i.Sum64() + _, _ = hasher.Write(b) + return hasher.Sum64() } // debugFoundBlockSetOverview logs on debug level what exactly blocks we used for query in terms of diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index 93ed030a1b..f831a823ea 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -292,7 +292,7 @@ type SeriesRequest struct { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo *ShardInfo `protobuf:"bytes,13,opt,name=shard_info,json=shardInfo,proto3" json:"shard_info,omitempty"` - // Control whether the store should calculate the checksum/hash of chunks, + // Control whether the store should calculate the checksum/hash of chunks. CalculateChunkChecksums bool `protobuf:"varint,14,opt,name=calculate_chunk_checksums,json=calculateChunkChecksums,proto3" json:"calculate_chunk_checksums,omitempty"` } diff --git a/pkg/store/tsdb.go b/pkg/store/tsdb.go index 63f8e27cc1..985473e081 100644 --- a/pkg/store/tsdb.go +++ b/pkg/store/tsdb.go @@ -10,8 +10,6 @@ import ( "sort" "sync" - "github.com/cespare/xxhash" - "github.com/go-kit/log" "github.com/pkg/errors" "github.com/prometheus/prometheus/model/labels" @@ -199,7 +197,7 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer Raw: &storepb.Chunk{ Type: storepb.Chunk_Encoding(chk.Chunk.Encoding() - 1), // Proto chunk encoding is one off to TSDB one. Data: chk.Chunk.Bytes(), - Hash: hashChunk(xxhash.New(), chk.Chunk.Bytes(), r.CalculateChunkChecksums), + Hash: hashChunk(chk.Chunk.Bytes(), r.CalculateChunkChecksums), }, } frameBytesLeft -= c.Size() From 566c423edb001edffa9333f487a1c263adece670 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Thu, 22 Sep 2022 21:38:11 +0200 Subject: [PATCH 10/16] Using pool from callee instead of inside helper function Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 20 ++++++++++---------- pkg/store/tsdb.go | 5 ++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 9c3eb278c7..3619cda886 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -893,12 +893,15 @@ func blockSeries( } func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error), calculateChecksum bool) error { + hasher := hashPool.Get().(hash.Hash64) + defer hashPool.Put(hasher) + if in.Encoding() == chunkenc.EncXOR { b, err := save(in.Bytes()) if err != nil { return err } - out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Raw = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} return nil } if in.Encoding() != downsample.ChunkEncAggr { @@ -918,7 +921,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Count = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_SUM: x, err := ac.Get(downsample.AggrSum) if err != nil { @@ -928,7 +931,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Sum = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_MIN: x, err := ac.Get(downsample.AggrMin) if err != nil { @@ -938,7 +941,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Min = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_MAX: x, err := ac.Get(downsample.AggrMax) if err != nil { @@ -948,7 +951,7 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Max = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} case storepb.Aggr_COUNTER: x, err := ac.Get(downsample.AggrCounter) if err != nil { @@ -958,16 +961,13 @@ func populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Ag if err != nil { return err } - out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(b, calculateChecksum)} + out.Counter = &storepb.Chunk{Type: storepb.Chunk_XOR, Data: b, Hash: hashChunk(hasher, b, calculateChecksum)} } } return nil } -func hashChunk(b []byte, doHash bool) uint64 { - hasher := hashPool.Get().(hash.Hash64) - defer hashPool.Put(hasher) - +func hashChunk(hasher hash.Hash64, b []byte, doHash bool) uint64 { if !doHash { return 0 } diff --git a/pkg/store/tsdb.go b/pkg/store/tsdb.go index 985473e081..d8bc060f59 100644 --- a/pkg/store/tsdb.go +++ b/pkg/store/tsdb.go @@ -5,6 +5,7 @@ package store import ( "context" + "hash" "io" "math" "sort" @@ -160,6 +161,8 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer shardMatcher := r.ShardInfo.Matcher(&s.buffers) defer shardMatcher.Close() + hasher := hashPool.Get().(hash.Hash64) + defer hashPool.Put(hasher) // Stream at most one series per frame; series may be split over multiple frames according to maxBytesInFrame. for set.Next() { series := set.At() @@ -197,7 +200,7 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer Raw: &storepb.Chunk{ Type: storepb.Chunk_Encoding(chk.Chunk.Encoding() - 1), // Proto chunk encoding is one off to TSDB one. Data: chk.Chunk.Bytes(), - Hash: hashChunk(chk.Chunk.Bytes(), r.CalculateChunkChecksums), + Hash: hashChunk(hasher, chk.Chunk.Bytes(), r.CalculateChunkChecksums), }, } frameBytesLeft -= c.Size() From 0a3f6515f8e1cc4b3329c83b129b65dbab81d5bf Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 26 Sep 2022 11:22:01 +0200 Subject: [PATCH 11/16] Reusing the hasher pool in other places Signed-off-by: Pedro Tanaka --- pkg/store/prometheus.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pkg/store/prometheus.go b/pkg/store/prometheus.go index e276fd3d5b..7c7efc9e51 100644 --- a/pkg/store/prometheus.go +++ b/pkg/store/prometheus.go @@ -7,6 +7,7 @@ import ( "bytes" "context" "fmt" + "hash" "io" "net/http" "net/url" @@ -15,8 +16,6 @@ import ( "strings" "sync" - "github.com/cespare/xxhash" - "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/timestamp" @@ -388,6 +387,8 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( // TODO(bwplotka): Put read limit as a flag. stream := remote.NewChunkedReader(bodySizer, remote.DefaultChunkedReadLimit, *data) + hasher := hashPool.Get().(hash.Hash64) + defer hashPool.Put(hasher) for { res := &prompb.ChunkedReadResponse{} err := stream.NextProto(res) @@ -413,10 +414,7 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( thanosChks := make([]storepb.AggrChunk, len(series.Chunks)) for i, chk := range series.Chunks { - hash := uint64(0) - if calculateChecksums { - hash = xxhash.Sum64(chk.Data) - } + chkHash := hashChunk(hasher, chk.Data, calculateChecksums) thanosChks[i] = storepb.AggrChunk{ MaxTime: chk.MaxTimeMs, MinTime: chk.MinTimeMs, @@ -426,7 +424,7 @@ func (p *PrometheusStore) handleStreamedPrometheusResponse( // has one difference. Prometheus has Chunk_UNKNOWN Chunk_Encoding = 0 vs we start from // XOR as 0. Compensate for that here: Type: storepb.Chunk_Encoding(chk.Type - 1), - Hash: hash, + Hash: chkHash, }, } seriesStats.Samples += thanosChks[i].Raw.XORNumSamples() @@ -512,6 +510,8 @@ func (p *PrometheusStore) fetchSampledResponse(ctx context.Context, resp *http.R func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerChunk int, calculateChecksums bool) (chks []storepb.AggrChunk, err error) { samples := series.Samples + hasher := hashPool.Get().(hash.Hash64) + defer hashPool.Put(hasher) for len(samples) > 0 { chunkSize := len(samples) @@ -524,14 +524,11 @@ func (p *PrometheusStore) chunkSamples(series *prompb.TimeSeries, maxSamplesPerC return nil, status.Error(codes.Unknown, err.Error()) } - hash := uint64(0) - if calculateChecksums { - hash = xxhash.Sum64(cb) - } + chkHash := hashChunk(hasher, cb, calculateChecksums) chks = append(chks, storepb.AggrChunk{ MinTime: samples[0].Timestamp, MaxTime: samples[chunkSize-1].Timestamp, - Raw: &storepb.Chunk{Type: enc, Data: cb, Hash: hash}, + Raw: &storepb.Chunk{Type: enc, Data: cb, Hash: chkHash}, }) samples = samples[chunkSize:] From d6ca5e9a33f4db9a33e4355a9a0372eae65fd283 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 26 Sep 2022 12:15:59 +0200 Subject: [PATCH 12/16] Calculating hashes by default Signed-off-by: Pedro Tanaka --- pkg/store/bucket.go | 7 +- pkg/store/prometheus_test.go | 22 +--- pkg/store/storepb/rpc.pb.go | 202 ++++++++++++++--------------------- pkg/store/storepb/rpc.proto | 3 - pkg/store/tsdb.go | 2 +- pkg/store/tsdb_test.go | 1 - 6 files changed, 92 insertions(+), 145 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 3619cda886..55eb28b4e0 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -99,6 +99,8 @@ const ( labelDecode = "decode" minBlockSyncConcurrency = 1 + + enableChunkHashCalculation = true ) var ( @@ -320,6 +322,8 @@ type BucketStore struct { // Enables hints in the Series() response. enableSeriesResponseHints bool + + enableChunkHashCalculation bool } func (s *BucketStore) validate() error { @@ -431,6 +435,7 @@ func NewBucketStore( enableCompatibilityLabel: enableCompatibilityLabel, postingOffsetsInMemSampling: postingOffsetsInMemSampling, enableSeriesResponseHints: enableSeriesResponseHints, + enableChunkHashCalculation: enableChunkHashCalculation, } for _, option := range options { @@ -1113,7 +1118,7 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_Serie req.Aggregates, shardMatcher, s.metrics.emptyPostingCount, - req.CalculateChunkChecksums, + s.enableChunkHashCalculation, ) if err != nil { return errors.Wrapf(err, "fetch series for block %s", b.meta.ULID) diff --git a/pkg/store/prometheus_test.go b/pkg/store/prometheus_test.go index 6c3797dccc..884f85bb12 100644 --- a/pkg/store/prometheus_test.go +++ b/pkg/store/prometheus_test.go @@ -465,9 +465,8 @@ func TestPrometheusStore_Series_ChunkHashCalculation_Integration(t *testing.T) { srv := newStoreSeriesServer(ctx) testutil.Ok(t, proxy.Series(&storepb.SeriesRequest{ - MinTime: baseT + 101, - MaxTime: baseT + 300, - CalculateChunkChecksums: true, + MinTime: baseT + 101, + MaxTime: baseT + 300, Matchers: []storepb.LabelMatcher{ {Name: "a", Value: "b"}, {Type: storepb.LabelMatcher_EQ, Name: "region", Value: "eu-west"}, @@ -480,23 +479,6 @@ func TestPrometheusStore_Series_ChunkHashCalculation_Integration(t *testing.T) { want := xxhash.Sum64(chunk.Raw.Data) testutil.Equals(t, want, got) } - - // by default do not calculate the checksums - testutil.Ok(t, proxy.Series(&storepb.SeriesRequest{ - MinTime: baseT + 101, - MaxTime: baseT + 300, - Matchers: []storepb.LabelMatcher{ - {Name: "a", Value: "b"}, - {Type: storepb.LabelMatcher_EQ, Name: "region", Value: "eu-west"}, - }, - CalculateChunkChecksums: false, - }, srv)) - testutil.Equals(t, 2, len(srv.SeriesSet)) - for _, chunk := range srv.SeriesSet[1].Chunks { - got := chunk.Raw.Hash - want := uint64(0) - testutil.Equals(t, want, got) - } } func TestPrometheusStore_Info(t *testing.T) { diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index f831a823ea..bf670d0f63 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -292,8 +292,6 @@ type SeriesRequest struct { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo *ShardInfo `protobuf:"bytes,13,opt,name=shard_info,json=shardInfo,proto3" json:"shard_info,omitempty"` - // Control whether the store should calculate the checksum/hash of chunks. - CalculateChunkChecksums bool `protobuf:"varint,14,opt,name=calculate_chunk_checksums,json=calculateChunkChecksums,proto3" json:"calculate_chunk_checksums,omitempty"` } func (m *SeriesRequest) Reset() { *m = SeriesRequest{} } @@ -832,90 +830,89 @@ func init() { func init() { proto.RegisterFile("store/storepb/rpc.proto", fileDescriptor_a938d55a388af629) } var fileDescriptor_a938d55a388af629 = []byte{ - // 1325 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6e, 0x13, 0x47, - 0x14, 0xf6, 0x7a, 0xbd, 0xfe, 0x39, 0x4e, 0x5c, 0x33, 0x18, 0xd8, 0x18, 0xc9, 0x71, 0x5d, 0x55, - 0x8a, 0x10, 0xb5, 0xa9, 0xa9, 0x90, 0x5a, 0x71, 0x93, 0x04, 0x43, 0xa2, 0x12, 0x53, 0xc6, 0x09, - 0x69, 0xa9, 0x2a, 0x6b, 0x6d, 0x4f, 0xd6, 0xab, 0xac, 0x77, 0x97, 0x9d, 0xd9, 0x26, 0xbe, 0x6d, - 0xef, 0xab, 0x8a, 0x47, 0xe8, 0x53, 0xf4, 0x11, 0xb8, 0x2b, 0x97, 0x55, 0x2f, 0x50, 0x0b, 0x2f, - 0x52, 0xcd, 0xcf, 0xae, 0xbd, 0x69, 0x80, 0x22, 0xb8, 0x89, 0xe6, 0x7c, 0xdf, 0x99, 0x33, 0xe7, - 0xdf, 0x1b, 0xb8, 0x42,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 0xdc, 0x59, 0x34, 0x24, 0x67, 0xc4, 0x64, 0x95, 0x68, - 0x7c, 0xe4, 0x69, 0x1f, 0x5b, 0xee, 0x38, 0x72, 0x2d, 0x46, 0x64, 0x88, 0xc3, 0xf1, 0x94, 0x8c, - 0x8f, 0x69, 0x34, 0xa3, 0x66, 0x45, 0xa6, 0x3d, 0x51, 0x10, 0x01, 0x6f, 0xc7, 0x74, 0xeb, 0x37, - 0x0d, 0x60, 0xe1, 0x88, 0x48, 0x14, 0x23, 0xc1, 0x70, 0xe6, 0xb8, 0xae, 0x43, 0x55, 0x53, 0x02, - 0x87, 0xf6, 0x04, 0x82, 0x9a, 0x90, 0x3b, 0x8a, 0xbc, 0xb1, 0xe8, 0xc9, 0xf2, 0xa2, 0x15, 0xee, - 0x46, 0xde, 0x18, 0x0b, 0x06, 0x5d, 0x87, 0xa2, 0x1d, 0xfa, 0x51, 0xe0, 0x78, 0xb6, 0xe8, 0xac, - 0x72, 0xb7, 0x1a, 0x6b, 0xdd, 0x53, 0x38, 0x4e, 0x34, 0xd0, 0x27, 0x71, 0xe2, 0x0c, 0xa1, 0x9a, - 0xec, 0x05, 0xcc, 0x41, 0x95, 0xc7, 0xd6, 0x09, 0x94, 0x92, 0xc0, 0x85, 0x8b, 0x2a, 0x3f, 0x13, - 0x72, 0x9a, 0xb8, 0x28, 0xf9, 0x09, 0x39, 0x45, 0x1f, 0xc3, 0x0a, 0xf3, 0x99, 0xe5, 0x0e, 0x05, - 0x46, 0xd5, 0xf8, 0x94, 0x05, 0x26, 0xcc, 0x50, 0x54, 0x81, 0xec, 0x68, 0x2e, 0x16, 0x41, 0x11, - 0x67, 0x47, 0x73, 0xbe, 0xf0, 0xd4, 0x7a, 0xca, 0x35, 0x75, 0xbe, 0xf0, 0xa4, 0xd4, 0xaa, 0x43, - 0x8e, 0x47, 0xc6, 0x4b, 0xee, 0x59, 0x6a, 0x48, 0x4b, 0x58, 0x9c, 0x5b, 0x5d, 0x28, 0xc6, 0xf1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0x52, 0x7a, 0x9f, 0xc5, 0xd7, - 0x2e, 0x9f, 0x85, 0xe5, 0xc5, 0x1b, 0x1a, 0xda, 0x06, 0x58, 0xcc, 0x15, 0x5a, 0x4b, 0x55, 0x71, - 0x79, 0x4b, 0xd5, 0xeb, 0xe7, 0x51, 0xea, 0xfd, 0xbb, 0x50, 0x5e, 0x2a, 0x2b, 0x4a, 0xab, 0xa6, - 0x86, 0xa7, 0x7e, 0xf5, 0x5c, 0x4e, 0xda, 0xe9, 0xf6, 0xa1, 0x22, 0xbe, 0xbe, 0xf9, 0x54, 0xc8, - 0x64, 0xdc, 0x86, 0x32, 0x26, 0x33, 0x9f, 0x11, 0x81, 0xa3, 0x24, 0xfc, 0xe5, 0x8f, 0xf4, 0xfa, - 0xa5, 0x33, 0xa8, 0xfa, 0x98, 0xcf, 0x6c, 0x7d, 0xfa, 0xec, 0x9f, 0x46, 0xe6, 0xd9, 0xcb, 0x86, - 0xf6, 0xfc, 0x65, 0x43, 0xfb, 0xfb, 0x65, 0x43, 0xfb, 0xf5, 0x55, 0x23, 0xf3, 0xfc, 0x55, 0x23, - 0xf3, 0xe7, 0xab, 0x46, 0xe6, 0x71, 0x41, 0xfd, 0x3f, 0x31, 0xca, 0x8b, 0x9e, 0xb9, 0xf9, 0x6f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x85, 0x56, 0x61, 0x30, 0xb9, 0x0c, 0x00, 0x00, + // 1298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5d, 0x6f, 0x13, 0x47, + 0x17, 0xf6, 0x7a, 0xbd, 0xfe, 0x38, 0x4e, 0xf2, 0x9a, 0xc1, 0xc0, 0xc6, 0x48, 0x8e, 0xdf, 0x7d, + 0xf5, 0x4a, 0x11, 0xa2, 0x36, 0x35, 0x15, 0x52, 0x2b, 0x6e, 0x92, 0x60, 0x48, 0x54, 0x62, 0xca, + 0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0, 0x8c, 0x84, 0x26, 0x88, 0xb4, 0x89, 0x33, 0xaa, 0x83, 0x11, 0xd9, 0xbe, + 0x43, 0xcc, 0xaa, 0x00, 0xa5, 0x80, 0x6e, 0x42, 0xf5, 0x69, 0x4c, 0xa2, 0xf9, 0x50, 0xda, 0x5e, + 0x11, 0xb6, 0x51, 0x12, 0xc5, 0x43, 0x4e, 0xed, 0x72, 0x06, 0xc3, 0xd3, 0xf4, 0x8c, 0x6e, 0x00, + 0xd0, 0xa9, 0x1d, 0x4d, 0x86, 0xae, 0x7f, 0x1c, 0x98, 0xab, 0xe2, 0xce, 0xa2, 0x21, 0x39, 0x23, + 0x26, 0xab, 0x42, 0x93, 0xa3, 0xf5, 0xb3, 0x06, 0xb0, 0x30, 0x26, 0x82, 0x65, 0x24, 0x1c, 0xce, + 0x5c, 0xcf, 0x73, 0xa9, 0x6a, 0x2c, 0xe0, 0xd0, 0xbe, 0x40, 0x50, 0x0b, 0x0a, 0xc7, 0xb1, 0x3f, + 0x16, 0x7d, 0x55, 0x5d, 0x94, 0xf3, 0x6e, 0xec, 0x8f, 0xb1, 0x60, 0xd0, 0x75, 0x28, 0x3b, 0x51, + 0x10, 0x87, 0xae, 0xef, 0x88, 0xee, 0xa8, 0x76, 0x6b, 0x89, 0xd6, 0x3d, 0x85, 0xe3, 0x54, 0x03, + 0xfd, 0x2f, 0x09, 0xde, 0x10, 0xaa, 0xe9, 0x6c, 0x63, 0x0e, 0xaa, 0x5c, 0x58, 0x27, 0x50, 0x49, + 0x9d, 0x17, 0x2e, 0xaa, 0x18, 0x27, 0xe4, 0x34, 0x75, 0x51, 0xf2, 0x13, 0x72, 0x8a, 0xfe, 0x0b, + 0x2b, 0x2c, 0x60, 0xb6, 0x37, 0x14, 0x18, 0x55, 0x23, 0x50, 0x15, 0x98, 0x30, 0x43, 0xd1, 0x1a, + 0xe4, 0x47, 0x73, 0x31, 0xcc, 0x65, 0x9c, 0x1f, 0xcd, 0xf9, 0xd2, 0x52, 0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x43, 0xf8, 0x88, 0x3e, 0x86, 0x82, 0x58, 0xcd, 0x17, + 0x93, 0x8c, 0x2e, 0x7d, 0xcf, 0x35, 0xea, 0x59, 0x50, 0xe5, 0xef, 0x53, 0x28, 0xca, 0xfd, 0x85, + 0x2e, 0x65, 0xf7, 0x59, 0x72, 0xed, 0xf2, 0x59, 0x58, 0x5e, 0xbc, 0xa1, 0xa1, 0x1d, 0x80, 0xc5, + 0x5c, 0xa1, 0xf5, 0x4c, 0x15, 0x97, 0xb7, 0x54, 0xa3, 0x71, 0x1e, 0xa5, 0xde, 0xbf, 0x0b, 0xd5, + 0xa5, 0xb2, 0xa2, 0xac, 0x6a, 0x66, 0x78, 0x1a, 0x57, 0xcf, 0xe5, 0xa4, 0x9d, 0x6e, 0x1f, 0xd6, + 0xc4, 0x17, 0x34, 0x9f, 0x0a, 0x99, 0x8c, 0xdb, 0x50, 0xc5, 0x64, 0x16, 0x30, 0x22, 0x70, 0x94, + 0x86, 0xbf, 0xfc, 0xa1, 0xdd, 0xb8, 0x74, 0x06, 0x55, 0x1f, 0xe4, 0xb9, 0xed, 0xff, 0x3f, 0xfb, + 0xab, 0x99, 0x7b, 0xf6, 0xb2, 0xa9, 0x3d, 0x7f, 0xd9, 0xd4, 0xfe, 0x7c, 0xd9, 0xd4, 0x7e, 0x7c, + 0xd5, 0xcc, 0x3d, 0x7f, 0xd5, 0xcc, 0xfd, 0xfe, 0xaa, 0x99, 0x7b, 0x5c, 0x52, 0xff, 0x13, 0x8c, + 0x8a, 0xa2, 0x67, 0x6e, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x02, 0x42, 0x0e, 0xd0, 0x7d, 0x0c, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1415,16 +1412,6 @@ func (m *SeriesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CalculateChunkChecksums { - i-- - if m.CalculateChunkChecksums { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } if m.ShardInfo != nil { { size, err := m.ShardInfo.MarshalToSizedBuffer(dAtA[:i]) @@ -2247,9 +2234,6 @@ func (m *SeriesRequest) Size() (n int) { l = m.ShardInfo.Size() n += 1 + l + sovRpc(uint64(l)) } - if m.CalculateChunkChecksums { - n += 2 - } return n } @@ -3316,26 +3300,6 @@ func (m *SeriesRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CalculateChunkChecksums", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CalculateChunkChecksums = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index bd8f467276..72afaba8ed 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -122,9 +122,6 @@ message SeriesRequest { // shard_info is used by the querier to request a specific // shard of blocks instead of entire blocks. ShardInfo shard_info = 13; - - // Control whether the store should calculate the checksum/hash of chunks. - bool calculate_chunk_checksums = 14; } diff --git a/pkg/store/tsdb.go b/pkg/store/tsdb.go index d8bc060f59..d876872e2e 100644 --- a/pkg/store/tsdb.go +++ b/pkg/store/tsdb.go @@ -200,7 +200,7 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer Raw: &storepb.Chunk{ Type: storepb.Chunk_Encoding(chk.Chunk.Encoding() - 1), // Proto chunk encoding is one off to TSDB one. Data: chk.Chunk.Bytes(), - Hash: hashChunk(hasher, chk.Chunk.Bytes(), r.CalculateChunkChecksums), + Hash: hashChunk(hasher, chk.Chunk.Bytes(), enableChunkHashCalculation), }, } frameBytesLeft -= c.Size() diff --git a/pkg/store/tsdb_test.go b/pkg/store/tsdb_test.go index f4523948ee..4037050cde 100644 --- a/pkg/store/tsdb_test.go +++ b/pkg/store/tsdb_test.go @@ -105,7 +105,6 @@ func TestTSDBStore_Series_ChunkChecksum(t *testing.T) { Matchers: []storepb.LabelMatcher{ {Type: storepb.LabelMatcher_EQ, Name: "a", Value: "1"}, }, - CalculateChunkChecksums: true, } err = tsdbStore.Series(req, srv) From edd1894e7de377e87786d9ea6b3ed184fd3528b2 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 26 Sep 2022 14:35:23 +0200 Subject: [PATCH 13/16] Adjusting e2e and integration tests Signed-off-by: Pedro Tanaka --- pkg/store/bucket_test.go | 5 ----- pkg/store/prometheus.go | 6 +++--- pkg/store/storepb/testutil/series.go | 3 ++- pkg/store/tsdb_test.go | 16 +--------------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index 5b15bb6899..bdaecc673b 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -2212,10 +2212,6 @@ func TestSeries_ChuncksHaveHashRepresentation(t *testing.T) { name: "calculate checksum", calculateChecksum: true, }, - { - name: "do not calculate checksum", - calculateChecksum: false, - }, } for _, tc := range testCases { @@ -2226,7 +2222,6 @@ func TestSeries_ChuncksHaveHashRepresentation(t *testing.T) { Matchers: []storepb.LabelMatcher{ {Type: storepb.LabelMatcher_EQ, Name: "__name__", Value: "test"}, }, - CalculateChunkChecksums: tc.calculateChecksum, } srv := newStoreSeriesServer(context.Background()) diff --git a/pkg/store/prometheus.go b/pkg/store/prometheus.go index 7c7efc9e51..b4546c7d05 100644 --- a/pkg/store/prometheus.go +++ b/pkg/store/prometheus.go @@ -234,13 +234,13 @@ func (p *PrometheusStore) Series(r *storepb.SeriesRequest, s storepb.Store_Serie // remote read. contentType := httpResp.Header.Get("Content-Type") if strings.HasPrefix(contentType, "application/x-protobuf") { - return p.handleSampledPrometheusResponse(s, httpResp, queryPrometheusSpan, extLset, r.CalculateChunkChecksums) + return p.handleSampledPrometheusResponse(s, httpResp, queryPrometheusSpan, extLset, enableChunkHashCalculation) } if !strings.HasPrefix(contentType, "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse") { return errors.Errorf("not supported remote read content type: %s", contentType) } - return p.handleStreamedPrometheusResponse(s, shardMatcher, httpResp, queryPrometheusSpan, extLset, r.CalculateChunkChecksums) + return p.handleStreamedPrometheusResponse(s, shardMatcher, httpResp, queryPrometheusSpan, extLset, enableChunkHashCalculation) } func (p *PrometheusStore) queryPrometheus(s storepb.Store_SeriesServer, r *storepb.SeriesRequest) error { @@ -294,7 +294,7 @@ func (p *PrometheusStore) queryPrometheus(s storepb.Store_SeriesServer, r *store Samples: prompb.SamplesFromSamplePairs(vector.Values), } - chks, err := p.chunkSamples(series, MaxSamplesPerChunk, r.CalculateChunkChecksums) + chks, err := p.chunkSamples(series, MaxSamplesPerChunk, enableChunkHashCalculation) if err != nil { return err } diff --git a/pkg/store/storepb/testutil/series.go b/pkg/store/storepb/testutil/series.go index f3d2fad338..ce6d14ee31 100644 --- a/pkg/store/storepb/testutil/series.go +++ b/pkg/store/storepb/testutil/series.go @@ -6,6 +6,7 @@ package storetestutil import ( "context" "fmt" + "github.com/cespare/xxhash" "math" "math/rand" "os" @@ -140,7 +141,7 @@ func CreateHeadWithSeries(t testing.TB, j int, opts HeadGenOptions) (*tsdb.Head, expected[len(expected)-1].Chunks = append(expected[len(expected)-1].Chunks, storepb.AggrChunk{ MinTime: c.MinTime, MaxTime: c.MaxTime, - Raw: &storepb.Chunk{Type: storepb.Chunk_XOR, Data: chEnc.Bytes()}, + Raw: &storepb.Chunk{Type: storepb.Chunk_XOR, Data: chEnc.Bytes(), Hash: xxhash.Sum64(chEnc.Bytes())}, }) } } diff --git a/pkg/store/tsdb_test.go b/pkg/store/tsdb_test.go index 4037050cde..9fdaed7664 100644 --- a/pkg/store/tsdb_test.go +++ b/pkg/store/tsdb_test.go @@ -92,25 +92,11 @@ func TestTSDBStore_Series_ChunkChecksum(t *testing.T) { {Type: storepb.LabelMatcher_EQ, Name: "a", Value: "1"}, }, } - err = tsdbStore.Series(req, srv) - testutil.Ok(t, err) - - for _, chk := range srv.SeriesSet[0].Chunks { - testutil.Equals(t, uint64(0), chk.Raw.Hash) - } - - req = &storepb.SeriesRequest{ - MinTime: 1, - MaxTime: 3, - Matchers: []storepb.LabelMatcher{ - {Type: storepb.LabelMatcher_EQ, Name: "a", Value: "1"}, - }, - } err = tsdbStore.Series(req, srv) testutil.Ok(t, err) - for _, chk := range srv.SeriesSet[1].Chunks { + for _, chk := range srv.SeriesSet[0].Chunks { want := xxhash.Sum64(chk.Raw.Data) testutil.Equals(t, want, chk.Raw.Hash) } From 20550364ad201a3dcde78526502650b29e6b16cd Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 26 Sep 2022 15:01:01 +0200 Subject: [PATCH 14/16] fixing linting and e2e test Signed-off-by: Pedro Tanaka --- pkg/store/storepb/testutil/series.go | 3 ++- test/e2e/query_frontend_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/store/storepb/testutil/series.go b/pkg/store/storepb/testutil/series.go index ce6d14ee31..9ad9a4619b 100644 --- a/pkg/store/storepb/testutil/series.go +++ b/pkg/store/storepb/testutil/series.go @@ -6,7 +6,6 @@ package storetestutil import ( "context" "fmt" - "github.com/cespare/xxhash" "math" "math/rand" "os" @@ -16,6 +15,8 @@ import ( "testing" "time" + "github.com/cespare/xxhash" + "github.com/gogo/protobuf/types" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/tsdb" diff --git a/test/e2e/query_frontend_test.go b/test/e2e/query_frontend_test.go index e6871801ee..d8972c2ec5 100644 --- a/test/e2e/query_frontend_test.go +++ b/test/e2e/query_frontend_test.go @@ -594,7 +594,7 @@ func TestRangeQueryShardingWithRandomData(t *testing.T) { func TestRangeQueryDynamicHorizontalSharding(t *testing.T) { t.Parallel() - e, err := e2e.NewDockerEnvironment("query-frontend-dynamic-shards") + e, err := e2e.New(e2e.WithName("qfe-dyn-sharding")) testutil.Ok(t, err) t.Cleanup(e2ethanos.CleanScenario(t, e)) From f2ccbdc18d8a5ad481830906eb939082d340708b Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Fri, 14 Oct 2022 18:21:59 +0200 Subject: [PATCH 15/16] Fixing new call format for tsdb.NewHead Signed-off-by: Pedro Tanaka --- pkg/store/bucket_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index bdaecc673b..f134195b15 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -2142,7 +2142,7 @@ func TestSeries_ChuncksHaveHashRepresentation(t *testing.T) { headOpts := tsdb.DefaultHeadOptions() headOpts.ChunkDirRoot = filepath.Join(tmpDir, "block") - h, err := tsdb.NewHead(nil, nil, nil, headOpts, nil) + h, err := tsdb.NewHead(nil, nil, nil, nil, headOpts, nil) testutil.Ok(t, err) defer func() { testutil.Ok(t, h.Close()) }() From 2680da6cea92d1102e8baaf6057018ce4c224090 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Mon, 17 Oct 2022 09:11:58 +0200 Subject: [PATCH 16/16] Adding option to control whether to hash chunks on stores or not Signed-off-by: Pedro Tanaka --- cmd/thanos/store.go | 1 + internal/cortex/storegateway/bucket_stores.go | 1 + pkg/store/bucket.go | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/cmd/thanos/store.go b/cmd/thanos/store.go index 40de4ae81d..546ee78d0b 100644 --- a/cmd/thanos/store.go +++ b/cmd/thanos/store.go @@ -332,6 +332,7 @@ func runStore( store.WithQueryGate(queriesGate), store.WithChunkPool(chunkPool), store.WithFilterConfig(conf.filterConf), + store.WithChunkHashCalculation(true), } if conf.debugLogging { diff --git a/internal/cortex/storegateway/bucket_stores.go b/internal/cortex/storegateway/bucket_stores.go index a0b81eabd1..cfda02a2db 100644 --- a/internal/cortex/storegateway/bucket_stores.go +++ b/internal/cortex/storegateway/bucket_stores.go @@ -481,6 +481,7 @@ func (u *BucketStores) getOrCreateStore(userID string) (*store.BucketStore, erro store.WithIndexCache(u.indexCache), store.WithQueryGate(u.queryGate), store.WithChunkPool(u.chunksPool), + store.WithChunkHashCalculation(true), } if u.logLevel.String() == "debug" { bucketStoreOpts = append(bucketStoreOpts, store.WithDebugLogging()) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 55eb28b4e0..84b5174f14 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -397,6 +397,12 @@ func WithDebugLogging() BucketStoreOption { } } +func WithChunkHashCalculation(enableChunkHashCalculation bool) BucketStoreOption { + return func(s *BucketStore) { + s.enableChunkHashCalculation = enableChunkHashCalculation + } +} + // NewBucketStore creates a new bucket backed store that implements the store API against // an object store bucket. It is optimized to work against high latency backends. func NewBucketStore(