Skip to content

Commit 73c75b3

Browse files
authored
Merge pull request #19411 from k8s-infra-cherrypick-robot/cherry-pick-19410-to-release-3.6
[release-3.6] Fix a performance regression due to uncertain compaction sleep interval
2 parents 302f21d + 61ca409 commit 73c75b3

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)