diff --git a/pkg/cmd/roachtest/tpchvec.go b/pkg/cmd/roachtest/tpchvec.go index f9c169c01189..854d8c39697f 100644 --- a/pkg/cmd/roachtest/tpchvec.go +++ b/pkg/cmd/roachtest/tpchvec.go @@ -49,6 +49,11 @@ func registerTPCHVec(r *testRegistry) { 19: "can cause OOM", } + vectorizeOptionByVersionPrefix := map[string]string{ + "v19.2": "experimental_on", + "v20.1": "full", + } + runTPCHVec := func(ctx context.Context, t *test, c *cluster) { TPCHTables := []string{ "nation", "region", "part", "supplier", @@ -507,7 +512,15 @@ RESTORE tpch.* FROM 'gs://cockroach-fixtures/workload/tpch/scalefactor=1/backup' } vectorizeSetting := "off" if vectorize { - vectorizeSetting = "experimental_on" + for versionPrefix, vectorizeOption := range vectorizeOptionByVersionPrefix { + if strings.HasPrefix(version, versionPrefix) { + vectorizeSetting = vectorizeOption + break + } + } + if vectorizeSetting == "off" { + t.Fatal("unexpectedly didn't find the corresponding vectorize option for ON case") + } } cmd := fmt.Sprintf("./workload run tpch --concurrency=1 --db=tpch "+ "--max-ops=%d --queries=%d --vectorize=%s {pgurl:1-%d}", diff --git a/pkg/sql/colexec/execplan.go b/pkg/sql/colexec/execplan.go index a6bec324e3a9..e3e72f5a2f4f 100644 --- a/pkg/sql/colexec/execplan.go +++ b/pkg/sql/colexec/execplan.go @@ -226,9 +226,9 @@ func isSupported( if core.Distinct.ErrorOnDup != "" { return false, errors.Newf("distinct with error on duplicates not supported") } - if mode != sessiondata.VectorizeExperimentalOn && mode != sessiondata.VectorizeExperimentalAlways { + if mode != sessiondata.VectorizeFull && mode != sessiondata.VectorizeExperimentalAlways { if len(core.Distinct.OrderedColumns) < len(core.Distinct.DistinctColumns) { - return false, errors.Newf("unordered distinct can only run in 'experimental_on' vectorize mode") + return false, errors.Newf("unordered distinct can only run in 'full' vectorize mode") } } return true, nil @@ -273,10 +273,10 @@ func isSupported( if _, supported := SupportedWindowFns[*wf.Func.WindowFunc]; !supported { return false, errors.Newf("window function %s is not supported", wf.String()) } - if mode != sessiondata.VectorizeExperimentalOn && mode != sessiondata.VectorizeExperimentalAlways { + if mode != sessiondata.VectorizeFull && mode != sessiondata.VectorizeExperimentalAlways { switch *wf.Func.WindowFunc { case execinfrapb.WindowerSpec_PERCENT_RANK, execinfrapb.WindowerSpec_CUME_DIST: - return false, errors.Newf("window function %s can only run in 'experimental_on' vectorize mode", wf.String()) + return false, errors.Newf("window function %s can only run in 'full' vectorize mode", wf.String()) } } } diff --git a/pkg/sql/exec_util.go b/pkg/sql/exec_util.go index 111815cfa577..b6bf93cd551f 100644 --- a/pkg/sql/exec_util.go +++ b/pkg/sql/exec_util.go @@ -193,10 +193,10 @@ var VectorizeClusterMode = settings.RegisterEnumSetting( "default vectorize mode", "auto", map[int64]string{ - int64(sessiondata.VectorizeOff): "off", - int64(sessiondata.Vectorize192Auto): "192auto", - int64(sessiondata.VectorizeAuto): "auto", - int64(sessiondata.VectorizeExperimentalOn): "experimental_on", + int64(sessiondata.VectorizeOff): "off", + int64(sessiondata.Vectorize192Auto): "192auto", + int64(sessiondata.VectorizeAuto): "auto", + int64(sessiondata.VectorizeFull): "full", }, ) diff --git a/pkg/sql/explain_vec.go b/pkg/sql/explain_vec.go index 6a9614fcd464..c2c63ad905b3 100644 --- a/pkg/sql/explain_vec.go +++ b/pkg/sql/explain_vec.go @@ -75,11 +75,9 @@ func (n *explainVecNode) startExec(params runParams) error { flowCtx := makeFlowCtx(planCtx, plan, params) flowCtx.Cfg.ClusterID = &distSQLPlanner.rpcCtx.ClusterID - // Temporarily set vectorize to on so that we can get the whole plan back even - // if we wouldn't support it due to lack of streaming. - origMode := flowCtx.EvalCtx.SessionData.VectorizeMode - flowCtx.EvalCtx.SessionData.VectorizeMode = sessiondata.VectorizeExperimentalOn - defer func() { flowCtx.EvalCtx.SessionData.VectorizeMode = origMode }() + if flowCtx.EvalCtx.SessionData.VectorizeMode == sessiondata.VectorizeOff { + return errors.New("vectorize set to 'off'") + } sortedFlows := make([]flowWithNode, 0, len(flows)) for nodeID, flow := range flows { diff --git a/pkg/sql/logictest/logic.go b/pkg/sql/logictest/logic.go index 806ae730af58..3ac6fe8c86dd 100644 --- a/pkg/sql/logictest/logic.go +++ b/pkg/sql/logictest/logic.go @@ -438,7 +438,7 @@ var logicTestConfigs = []testClusterConfig{ name: "local-vec", numNodes: 1, overrideAutoStats: "false", - overrideVectorize: "experimental_on", + overrideVectorize: "full", }, { name: "fakedist", @@ -470,7 +470,7 @@ var logicTestConfigs = []testClusterConfig{ useFakeSpanResolver: true, overrideDistSQLMode: "on", overrideAutoStats: "false", - overrideVectorize: "experimental_on", + overrideVectorize: "full", }, { name: "fakedist-vec-disk", @@ -478,7 +478,7 @@ var logicTestConfigs = []testClusterConfig{ useFakeSpanResolver: true, overrideDistSQLMode: "on", overrideAutoStats: "false", - overrideVectorize: "experimental_on", + overrideVectorize: "full", sqlExecUseDisk: true, skipShort: true, }, @@ -516,7 +516,7 @@ var logicTestConfigs = []testClusterConfig{ name: "5node-dist-vec", numNodes: 5, overrideDistSQLMode: "on", - overrideVectorize: "experimental_on", + overrideVectorize: "full", overrideAutoStats: "false", }, { diff --git a/pkg/sql/logictest/testdata/logic_test/set b/pkg/sql/logictest/testdata/logic_test/set index 6011863ad875..8a02eee42fd6 100644 --- a/pkg/sql/logictest/testdata/logic_test/set +++ b/pkg/sql/logictest/testdata/logic_test/set @@ -172,7 +172,7 @@ statement ok SET vectorize = auto statement ok -SET vectorize = experimental_on +SET vectorize = full statement ok SET vectorize = experimental_always diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_local b/pkg/sql/logictest/testdata/logic_test/vectorize_local index c678862017aa..727e1159937a 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_local +++ b/pkg/sql/logictest/testdata/logic_test/vectorize_local @@ -30,7 +30,7 @@ INSERT INTO d VALUES (1, 1), (1, 2) # Test that vectorized stats are collected correctly. statement ok -SET vectorize = experimental_on +SET vectorize = full statement ok SET distsql = on diff --git a/pkg/sql/rowexec/processors_test.go b/pkg/sql/rowexec/processors_test.go index c56af9cea858..672297b44a91 100644 --- a/pkg/sql/rowexec/processors_test.go +++ b/pkg/sql/rowexec/processors_test.go @@ -619,7 +619,7 @@ func TestDrainingProcessorSwallowsUncertaintyError(t *testing.T) { t.Fatal(err) } if vectorize { - if _, err := conn.Exec("set vectorize='experimental_on'"); err != nil { + if _, err := conn.Exec("set vectorize='full'"); err != nil { t.Fatal(err) } } diff --git a/pkg/sql/sessiondata/session_data.go b/pkg/sql/sessiondata/session_data.go index d8f41e058ffa..a12d3856e7e1 100644 --- a/pkg/sql/sessiondata/session_data.go +++ b/pkg/sql/sessiondata/session_data.go @@ -265,14 +265,14 @@ const ( // VectorizeOff means that columnar execution is disabled. VectorizeOff VectorizeExecMode = iota // Vectorize192Auto means that that any supported queries that use only - // streaming operators (i.e. those that do not require any buffering) will be - // run using the columnar execution. - // TODO(asubiotto): This was the auto setting for 19.2 and is kept around as - // an escape hatch. Remove in 20.2. + // streaming operators (i.e. those that do not require any buffering) will + // be run using the columnar execution. + // TODO(asubiotto): This was the auto setting for 19.2 and is kept around + // as an escape hatch. Remove in 20.2. Vectorize192Auto - // VectorizeExperimentalOn means that any supported queries will be run using - // the columnar execution on. - VectorizeExperimentalOn + // VectorizeFull means that any supported queries will be run using the + // columnar execution on. + VectorizeFull // VectorizeExperimentalAlways means that we attempt to vectorize all // queries; unsupported queries will fail. Mostly used for testing. VectorizeExperimentalAlways @@ -291,8 +291,8 @@ func (m VectorizeExecMode) String() string { return "192auto" case VectorizeAuto: return "auto" - case VectorizeExperimentalOn: - return "experimental_on" + case VectorizeFull: + return "full" case VectorizeExperimentalAlways: return "experimental_always" default: @@ -311,8 +311,8 @@ func VectorizeExecModeFromString(val string) (VectorizeExecMode, bool) { m = Vectorize192Auto case "AUTO": m = VectorizeAuto - case "EXPERIMENTAL_ON": - m = VectorizeExperimentalOn + case "FULL": + m = VectorizeFull case "EXPERIMENTAL_ALWAYS": m = VectorizeExperimentalAlways default: diff --git a/pkg/sql/trace_test.go b/pkg/sql/trace_test.go index 8623b236f966..d35aec2ed8a1 100644 --- a/pkg/sql/trace_test.go +++ b/pkg/sql/trace_test.go @@ -222,7 +222,7 @@ func TestTrace(t *testing.T) { if _, err := sqlDB.Exec("SET distsql = off"); err != nil { t.Fatal(err) } - if _, err := sqlDB.Exec("SET vectorize = experimental_on"); err != nil { + if _, err := sqlDB.Exec("SET vectorize = full"); err != nil { t.Fatal(err) } if _, err := sqlDB.Exec("SET tracing = on; SELECT * FROM test.foo; SET tracing = off"); err != nil { diff --git a/pkg/sql/vars.go b/pkg/sql/vars.go index a1dd7f0b8271..bad1dfb627de 100644 --- a/pkg/sql/vars.go +++ b/pkg/sql/vars.go @@ -392,7 +392,7 @@ var varGen = map[string]sessionVar{ mode, ok := sessiondata.VectorizeExecModeFromString(s) if !ok { return newVarValueError(`vectorize`, s, - "off", "auto", "experimental_on", "experimental_always") + "off", "auto", "full", "experimental_always") } m.SetVectorize(mode) return nil diff --git a/pkg/workload/querybench/query_bench.go b/pkg/workload/querybench/query_bench.go index ea28745993ef..cf776e83c324 100644 --- a/pkg/workload/querybench/query_bench.go +++ b/pkg/workload/querybench/query_bench.go @@ -64,15 +64,21 @@ var queryBenchMeta = workload.Meta{ }, } -// vectorizeSetting19_1Translation is a mapping from the 19.2+ vectorize session +// vectorizeSetting19_1Translation is a mapping from the 20.1+ vectorize session // variable value to the 19.1 syntax. var vectorizeSetting19_1Translation = map[string]string{ - "experimental_on": "on", + "full": "on", "experimental_always": "always", // Translate auto as on, this was not an option in 19.1. "auto": "on", } +// vectorizeSetting19_2Translation is a mapping from the 20.1+ vectorize session +// variable value to the 19.2 syntax. +var vectorizeSetting19_2Translation = map[string]string{ + "full": "experimental_on", +} + // Meta implements the Generator interface. func (*queryBench) Meta() workload.Meta { return queryBenchMeta } @@ -125,14 +131,19 @@ func (g *queryBench) Ops(urls []string, reg *histogram.Registry) (workload.Query if g.vectorize != "" { _, err := db.Exec("SET vectorize=" + g.vectorize) if err != nil && strings.Contains(err.Error(), "unrecognized configuration") { - if _, ok := vectorizeSetting19_1Translation[g.vectorize]; !ok { - // Unrecognized setting value. - return workload.QueryLoad{}, err + if _, ok := vectorizeSetting19_2Translation[g.vectorize]; ok { + // Fall back to using the pre-20.1 vectorize options. + _, err = db.Exec("SET vectorize=" + vectorizeSetting19_2Translation[g.vectorize]) + } else { + if _, ok := vectorizeSetting19_1Translation[g.vectorize]; !ok { + // Unrecognized setting value. + return workload.QueryLoad{}, err + } + // Fall back to using the pre-19.2 syntax. + // TODO(asubiotto): Remove this once we stop running this test + // against 19.1. + _, err = db.Exec("SET experimental_vectorize=" + vectorizeSetting19_1Translation[g.vectorize]) } - // Fall back to using the pre-19.2 syntax. - // TODO(asubiotto): Remove this once we stop running this test against - // 19.1. - _, err = db.Exec("SET experimental_vectorize=" + vectorizeSetting19_1Translation[g.vectorize]) } if err != nil { return workload.QueryLoad{}, err