mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: do not update b.nextIdx if no samples are removed because of retention
This commit is contained in:
parent
022fe4efd0
commit
940a547116
1 changed files with 5 additions and 2 deletions
|
@ -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 a new issue