Skip to content

Commit

Permalink
add index stats into compaction
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <benye@amazon.com>
  • Loading branch information
yeya24 committed Jun 13, 2023
1 parent a4111e7 commit d5a116f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/block/metadata/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func TestMeta_ReadWrite(t *testing.T) {
Downsample: ThanosDownsample{
Resolution: 123144,
},
IndexStats: IndexStats{
SeriesMaxSize: 2000,
ChunkMaxSize: 1000,
},
},
}
testutil.Ok(t, m1.Write(&b))
Expand Down Expand Up @@ -123,7 +127,10 @@ func TestMeta_ReadWrite(t *testing.T) {
"rel_path": "meta.json"
}
],
"index_stats": {}
"index_stats": {
"series_max_size": 2000,
"chunk_max_size": 1000
}
}
}
`, b.String())
Expand Down
4 changes: 4 additions & 0 deletions pkg/compact/compact_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ func testGroupCompactE2e(t *testing.T, mergeFunc storage.VerticalChunkSeriesMerg
testutil.Assert(t, labels.Equal(extLabels, labels.FromMap(meta.Thanos.Labels)), "ext labels does not match")
testutil.Equals(t, int64(124), meta.Thanos.Downsample.Resolution)
testutil.Assert(t, len(meta.Thanos.SegmentFiles) > 0, "compacted blocks have segment files set")
testutil.Assert(t, meta.Thanos.IndexStats.ChunkMaxSize > 0, "compacted blocks have index stats chunk max size set")
testutil.Assert(t, meta.Thanos.IndexStats.SeriesMaxSize > 0, "compacted blocks have index stats chunk max size set")
}
{
meta, ok := others[groupKey2]
Expand All @@ -415,6 +417,8 @@ func testGroupCompactE2e(t *testing.T, mergeFunc storage.VerticalChunkSeriesMerg
testutil.Assert(t, labels.Equal(extLabels2, labels.FromMap(meta.Thanos.Labels)), "ext labels does not match")
testutil.Equals(t, int64(124), meta.Thanos.Downsample.Resolution)
testutil.Assert(t, len(meta.Thanos.SegmentFiles) > 0, "compacted blocks have segment files set")
testutil.Assert(t, meta.Thanos.IndexStats.ChunkMaxSize > 0, "compacted blocks have index stats chunk max size set")
testutil.Assert(t, meta.Thanos.IndexStats.SeriesMaxSize > 0, "compacted blocks have index stats chunk max size set")
}
})
}
Expand Down

0 comments on commit d5a116f

Please sign in to comment.