diff --git a/config/config.go b/config/config.go index 68108267540b1..332aaff44bbc4 100644 --- a/config/config.go +++ b/config/config.go @@ -292,6 +292,8 @@ type Config struct { TiDBMaxReuseChunk uint32 `toml:"tidb-max-reuse-chunk" json:"tidb-max-reuse-chunk"` // TiDBMaxReuseColumn indicates max cached column num TiDBMaxReuseColumn uint32 `toml:"tidb-max-reuse-column" json:"tidb-max-reuse-column"` + // TiDBEnableExitChecking indicates whether checking background process in domain during exiting + TiDBEnableExitChecking bool `toml:"tidb-enable-exit-checking" json:"tidb-enable-exit-checking"` } // UpdateTempStoragePath is to update the `TempStoragePath` if port/statusPort was changed diff --git a/domain/domain.go b/domain/domain.go index 02858a40b5deb..403c1375d43d9 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -919,7 +919,7 @@ func NewDomain(store kv.Storage, ddlLease time.Duration, statsLease time.Duratio jobsIdsMap: make(map[int64]string), }, } - do.wg = util.NewWaitGroupEnhancedWrapper("domain", do.exit, enableEnhancedWaitGroupCheck.Load()) + do.wg = util.NewWaitGroupEnhancedWrapper("domain", do.exit, config.GetGlobalConfig().TiDBEnableExitChecking) do.SchemaValidator = NewSchemaValidator(ddlLease, do) do.expensiveQueryHandle = expensivequery.NewExpensiveQueryHandle(do.exit) do.memoryUsageAlarmHandle = memoryusagealarm.NewMemoryUsageAlarmHandle(do.exit) @@ -1705,17 +1705,10 @@ func (do *Domain) SetupDumpFileGCChecker(ctx sessionctx.Context) { } var planReplayerHandleLease atomic.Uint64 -var enableEnhancedWaitGroupCheck atomic.Bool func init() { planReplayerHandleLease.Store(uint64(10 * time.Second)) enableDumpHistoricalStats.Store(true) - enableEnhancedWaitGroupCheck.Store(true) -} - -// DisableEnhancedWaitGroupCheck4Test diable check in test -func DisableEnhancedWaitGroupCheck4Test() { - enableEnhancedWaitGroupCheck.Store(false) } // DisablePlanReplayerBackgroundJob4Test disable plan replayer handle for test diff --git a/testkit/mockstore.go b/testkit/mockstore.go index af25825811648..12afe0e0f2f68 100644 --- a/testkit/mockstore.go +++ b/testkit/mockstore.go @@ -81,7 +81,6 @@ func bootstrap(t testing.TB, store kv.Storage, lease time.Duration) *domain.Doma session.DisableStats4Test() domain.DisablePlanReplayerBackgroundJob4Test() domain.DisableDumpHistoricalStats4Test() - domain.DisableEnhancedWaitGroupCheck4Test() dom, err := session.BootstrapSession(store) require.NoError(t, err)