store/tikv: fix gc bug. (#4665)

This commit is contained in:
disksing
2017-09-27 20:34:20 +08:00
committed by GitHub
parent a6756a4eee
commit 0e4e8c9d3a

View File

@ -588,18 +588,9 @@ func doGC(ctx goctx.Context, store *tikvStore, safePoint uint64, identifier stri
gcWorkerCounter.WithLabelValues("do_gc").Inc()
store.gcWorker.saveSafePoint(gcSavedSafePoint, safePoint)
// We want to make sure to delay enough time even if the Sleep is disrupted
{
startTime := time.Now()
leftTime := gcSafePointCacheInterval
for {
time.Sleep(leftTime)
leftTime = time.Since(startTime) - gcSafePointCacheInterval
if leftTime <= 0 {
break
}
}
}
// Sleep to wait for all other tidb instances update their safepoint cache.
time.Sleep(gcSafePointCacheInterval)
req := &tikvrpc.Request{
Type: tikvrpc.CmdGC,