Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compactor: Upload Sparse Index Headers to Object Storage #10684

Merged
merged 49 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c814a03
mv indexheader into utils
dmwilson-grafana Feb 14, 2025
df725dc
fmt + benchmarks for BinaryWrite
dmwilson-grafana Feb 18, 2025
b3de32d
update benchmarks
dmwilson-grafana Feb 18, 2025
4c63eb9
update tests on compactor e2e
dmwilson-grafana Feb 18, 2025
7329292
update tests on compactor e2e
dmwilson-grafana Feb 18, 2025
6ce1d79
fix err handling in WriteBinary
dmwilson-grafana Feb 18, 2025
cc8b313
mv indexheader to pkg/storage
dmwilson-grafana Feb 19, 2025
d771282
rm change to BinaryWrite
dmwilson-grafana Feb 19, 2025
753572d
rm unused import related to BinaryWrite
dmwilson-grafana Feb 19, 2025
ccb4912
pass uploadSparseIndexHeaders through Config + update docs
dmwilson-grafana Feb 20, 2025
c432e3a
update docs
dmwilson-grafana Feb 20, 2025
fa47f62
docs
dmwilson-grafana Feb 20, 2025
d8de8fa
docs
dmwilson-grafana Feb 20, 2025
00f9b41
handrail comments; rm TODO
dmwilson-grafana Feb 20, 2025
ef039aa
comments
dmwilson-grafana Feb 21, 2025
24aad5f
Merge branch 'main' into dwilson/upload-sparse-headers-from-compactor
dmwilson-grafana Feb 21, 2025
fe8a12e
add handling for configured sampling rate != sparse-index-header samp…
dmwilson-grafana Feb 22, 2025
fd2d9fd
add comments on DownsamplePostings
dmwilson-grafana Feb 22, 2025
1ea4e57
updates to downsampling
dmwilson-grafana Feb 24, 2025
c362589
golangci-lint
dmwilson-grafana Feb 24, 2025
d766041
add todo comment on test, can pass unexpectedly
dmwilson-grafana Feb 24, 2025
13753ff
update to tests
dmwilson-grafana Feb 25, 2025
41d561b
review comments
dmwilson-grafana Feb 26, 2025
fb28d6e
address review comments
dmwilson-grafana Feb 26, 2025
35a4c1b
golint
dmwilson-grafana Feb 26, 2025
8ad719f
pass config through init functions
dmwilson-grafana Feb 27, 2025
1d7d402
update downsampling in NewPostingOffsetTableFromSparseHeader to alway…
dmwilson-grafana Feb 27, 2025
7905de5
fix postings to pass TestStreamBinaryReader_CheckSparseHeadersCorrect…
dmwilson-grafana Feb 27, 2025
cd77083
fix postings to pass TestStreamBinaryReader_CheckSparseHeadersCorrect…
dmwilson-grafana Feb 27, 2025
62b3c6f
stat sparse index headers before block upload; no warning on failed u…
dmwilson-grafana Feb 27, 2025
75d604b
posting sampling tests
dmwilson-grafana Feb 27, 2025
3663d67
update header sampling tests
dmwilson-grafana Feb 27, 2025
be12809
split runCompactionJob upload into multiple concurrency.ForEachJob
dmwilson-grafana Feb 27, 2025
f4a8034
update changelog.md
dmwilson-grafana Feb 28, 2025
5af108b
Merge branch 'main' into dwilson/upload-sparse-headers-from-compactor
dmwilson-grafana Feb 28, 2025
0977f15
golint
dmwilson-grafana Feb 28, 2025
92b4610
Update CHANGELOG.md
dimitarvdimitrov Feb 28, 2025
d2439ac
Update CHANGELOG.md
dimitarvdimitrov Feb 28, 2025
7949eaf
Revert "Update CHANGELOG.md"
dimitarvdimitrov Feb 28, 2025
b69e920
Update pkg/compactor/bucket_compactor.go
dmwilson-grafana Feb 28, 2025
ce90588
add struct fields on test
dmwilson-grafana Feb 28, 2025
19a1b49
rework downsampling tests; require first and last
dmwilson-grafana Feb 28, 2025
3426a41
add check for first and last table offsets to CheckSparseHeadersCorre…
dmwilson-grafana Mar 3, 2025
c90a8cd
fix conflicts changelog.md
dmwilson-grafana Mar 3, 2025
f2e8cbd
check all ranges in index are in header
dmwilson-grafana Mar 4, 2025
4ee0a03
Merge branch 'main' into dwilson/upload-sparse-headers-from-compactor
dmwilson-grafana Mar 4, 2025
c9ead14
comment on offset adjust
dmwilson-grafana Mar 4, 2025
0f98926
Update docs/sources/mimir/configure/configuration-parameters/index.md
dmwilson-grafana Mar 5, 2025
a604399
update docs
dmwilson-grafana Mar 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pkg/storage/indexheader/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,42 @@ func Test_DownsampleSparseIndexHeader(t *testing.T) {
}
}

func compareIndexToHeaderPostings(t *testing.T, indexByteSlice index.ByteSlice, sbr *StreamBinaryReader) {

ir, err := index.NewReader(indexByteSlice, index.DecodePostingsRaw)
require.NoError(t, err)
defer func() {
_ = ir.Close()
}()

toc, err := index.NewTOCFromByteSlice(indexByteSlice)
require.NoError(t, err)

tblOffsetBounds := make(map[string][2]int64)
err = index.ReadPostingsOffsetTable(indexByteSlice, toc.PostingsTable, func(label []byte, _ []byte, _ uint64, offset int) error {
name := string(label)
off := int64(offset + 4) // 4B offset - store count on TOC
if v, ok := tblOffsetBounds[name]; ok {
v[1] = off
tblOffsetBounds[name] = v
} else {
tblOffsetBounds[name] = [2]int64{off, off}
}
return nil
})
require.NoError(t, err)

tbl := sbr.postingsOffsetTable.NewSparsePostingOffsetTable()

expLabelNames, err := ir.LabelNames(context.Background())
require.NoError(t, err)
for _, lname := range expLabelNames {
offsets := tbl.Postings[lname].Offsets
assert.Equal(t, offsets[0].TableOff, tblOffsetBounds[lname][0])
assert.Equal(t, offsets[len(offsets)-1].TableOff, tblOffsetBounds[lname][1])
}
}

func compareIndexToHeader(t *testing.T, indexByteSlice index.ByteSlice, headerReader Reader) {
ctx := context.Background()

Expand Down
1 change: 1 addition & 0 deletions pkg/storage/indexheader/stream_binary_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func TestStreamBinaryReader_CheckSparseHeadersCorrectnessExtensive(t *testing.T)

// Check correctness of sparse index headers.
compareIndexToHeader(t, b, r2)
compareIndexToHeaderPostings(t, b, r2)
})
}
}
Expand Down