diff --git a/config/config.go b/config/config.go index 93ca18fccfdc4..a1b2b4938e92a 100644 --- a/config/config.go +++ b/config/config.go @@ -422,6 +422,7 @@ type Performance struct { MemProfileInterval string `toml:"mem-profile-interval" json:"mem-profile-interval"` IndexUsageSyncLease string `toml:"index-usage-sync-lease" json:"index-usage-sync-lease"` GOGC int `toml:"gogc" json:"gogc"` + EnforceMPP bool `toml:"enforce-mpp" json:"enforce-mpp"` } // PlanCache is the PlanCache section of the config. @@ -618,6 +619,7 @@ var defaultConf = Config{ // TODO: set indexUsageSyncLease to 60s. IndexUsageSyncLease: "0s", GOGC: 100, + EnforceMPP: false, }, ProxyProtocol: ProxyProtocol{ Networks: "", diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 5d8190ee45ad7..ec7f4201a65b1 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -580,8 +580,8 @@ var defaultSysVars = []*SysVar{ return oracle.LocalTxnScope }()}, /* TiDB specific variables */ - {Scope: ScopeGlobal | ScopeSession, Name: TiDBAllowMPPExecution, Type: TypeBool, Value: BoolToOnOff(DefTiDBAllowMPPExecution)}, - {Scope: ScopeGlobal | ScopeSession, Name: TiDBEnforceMPPExecution, Type: TypeBool, Value: BoolToOnOff(DefTiDBEnforceMPPExecution)}, + {Scope: ScopeGlobal | ScopeSession, Name: TiDBAllowMPPExecution, Type: TypeBool, Value: BoolToOnOff(config.GetGlobalConfig().Performance.EnforceMPP)}, + {Scope: ScopeSession, Name: TiDBEnforceMPPExecution, Type: TypeBool, Value: BoolToOnOff(DefTiDBEnforceMPPExecution)}, {Scope: ScopeGlobal | ScopeSession, Name: TiDBBCJThresholdCount, Value: strconv.Itoa(DefBroadcastJoinThresholdCount), Type: TypeInt, MinValue: 0, MaxValue: math.MaxInt64}, {Scope: ScopeGlobal | ScopeSession, Name: TiDBBCJThresholdSize, Value: strconv.Itoa(DefBroadcastJoinThresholdSize), Type: TypeInt, MinValue: 0, MaxValue: math.MaxInt64}, {Scope: ScopeSession, Name: TiDBSnapshot, Value: ""}, diff --git a/tidb-server/main.go b/tidb-server/main.go index f9cb021a894e8..b2fe742d67b2b 100644 --- a/tidb-server/main.go +++ b/tidb-server/main.go @@ -568,7 +568,8 @@ func setGlobalVars() { variable.SetSysVar(variable.Socket, cfg.Socket) variable.SetSysVar(variable.DataDir, cfg.Path) variable.SetSysVar(variable.TiDBSlowQueryFile, cfg.Log.SlowQueryFile) - variable.SetSysVar(variable.TiDBIsolationReadEngines, strings.Join(cfg.IsolationRead.Engines, ", ")) + variable.SetSysVar(variable.TiDBIsolationReadEngines, strings.Join(cfg.IsolationRead.Engines, ",")) + variable.SetSysVar(variable.TiDBEnforceMPPExecution, variable.BoolToOnOff(config.GetGlobalConfig().Performance.EnforceMPP)) variable.MemoryUsageAlarmRatio.Store(cfg.Performance.MemoryUsageAlarmRatio) // For CI environment we default enable prepare-plan-cache.