Skip to content

Commit 13ca525

Browse files
gooohgbLi
andauthored
fix: ensure consistent time units and prevent erroneous cleanup in incrRollupi Process (#9259)
his PR fixes a bug in the Process function of incrRollupi. The issue was caused by inconsistent time units between the doRollup and cleanupTick logic. Specifically, doRollup used time.Now().Unix() (seconds), while cleanupTick used time.Now().UnixNano() (nanoseconds). This mismatch caused cleanupTick to erroneously delete all entries in the map m during every cleanup cycle. Co-authored-by: Li <[email protected]>
1 parent aad8b17 commit 13ca525

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

posting/mvcc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ func (ir *incrRollupi) Process(closer *z.Closer, getNewTs func(bool) uint64) {
215215
case <-closer.HasBeenClosed():
216216
return
217217
case <-cleanupTick.C:
218-
currTs := time.Now().UnixNano()
218+
currTs := time.Now().Unix()
219219
for hash, ts := range m {
220220
// Remove entries from map which have been there for there more than 10 seconds.
221-
if currTs-ts >= int64(10*time.Second) {
221+
if currTs-ts >= 10 {
222222
delete(m, hash)
223223
}
224224
}

0 commit comments

Comments
 (0)