Skip to content

Commit

Permalink
domain: fix data race in the ttlJobManager
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Feb 10, 2023
1 parent b6d96fd commit ab12ba5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import (
"github.com/pingcap/tidb/util/engine"
"github.com/pingcap/tidb/util/etcd"
"github.com/pingcap/tidb/util/expensivequery"
"github.com/pingcap/tidb/util/intest"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/memory"
"github.com/pingcap/tidb/util/memoryusagealarm"
Expand Down Expand Up @@ -905,7 +906,12 @@ func (do *Domain) Close() {
ttlJobManager := do.ttlJobManager.Load()
if ttlJobManager != nil {
ttlJobManager.Stop()
err := ttlJobManager.WaitStopped(context.Background(), 30*time.Second)
err := ttlJobManager.WaitStopped(context.Background(), func() time.Duration {
if intest.InTest {
return 10 * time.Second
}
return 30 * time.Second
}())
if err != nil {
logutil.BgLogger().Warn("fail to wait until the ttl job manager stop", zap.Error(err))
}
Expand Down

0 comments on commit ab12ba5

Please sign in to comment.