diff --git a/ddl/backfilling.go b/ddl/backfilling.go index 4455801b7cc6..6abaad9396e6 100644 --- a/ddl/backfilling.go +++ b/ddl/backfilling.go @@ -861,6 +861,9 @@ func initSessCtx(sessCtx sessionctx.Context, sqlMode mysql.SQLMode, tzLocation * sessCtx.GetSessionVars().StmtCtx.DividedByZeroAsWarning = !sqlMode.HasStrictMode() sessCtx.GetSessionVars().StmtCtx.IgnoreZeroInDate = !sqlMode.HasStrictMode() || sqlMode.HasAllowInvalidDatesMode() sessCtx.GetSessionVars().StmtCtx.NoZeroDate = sqlMode.HasStrictMode() + // Prevent initializing the mock context in the workers concurrently. + // For details, see https://github.com/pingcap/tidb/issues/40879. + _ = sessCtx.GetDomainInfoSchema() return nil }