Skip to content

Commit

Permalink
Fix a peformance regression due to uncertain compaction sleep interval
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
  • Loading branch information
ahrtr authored and k8s-infra-cherrypick-robot committed Feb 13, 2025
1 parent 302f21d commit 61ca409
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions server/storage/mvcc/kvstore_compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
binary.BigEndian.PutUint64(end, uint64(compactMainRev+1))

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

select {
case <-batchTicker.C:
case <-time.After(s.cfg.CompactionSleepInterval):
case <-s.stopc:
return KeyValueHash{}, fmt.Errorf("interrupted due to stop signal")
}
Expand Down

0 comments on commit 61ca409

Please sign in to comment.