File tree Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
29
29
"github.com/pingcap/tidb/pkg/planner/util/optimizetrace"
30
30
"github.com/pingcap/tidb/pkg/sessionctx/variable"
31
31
"github.com/pingcap/tidb/pkg/statistics"
32
+ "github.com/pingcap/tidb/pkg/util/intest"
32
33
"github.com/pingcap/tidb/pkg/util/paging"
33
34
)
34
35
@@ -87,6 +88,7 @@ func (p *PhysicalProjection) GetCost(count float64) float64 {
87
88
88
89
// GetPlanCostVer1 calculates the cost of the plan if it has not been calculated yet and returns the cost.
89
90
func (p * PhysicalProjection ) GetPlanCostVer1 (taskType property.TaskType , option * optimizetrace.PlanCostOption ) (float64 , error ) {
91
+ intest .Assert (p .SCtx ().GetSessionVars ().CostModelVersion != 0 )
90
92
costFlag := option .CostFlag
91
93
if p .PlanCostInit && ! hasCostFlag (costFlag , costusage .CostFlagRecalculate ) {
92
94
return p .PlanCost , nil
Original file line number Diff line number Diff line change @@ -2226,6 +2226,7 @@ func NewSessionVars(hctx HookContext) *SessionVars {
2226
2226
EnableRedactLog : DefTiDBRedactLog ,
2227
2227
EnableWindowFunction : DefEnableWindowFunction ,
2228
2228
OptOrderingIdxSelRatio : DefTiDBOptOrderingIdxSelRatio ,
2229
+ CostModelVersion : DefTiDBCostModelVer ,
2229
2230
}
2230
2231
vars .status .Store (uint32 (mysql .ServerStatusAutocommit ))
2231
2232
vars .StmtCtx .ResourceGroupName = resourcegroup .DefaultResourceGroupName
Original file line number Diff line number Diff line change @@ -668,9 +668,14 @@ func newContext() *Context {
668
668
vars .StmtCtx .MemTracker .AttachTo (vars .MemTracker )
669
669
vars .StmtCtx .DiskTracker .AttachTo (vars .DiskTracker )
670
670
vars .GlobalVarsAccessor = variable .NewMockGlobalAccessor ()
671
+ << << << < HEAD
671
672
vars .EnablePaging = variable .DefTiDBEnablePaging
672
673
vars .MinPagingSize = variable .DefMinPagingSize
673
674
vars .CostModelVersion = variable .DefTiDBCostModelVer
675
+ == == == =
676
+ vars .EnablePaging = vardef .DefTiDBEnablePaging
677
+ vars .MinPagingSize = vardef .DefMinPagingSize
678
+ >> >> >> > 1 ef4c269cd7 (planner : set the default of the tidb_cost_model_version correctly (#61608 ))
674
679
vars .EnableChunkRPC = true
675
680
vars .DivPrecisionIncrement = variable .DefDivPrecisionIncrement
676
681
if err := sctx .GetSessionVars ().SetSystemVar (variable .MaxAllowedPacket , "67108864" ); err != nil {
You can’t perform that action at this time.
0 commit comments