Skip to content

Commit

Permalink
Merge pull request #19405 from miancheng7/fix-compaction-induce-latency
Browse files Browse the repository at this point in the history
[release-3.5] Fix a performance regression due to uncertain compaction sleep interval
  • Loading branch information
ahrtr authored Feb 13, 2025
2 parents 6485d48 + da930c7 commit 4fb86eb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions server/mvcc/kvstore_compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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)

Expand Down Expand Up @@ -90,7 +88,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 4fb86eb

Please sign in to comment.