mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +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,12 +179,15 @@ func mergeBlocks(ob, ib1, ib2 *Block, retentionDeadline int64, rowsDeleted *uint
|
||||||
func skipSamplesOutsideRetention(b *Block, retentionDeadline int64, rowsDeleted *uint64) {
|
func skipSamplesOutsideRetention(b *Block, retentionDeadline int64, rowsDeleted *uint64) {
|
||||||
timestamps := b.timestamps
|
timestamps := b.timestamps
|
||||||
nextIdx := b.nextIdx
|
nextIdx := b.nextIdx
|
||||||
|
nextIdxOrig := nextIdx
|
||||||
for nextIdx < len(timestamps) && timestamps[nextIdx] < retentionDeadline {
|
for nextIdx < len(timestamps) && timestamps[nextIdx] < retentionDeadline {
|
||||||
nextIdx++
|
nextIdx++
|
||||||
}
|
}
|
||||||
atomic.AddUint64(rowsDeleted, uint64(nextIdx-b.nextIdx))
|
if n := nextIdx - nextIdxOrig; n > 0 {
|
||||||
|
atomic.AddUint64(rowsDeleted, uint64(n))
|
||||||
b.nextIdx = nextIdx
|
b.nextIdx = nextIdx
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func appendRows(ob, ib *Block) {
|
func appendRows(ob, ib *Block) {
|
||||||
ob.timestamps = append(ob.timestamps, ib.timestamps[ib.nextIdx:]...)
|
ob.timestamps = append(ob.timestamps, ib.timestamps[ib.nextIdx:]...)
|
||||||
|
|
Loading…
Reference in a new issue