Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
84653: sql/sem/builtins: add multi-region functions to distsql blocklist r=e-mbrown a=ajwerner

These functions in some cases look at the gateway region and in others actually
perform schema changes. These operations must not be executed in parallel.

Fixes cockroachdb#80023

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
craig[bot] and ajwerner committed Jul 19, 2022
2 parents 121f416 + 6acc16c commit a9beb6c
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -6374,7 +6374,10 @@ the locality flag on node startup. Returns an error if no region is set.`,
},
),
builtinconstants.DefaultToDatabasePrimaryRegionBuiltinName: makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
stringOverload1(
func(evalCtx *eval.Context, s string) (tree.Datum, error) {
regionConfig, err := evalCtx.Regions.CurrentDatabaseRegionConfig(evalCtx.Context)
Expand Down Expand Up @@ -6402,7 +6405,10 @@ the locality flag on node startup. Returns an error if no region is set.`,
),
),
builtinconstants.RehomeRowBuiltinName: makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
tree.Overload{
Types: tree.ArgTypes{},
ReturnType: tree.FixedReturnType(types.String),
Expand Down Expand Up @@ -6438,7 +6444,10 @@ the locality flag on node startup. Returns an error if no region is set.`,
},
),
"crdb_internal.validate_multi_region_zone_configs": makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
tree.Overload{
Types: tree.ArgTypes{},
ReturnType: tree.FixedReturnType(types.Bool),
Expand All @@ -6458,7 +6467,10 @@ the locality flag on node startup. Returns an error if no region is set.`,
},
),
"crdb_internal.reset_multi_region_zone_configs_for_table": makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
tree.Overload{
Types: tree.ArgTypes{{"id", types.Int}},
ReturnType: tree.FixedReturnType(types.Bool),
Expand All @@ -6480,7 +6492,10 @@ table.`,
},
),
"crdb_internal.reset_multi_region_zone_configs_for_database": makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
tree.Overload{
Types: tree.ArgTypes{{"id", types.Int}},
ReturnType: tree.FixedReturnType(types.Bool),
Expand All @@ -6502,7 +6517,10 @@ enabled.`,
},
),
"crdb_internal.filter_multiregion_fields_from_zone_config_sql": makeBuiltin(
tree.FunctionProperties{Category: builtinconstants.CategoryMultiRegion},
tree.FunctionProperties{
Category: builtinconstants.CategoryMultiRegion,
DistsqlBlocklist: true, // applicable only on the gateway
},
stringOverload1(
func(evalCtx *eval.Context, s string) (tree.Datum, error) {
stmt, err := parser.ParseOne(s)
Expand Down

0 comments on commit a9beb6c

Please sign in to comment.