mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

Perviously, we advance checkCompactionInterval more than we should. The compaction might happen nondeterministically since there is no synchronization before we call clock.Advance(). The number of rg.Wait() should be equal to the number of Advance() if compactor routine and test routine run at the same pace. However, in our current test, we call Advance() more than rg.Wait(). It works OK when the compactor routine runs "slower" than the test routine, which is the common case. However, when the speed changes, the compactor routine might block rg.Rev() since there is not enough calls of rg.Wait(). This commit forces the compactor and test routine to run at the same pace. And we supply the exact number of Advance() and wg.Wait() that compactor needs.