Skip to content

Commit

Permalink
index stats: fix chunk size calculation (thanos-io#6424)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 authored and pedro-stanaka committed Jun 27, 2023
1 parent d105a9c commit 1e035d2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/block/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ func GatherIndexHealthStats(logger log.Logger, fn string, minTime, maxTime int64

// Approximate size.
if i < len(chks)-2 {
chunkSize.Add(int64(chks[i+1].Ref - c.Ref))
sgmIndex, chkStart := chunks.BlockChunkRef(c.Ref).Unpack()
sgmIndex2, chkStart2 := chunks.BlockChunkRef(chks[i+1].Ref).Unpack()
// Skip the case where two chunks are spread into 2 files.
if sgmIndex == sgmIndex2 {
chunkSize.Add(int64(chkStart2 - chkStart))
}
}

// Chunk vs the block ranges.
Expand Down

0 comments on commit 1e035d2

Please sign in to comment.