Skip to content

Commit

Permalink
sql: designate optimizer_foreign_keys as experimental
Browse files Browse the repository at this point in the history
We are not going to declare the optimizer-driven-FK production-ready
in this release so this commit changes (back) the name of the session
variable and cluster setting to contain the `experimental`
designation.

Release note: None
  • Loading branch information
RaduBerinde committed Sep 11, 2019
1 parent 55294cf commit e51c7b3
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<tr><td><code>server.web_session_timeout</code></td><td>duration</td><td><code>168h0m0s</code></td><td>the duration that a newly created web session will be valid</td></tr>
<tr><td><code>sql.defaults.default_int_size</code></td><td>integer</td><td><code>8</code></td><td>the size, in bytes, of an INT type</td></tr>
<tr><td><code>sql.defaults.distsql</code></td><td>enumeration</td><td><code>auto</code></td><td>default distributed SQL execution mode [off = 0, auto = 1, on = 2]</td></tr>
<tr><td><code>sql.defaults.optimizer_foreign_keys.enabled</code></td><td>boolean</td><td><code>false</code></td><td>enables optimizer-driven foreign key checks by default</td></tr>
<tr><td><code>sql.defaults.experimental_optimizer_foreign_keys.enabled</code></td><td>boolean</td><td><code>false</code></td><td>enables optimizer-driven foreign key checks by default</td></tr>
<tr><td><code>sql.defaults.reorder_joins_limit</code></td><td>integer</td><td><code>4</code></td><td>default number of joins to reorder</td></tr>
<tr><td><code>sql.defaults.results_buffer.size</code></td><td>byte size</td><td><code>16 KiB</code></td><td>default size of the buffer that accumulates results for a statement or a batch of statements before they are sent to the client. This can be overridden on an individual connection with the 'results_buffer_size' parameter. Note that auto-retries generally only happen while no results have been delivered to the client, so reducing this size can increase the number of retriable errors a client receives. On the other hand, increasing the buffer size can increase the delay until the client receives the first result row. Updating the setting only affects new connections. Setting to 0 disables any buffering.</td></tr>
<tr><td><code>sql.defaults.serial_normalization</code></td><td>enumeration</td><td><code>rowid</code></td><td>default handling of SERIAL in table definitions [rowid = 0, virtual_sequence = 1, sql_sequence = 2]</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ var ReorderJoinsLimitClusterValue = settings.RegisterValidatedIntSetting(
)

