From f5efbbadd15937e003a832c23644813df23a0387 Mon Sep 17 00:00:00 2001 From: tangenta Date: Thu, 9 Feb 2023 21:26:33 +0800 Subject: [PATCH] ddl: initialize the mock session in advanced (#41227) close pingcap/tidb#40879 --- ddl/backfilling.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ddl/backfilling.go b/ddl/backfilling.go index 4455801b7cc6d..6abaad9396e6c 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 }