mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
lib/storage: do not update b.nextIdx if no samples are removed because of retention
This commit is contained in:
parent
0c403bfd29
commit
2601cc0fb0
@ -179,11 +179,14 @@ func mergeBlocks(ob, ib1, ib2 *Block, retentionDeadline int64, rowsDeleted *uint
|
||||
func skipSamplesOutsideRetention(b *Block, retentionDeadline int64, rowsDeleted *uint64) {
|
||||
timestamps := b.timestamps
|
||||
nextIdx := b.nextIdx
|
||||
nextIdxOrig := nextIdx
|
||||
for nextIdx < len(timestamps) && timestamps[nextIdx] < retentionDeadline {
|
||||
nextIdx++
|
||||
}
|
||||
atomic.AddUint64(rowsDeleted, uint64(nextIdx-b.nextIdx))
|
||||
b.nextIdx = nextIdx
|
||||
if n := nextIdx - nextIdxOrig; n > 0 {
|
||||
atomic.AddUint64(rowsDeleted, uint64(n))
|
||||
b.nextIdx = nextIdx
|
||||
}
|
||||
}
|
||||
|
||||
func appendRows(ob, ib *Block) {
|
||||
|
Loading…
Reference in New Issue
Block a user