From 66f8fbbb32d236bed0dc574c190b7e5d1fba2456 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin <valyala@gmail.com> Date: Thu, 24 Dec 2020 08:50:10 +0200 Subject: [PATCH] lib/storage: do not remove parts outside the configured retention if they are currently merged These parts are automatically removed after the merge is complete. --- lib/storage/partition.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/storage/partition.go b/lib/storage/partition.go index c049c0812c..2be544d231 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -1324,13 +1324,13 @@ func (pt *partition) removeStaleParts() { pt.partsLock.Lock() for _, pw := range pt.bigParts { - if pw.p.ph.MaxTimestamp < retentionDeadline { + if !pw.isInMerge && pw.p.ph.MaxTimestamp < retentionDeadline { atomic.AddUint64(&pt.bigRowsDeleted, pw.p.ph.RowsCount) m[pw] = true } } for _, pw := range pt.smallParts { - if pw.p.ph.MaxTimestamp < retentionDeadline { + if !pw.isInMerge && pw.p.ph.MaxTimestamp < retentionDeadline { atomic.AddUint64(&pt.smallRowsDeleted, pw.p.ph.RowsCount) m[pw] = true }