var optDrivenFKClusterMode = settings.RegisterBoolSetting(
"sql.defaults.optimizer_foreign_keys.enabled",
"sql.defaults.experimental_optimizer_foreign_keys.enabled",
"enables optimizer-driven foreign key checks by default",
false,
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/cascade
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The tests in this file target the legacy FK paths.
statement ok
SET optimizer_foreign_keys = false
SET experimental_optimizer_foreign_keys = false

subtest AllCascadingActions
### A test of all cascading actions in their most basic form.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/cascade_opt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The tests in this file target the new optimizer-driven FK paths (with
# fall back on the legacy paths for unsupported cases).
statement ok
SET optimizer_foreign_keys = true
SET experimental_optimizer_foreign_keys = true

subtest AllCascadingActions
### A test of all cascading actions in their most basic form.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/fk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# The tests in this file target the legacy FK paths.
statement ok
SET optimizer_foreign_keys = false
SET experimental_optimizer_foreign_keys = false

# Disable automatic stats to avoid flakiness.
statement ok
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/fk-mixed-19.1-19.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# validated when added in 19.1, hence the need for different logic tests.

statement ok
SET optimizer_foreign_keys = false
SET experimental_optimizer_foreign_keys = false

# Disable automatic stats to avoid flakiness.
statement ok
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/fk_opt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The tests in this file target the new optimizer-driven FK paths (with
# fall back on the legacy paths for unsupported cases).
statement ok
SET optimizer_foreign_keys = true
SET experimental_optimizer_foreign_keys = true

# Insert
# ------
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/json_builtins
Original file line number Diff line number Diff line change
Expand Up @@ -1031,4 +1031,3 @@ query T
SELECT '["a", {"b":1}]'::jsonb #- '{1,b}'
----
["a", {}]

6 changes: 3 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,7 @@ default_transaction_read_only off NULL NULL N
distsql off NULL NULL NULL string
enable_zigzag_join on NULL NULL NULL string
experimental_force_split_at off NULL NULL NULL string
experimental_optimizer_foreign_keys off NULL NULL NULL string
experimental_serial_normalization rowid NULL NULL NULL string
extra_float_digits 0 NULL NULL NULL string
force_savepoint_restart off NULL NULL NULL string
Expand All @@ -1536,7 +1537,6 @@ locality region=test,dc=dc1 NULL NULL N
lock_timeout 0 NULL NULL NULL string
max_index_keys 32 NULL NULL NULL string
node_id 1 NULL NULL NULL string
optimizer_foreign_keys off NULL NULL NULL string
reorder_joins_limit 4 NULL NULL NULL string
results_buffer_size 16384 NULL NULL NULL string
row_security off NULL NULL NULL string
Expand Down Expand Up @@ -1580,6 +1580,7 @@ default_transaction_read_only off NULL user NULL
distsql off NULL user NULL off off
enable_zigzag_join on NULL user NULL on on
experimental_force_split_at off NULL user NULL off off
experimental_optimizer_foreign_keys off NULL user NULL off off
experimental_serial_normalization rowid NULL user NULL rowid rowid
extra_float_digits 0 NULL user NULL 0 2
force_savepoint_restart off NULL user NULL off off
Expand All @@ -1590,7 +1591,6 @@ locality region=test,dc=dc1 NULL user NULL
lock_timeout 0 NULL user NULL 0 0
max_index_keys 32 NULL user NULL 32 32
node_id 1 NULL user NULL 1 1
optimizer_foreign_keys off NULL user NULL off off
reorder_joins_limit 4 NULL user NULL 4 4
results_buffer_size 16384 NULL user NULL 16384 16384
row_security off NULL user NULL off off
Expand Down Expand Up @@ -1630,6 +1630,7 @@ default_transaction_read_only NULL NULL NULL NULL NULL
distsql NULL NULL NULL NULL NULL
enable_zigzag_join NULL NULL NULL NULL NULL
experimental_force_split_at NULL NULL NULL NULL NULL
experimental_optimizer_foreign_keys NULL NULL NULL NULL NULL
experimental_serial_normalization NULL NULL NULL NULL NULL
extra_float_digits NULL NULL NULL NULL NULL
force_savepoint_restart NULL NULL NULL NULL NULL
Expand All @@ -1641,7 +1642,6 @@ lock_timeout NULL NULL NULL NULL NULL
max_index_keys NULL NULL NULL NULL NULL
node_id NULL NULL NULL NULL NULL
optimizer NULL NULL NULL NULL NULL
optimizer_foreign_keys NULL NULL NULL NULL NULL
reorder_joins_limit NULL NULL NULL NULL NULL
results_buffer_size NULL NULL NULL NULL NULL
row_security NULL NULL NULL NULL NULL
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/show_source
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ default_transaction_read_only off
distsql off
enable_zigzag_join on
experimental_force_split_at off
experimental_optimizer_foreign_keys off
experimental_serial_normalization rowid
extra_float_digits 0
force_savepoint_restart off
Expand All @@ -49,7 +50,6 @@ locality region=test,dc=dc1
lock_timeout 0
max_index_keys 32
node_id 1
optimizer_foreign_keys off
reorder_joins_limit 4
results_buffer_size 16384
row_security off
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/bench/fk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func runFKBench(
// Don't let auto stats interfere with the test. Stock stats are
// sufficient to get the right plans (i.e. lookup join).
r.Exec(b, "SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false")
r.Exec(b, fmt.Sprintf("SET optimizer_foreign_keys = %v", cfg.optFKOn))
r.Exec(b, fmt.Sprintf("SET experimental_optimizer_foreign_keys = %v", cfg.optFKOn))
setup(b, r, cfg.setupFKs)
b.ResetTimer()
run(b, r)
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/opt/exec/execbuilder/testdata/explain_env
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3
https://cockroachdb.github.io/text/decode.html#eJxUj81O20AUhdfMUxyxwa5iAsqmSpTFYG7aaZ1xNJ5SIoQsx5nQKcFG4x_FrHgIP2GepEqTSmV57_3uOfrujKtsWYwRlvmzK7P81-0NzM7kq8Zu18ahNlWN9kgxFirimqD5TUTo4LGzBkLqz5CxhvwRRQN21p42xymMZaIVF1Lj_NXZl8x151goMedqie-0hNeAJ6H_Ed08p23qzCbdYRYrEl_kkW19KJqRIhlSgp2XHf6EvKV7dGmb2vUOXvsvb8bnIlr-V-s1A7Q-8yeM8UiTOnkcFC9fm9XW5pcdhPxGoUaiuRaJFmGCi4fHiwljCWk4U7q1cenv0hZVurUvtsYU11dXp7spstXWpG_26S17-kthinKzmTBG94uICwkvXugBSN75SCg6VH3CTMVzdPj5lRShwRSjCQuCIGBVnhXoGPZ9v-_f9_078rKoapfZoh5jeD3Gw3CEAMPRI_sTAAD___ayhqM=

statement ok
SET optimizer_foreign_keys = true
SET experimental_optimizer_foreign_keys = true

query T
EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3
----
https://cockroachdb.github.io/text/decode.html#eJxUj81u2kwUhteZq3iVTexPOCRi8wnEwnGGdlozRuNpGhRFI2PGdAp40PhHmFUugivkSioKldrlOe9zfp4X7SpjyyEim6-dzfIfz0_Qe50vGrNZaodaVzXaC0VIJGgoKWT4FFN08MhNA8bl_-CJBP8Wxz1y0147lypKeCpFyLjE7c6Zbea6W8wEm4Zijq90Dq9BmEb-v2ixVq1yulB7TBJB2Sd-YVsfgk6ooDyiKfZedp5j_Jm-olOtMss9vPbPvkk4ZfH8r7Ne00PrE39ESBhLKq4eZ8X7XbPYmPy-A-NfaCSRylCyVLIoxd3b-92IkJRKOG3dUjv105qyUhuzNTXGeHx4uOa6zBYbrQ5mdchWvymMYYviGttdbbbmoJ0qrNNmVaq17qozUo4Ioa-zOGQcXjKTPVD-4iOl8fmZ_zARyRQdvn-mgqLBGIMRCYIgIFWelegITsfj6fhxOn4gt2VVu8yU9RD9xyHe-gME6A_eya8AAAD__30skp8=
https://cockroachdb.github.io/text/decode.html#eJxUj8tu2kAUhteZp_iVTewqDonYVCAWjjO005oxGk_ToCgaGTOmU4yNxhfZrPIQPCFPUlGI1C7P-b9z-Z61rUxZjBCU6caWSfrr6RG60-myMflKW9S6qtGeKUICQX1JIf3HkKKHQ64aMC4_g0cS_EcY3pKr9tI5V0HEYyl8xiWud9ZsE9tfYy7YzBcLfKcLOA38OHD_R7ONapXVmeowjQRlX_iZbV0IOqWC8oDG6JzkNMf4E31Br1plVh2c9mPf1J-xcPHPWae5ResSd0yIH0oqLh4nxbtds8xNeteD8W80kIilL1ksWRDj5vXtZkxITCWsLu1KW_W7NEWlcrM1NSZ4uL-_5LpIlrlWe7PeJ-u_FCYos-wj7nbamq0u6iRX5a42W7PXVmWl1WZdqI3uqxNfjAmhL_PQZxxONJe3oPzZRUzD02efMBXRDD1-fqWCosEEwzHxPM8jVZoU6AmOh8Px8H48vCMti6q2iSnqEQYPI7wOhvAwGL6RPwEAAP__x3qYDA==

statement ok
RESET reorder_joins_limit
Expand All @@ -99,7 +99,7 @@ statement ok
RESET enable_zigzag_join

statement ok
RESET optimizer_foreign_keys
RESET experimental_optimizer_foreign_keys

#
# Test sequences.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/exec/execbuilder/testdata/fk_opt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LogicTest: local

statement ok
SET optimizer_foreign_keys = true
SET experimental_optimizer_foreign_keys = true

statement ok
CREATE TABLE parent (p INT PRIMARY KEY, other INT)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt_exec_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ FROM

for _, param := range []string{
"enable_zigzag_join",
"optimizer_foreign_keys",
"experimental_optimizer_foreign_keys",
} {
value, err := ef.environmentQuery(fmt.Sprintf("SHOW %s", param))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ var varGen = map[string]sessionVar{
},

// CockroachDB extension.
`optimizer_foreign_keys`: {
GetStringVal: makeBoolGetStringValFn(`optimizer_foreign_keys`),
`experimental_optimizer_foreign_keys`: {
GetStringVal: makeBoolGetStringValFn(`experimental_optimizer_foreign_keys`),
Set: func(_ context.Context, m *sessionDataMutator, s string) error {
b, err := parsePostgresBool(s)
if err != nil {
Expand Down

0 comments on commit e51c7b3

Please sign in to comment.