From 458968b6e9386c88e56824c77b8801cb639a49c1 Mon Sep 17 00:00:00 2001 From: Zhi Qi Date: Mon, 24 May 2021 00:37:30 +0800 Subject: [PATCH] solve conflicts --- planner/core/exhaust_physical_plans.go | 4 ++-- planner/core/task.go | 6 +++--- sessionctx/variable/session.go | 4 ++-- sessionctx/variable/sysvar.go | 5 +---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/planner/core/exhaust_physical_plans.go b/planner/core/exhaust_physical_plans.go index 5e31335ab2412..86041b54da121 100644 --- a/planner/core/exhaust_physical_plans.go +++ b/planner/core/exhaust_physical_plans.go @@ -2480,7 +2480,7 @@ func (p *LogicalLimit) exhaustPhysicalPlans(prop *property.PhysicalProperty) ([] if !p.limitHints.preferLimitToCop { allTaskTypes = append(allTaskTypes, property.RootTaskType) } - if p.canPushToCop(kv.TiFlash) && p.ctx.GetSessionVars().AllowMPPExecution { + if p.canPushToCop(kv.TiFlash) && p.ctx.GetSessionVars().IsMPPAllowed() { allTaskTypes = append(allTaskTypes, property.MppTaskType) } ret := make([]PhysicalPlan, 0, len(allTaskTypes)) @@ -2517,7 +2517,7 @@ func (p *LogicalUnionAll) exhaustPhysicalPlans(prop *property.PhysicalProperty) if prop.TaskTp == property.MppTaskType && prop.PartitionTp != property.AnyType { return nil, true } - canUseMpp := p.ctx.GetSessionVars().AllowMPPExecution && p.canPushToCop(kv.TiFlash) + canUseMpp := p.ctx.GetSessionVars().IsMPPAllowed() && p.canPushToCop(kv.TiFlash) chReqProps := make([]*property.PhysicalProperty, 0, len(p.children)) for range p.children { if canUseMpp && prop.TaskTp == property.MppTaskType { diff --git a/planner/core/task.go b/planner/core/task.go index 69522c28f798c..45a0f729e41c7 100644 --- a/planner/core/task.go +++ b/planner/core/task.go @@ -2008,13 +2008,13 @@ func (t *mppTask) convertToRootTaskImpl(ctx sessionctx.Context) *rootTask { }.Init(ctx, t.p.SelectBlockOffset()) p.stats = t.p.statsInfo() - p.cost = t.cst / p.ctx.GetSessionVars().CopTiFlashConcurrencyFactor + cst := t.cst / p.ctx.GetSessionVars().CopTiFlashConcurrencyFactor if p.ctx.GetSessionVars().IsMPPEnforced() { - p.cost = 0 + cst = 0 } rt := &rootTask{ p: p, - cst: p.cost, + cst: cst, } return rt } diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 9622df335cfdc..f7f0ccd7b7566 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -500,7 +500,7 @@ type SessionVars struct { AllowBatchCop int // AllowMPPExecution means if we should use mpp way to execute query. Default value is "ON", means to be determined by the optimizer. - // Value set to "ENFORCE" means to use mpp whenever possible. Value set to means never use mpp. + // Value set to "ENFORCE" means to use mpp whenever possible. Value set to "OFF" means never use mpp. allowMPPExecution string // TiDBAllowAutoRandExplicitInsert indicates whether explicit insertion on auto_random column is allowed. @@ -1501,7 +1501,7 @@ func (s *SessionVars) SetSystemVar(name string, val string) error { case TiDBAllowBatchCop: s.AllowBatchCop = int(tidbOptInt64(val, DefTiDBAllowBatchCop)) case TiDBAllowMPPExecution: - s.AllowMPPExecution = TiDBOptOn(val) + s.allowMPPExecution = val case TiDBIndexLookupSize: s.IndexLookupSize = tidbOptPositiveInt32(val, DefIndexLookupSize) case TiDBHashJoinConcurrency: diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 1c82a8403a403..63f378b004cc8 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -580,10 +580,7 @@ var defaultSysVars = []*SysVar{ return oracle.LocalTxnScope }()}, /* TiDB specific variables */ - {Scope: ScopeGlobal | ScopeSession, Name: TiDBAllowMPPExecution, Value: On, Type: TypeEnum, PossibleValues: []string{"OFF", "ON", "ENFORCE"}, SetSession: func(s *SessionVars, val string) error { - s.allowMPPExecution = val - return nil - }}, + {Scope: ScopeGlobal | ScopeSession, Name: TiDBAllowMPPExecution, Value: On, Type: TypeEnum, PossibleValues: []string{"OFF", "ON", "ENFORCE"}}, {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: ""},