Skip to content

Commit

Permalink
switch to use block estimated max series size
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 committed Sep 6, 2023
1 parent 95ed76e commit c547948
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/store/lazy_postings.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,19 @@ func fetchLazyExpandedPostings(
emptyPostingGroup bool
)
/*
There are several cases that we skip postings fetch optimization:
- Lazy expanded posting disabled.
- Add all postings. This means we don't have a posting group with any add keys.
- `SeriesMaxSize` not set for this block then we have no way to estimate series size.
- Only one effective posting group available. We need to at least download postings from 1 posting group so no need to optimize.
There are several cases that we skip postings fetch optimization:
- Lazy expanded posting disabled.
- Add all postings. This means we don't have a posting group with any add keys.
- Block estimated max series size not set which means we don't have a way to estimate series bytes downloaded.
- `SeriesMaxSize` not set for this block then we have no way to estimate series size.
- Only one effective posting group available. We need to at least download postings from 1 posting group so no need to optimize.
*/
if lazyExpandedPostingEnabled && !addAllPostings &&
r.block.meta.Thanos.IndexStats.SeriesMaxSize > 0 && len(postingGroups) > 1 {
r.block.estimatedMaxSeriesSize > 0 && len(postingGroups) > 1 {
postingGroups, emptyPostingGroup, err = optimizePostingsFetchByDownloadedBytes(
r,
postingGroups,
r.block.meta.Thanos.IndexStats.SeriesMaxSize,
int64(r.block.estimatedMaxSeriesSize),
0.5, // TODO(yeya24): Expose this as a flag.
)
if err != nil {
Expand Down

0 comments on commit c547948

Please sign in to comment.