Skip to content

Commit 3bd966d

Browse files
authored
Merge pull request #19410 from ahrtr/compact_20250213
Fix a performance regression due to uncertain compaction sleep interval
2 parents 075fb10 + de10fd6 commit 3bd966d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

server/storage/mvcc/kvstore_compaction.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
4040
binary.BigEndian.PutUint64(end, uint64(compactMainRev+1))
4141

4242
batchNum := s.cfg.CompactionBatchLimit
43-
batchTicker := time.NewTicker(s.cfg.CompactionSleepInterval)
44-
defer batchTicker.Stop()
4543
h := newKVHasher(prevCompactRev, compactMainRev, keep)
4644
last := make([]byte, 8+1+8)
4745
for {
@@ -91,7 +89,7 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
9189
dbCompactionPauseMs.Observe(float64(time.Since(start) / time.Millisecond))
9290

9391
select {
94-
case <-batchTicker.C:
92+
case <-time.After(s.cfg.CompactionSleepInterval):
9593
case <-s.stopc:
9694
return KeyValueHash{}, fmt.Errorf("interrupted due to stop signal")
9795
}

0 commit comments

Comments
 (0)