Skip to content

sql: Change to using a session variable instead of FORCE syntax for overriding zone configuration settings for MR databases and tables#62008

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
ajstorm:ajstorm_zone_config_force_table
Mar 16, 2021
Merged

sql: Change to using a session variable instead of FORCE syntax for overriding zone configuration settings for MR databases and tables#62008
craig[bot] merged 3 commits intocockroachdb:masterfrom
ajstorm:ajstorm_zone_config_force_table

Conversation

@ajstorm
Copy link
Copy Markdown
Collaborator

@ajstorm ajstorm commented Mar 15, 2021

sql: Block zone config updates to multi-region tables

Block users from updating the zone configurations of multi-region
tables, without first having them set the session variable
override_multi_region_zone_config to true. We block updates to
multi-region table/partition/index zone configurations because we don't
want users to accidentally override the prescribed settings, leaving
them open to sub-optimal performance. Note that only the multi-region
fields of the zone configuration are blocked behind this variable. All
other fields (gc.ttlseconds, range_min/max_bytes, etc) can be updated
without overriding.

Release note (sql change): Block users from updating the zone
configurations of multi-region tables.

sql: Use session variable instead of FORCE to override zone configs

With #61499 we introduced new syntax (FORCE) to override setting the
zone configurations on multi-region databases. Upon further reflection,
it was decided that a session variable would be better suited to the
task. This commit pulls out the FORCE syntax and replaces it with the
use of override_multi_region_zone_config;

Release note (sql change): Revert the release notes on #61499. We now
use a session variable (override_multi_region_zone_config) to override
the zone configuration on multi-region databases (and tables).

Resolves: #57668.

Note to reviewers: Please ignore the first commit, as it's being separately reviewed as part of #61889. That commit was pulle out into a separate PR as it's a release blocker, and there was a need to get it in urgently.

@ajstorm ajstorm requested review from arulajmani and otan March 15, 2021 14:44
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@ajstorm ajstorm force-pushed the ajstorm_zone_config_force_table branch from 6252e76 to f000c85 Compare March 15, 2021 19:16
@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 15, 2021

Hold off on reviews. Still resolving test case failures.

@otan
Copy link
Copy Markdown
Contributor

otan commented Mar 15, 2021

from

[19:31:50][Test archive] ERROR: set-zone: runtime error: invalid memory address or nil pointer dereference
[19:31:50][Test archive] SQLSTATE: XX000
[19:31:50][Test archive] HINT: You have encountered an unexpected error.

looks like it's failing doing something here:

if _, err := ie.Exec(ctx, "set-zone", nil,

@ajstorm ajstorm force-pushed the ajstorm_zone_config_force_table branch from f000c85 to 9619033 Compare March 15, 2021 20:54
@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 15, 2021

Thx. Debugger FTW. There was a null pointer exception.

@otan
Copy link
Copy Markdown
Contributor

otan commented Mar 15, 2021

null pointer exception

this ain't java :P

@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 16, 2021 via email

@ajstorm ajstorm force-pushed the ajstorm_zone_config_force_table branch 2 times, most recently from a46737c to 1c38b12 Compare March 16, 2021 02:15
@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 16, 2021

RFAL now. Only one testcase failure remaining, which I'm hoping to resolve in the morning.

Copy link
Copy Markdown
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1, 14 of 14 files at r2, 1 of 1 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajstorm and @arulajmani)


pkg/ccl/multiregionccl/regional_by_row_test.go, line 550 at r2 (raw file):

	testutils.SucceedsSoon(t, func() error {
		_, err = sqlDB.Exec(`BEGIN;
  SET override_multi_region_zone_config = true;

nit: indentation

@ajstorm ajstorm force-pushed the ajstorm_zone_config_force_table branch 2 times, most recently from a981b0d to 64c5874 Compare March 16, 2021 15:21
ajstorm added 3 commits March 16, 2021 11:49
Block users from updating the zone configurations of multi-region
tables, without first having them set the session variable
`override_multi_region_zone_config` to true. We block updates to
multi-region table/partition/index zone configurations because we don't
want users to accidentally override the prescribed settings, leaving
them open to sub-optimal performance. Note that only the multi-region
fields of the zone configuration are blocked behind this variable. All
other fields (gc.ttlseconds, range_min/max_bytes, etc) can be updated
without overriding.

Release note (sql change): Block users from updating the zone
configurations of multi-region tables.
With cockroachdb#61499 we introduced new syntax (FORCE) to override setting the
zone configurations on multi-region databases. Upon further reflection,
it was decided that a session variable would be better suited to the
task. This commit pulls out the FORCE syntax and replaces it with the
use of override_multi_region_zone_config;

Release note (sql change): Revert the release notes on cockroachdb#61499.  We now
use a session variable (override_multi_region_zone_config) to override
the zone configuration on multi-region databases (and tables).
Enable the TestIndexCleanupAfterAlterFromRegionalByRow under race.

Release note: None
@ajstorm ajstorm force-pushed the ajstorm_zone_config_force_table branch from 64c5874 to 3c2d556 Compare March 16, 2021 15:50
@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 16, 2021

TFTR!

bors r=otan

@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 16, 2021

bors r-

Just noticed the bazel failure...

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 16, 2021

Canceled.

@ajstorm
Copy link
Copy Markdown
Collaborator Author

ajstorm commented Mar 16, 2021

TFTR!

bors r=otan

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 16, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: Only allow updates to zone configurations for multi-region tables under sql_safe_updates

3 participants