Skip to content

Commit ab12ba5

Browse files
committed
domain: fix data race in the ttlJobManager
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
1 parent b6d96fd commit ab12ba5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

domain/domain.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import (
6969
"github.com/pingcap/tidb/util/engine"
7070
"github.com/pingcap/tidb/util/etcd"
7171
"github.com/pingcap/tidb/util/expensivequery"
72+
"github.com/pingcap/tidb/util/intest"
7273
"github.com/pingcap/tidb/util/logutil"
7374
"github.com/pingcap/tidb/util/memory"
7475
"github.com/pingcap/tidb/util/memoryusagealarm"
@@ -905,7 +906,12 @@ func (do *Domain) Close() {
905906
ttlJobManager := do.ttlJobManager.Load()
906907
if ttlJobManager != nil {
907908
ttlJobManager.Stop()
908-
err := ttlJobManager.WaitStopped(context.Background(), 30*time.Second)
909+
err := ttlJobManager.WaitStopped(context.Background(), func() time.Duration {
910+
if intest.InTest {
911+
return 10 * time.Second
912+
}
913+
return 30 * time.Second
914+
}())
909915
if err != nil {
910916
logutil.BgLogger().Warn("fail to wait until the ttl job manager stop", zap.Error(err))
911917
}

0 commit comments

Comments
 (0)