Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: fix dangling zone config on REGIONAL BY ROW -> REGIONAL BY TABLE #60659

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

otan
Copy link
Contributor

@otan otan commented Feb 17, 2021

We previously did not set NumReplicas to 0 for RBR -> RBT conversions.
This means the zone configuration do not cleanup and inherit properly
after the async job completes for dropping old indexes since it no
longer thinks the RBR zone config is a placeholder, leaving a
dangling reference. Patch this up correctly.

N.B.: In theory there's nothing wrong with this. But this patch makes
SHOW ZONE CONFIGURATION consistent when you convert RBR to RBT
compared to making a RBT table directly.

Release note: None

@otan otan requested review from ajstorm and a team February 17, 2021 05:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@otan otan force-pushed the fix_zone_config_master branch 2 times, most recently from badb85f to 05ce19c Compare February 17, 2021 23:47
Copy link
Collaborator

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

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

Nit: Not following what you mean by "...since it no longer things the RBR zone config is a placeholder". Can you clarify?

Also, last sentence may be clearer if you say "But this patch ensures that SHOW ZONE CONFIGURATION will return the same result for tables created RBT as those that have been altered from RBR to RBT."

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan)


pkg/sql/region_util.go, line 563 at r1 (raw file):

	// Mark the NumReplicas as 0 if we have subzones but no other features
	// in the zone config. This signifies a placeholder.
	if len(zoneConfig.Subzones) > 0 && isPlaceholderZoneConfigForMultiRegion(zoneConfig) {

Nit: in this check, can we not use "hasNewSubzones"? If there are existing subzones, will the NumReplicas not already be set to 0?

We previously did not set NumReplicas to 0 for RBR -> RBT conversions.
This means the zone configuration do not cleanup and inherit properly
after the async job completes for dropping old indexes since it no
longer thinks the RBR zone config is a placeholder, leaving a
dangling reference. Patch this up correctly.

N.B.: In theory there's nothing wrong with this. But this patch makes
SHOW ZONE CONFIGURATION consistent when you convert RBR to RBT
compared to making a RBT table directly.

Release note: None
@otan otan force-pushed the fix_zone_config_master branch from 05ce19c to 718034b Compare February 18, 2021 19:30
Copy link
Contributor Author

@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.

Oops typo. see the new commit msg!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajstorm)


pkg/sql/region_util.go, line 563 at r1 (raw file):

Previously, ajstorm (Adam Storm) wrote…

Nit: in this check, can we not use "hasNewSubzones"? If there are existing subzones, will the NumReplicas not already be set to 0?

nah -- added a comment. basically, we can have no new subzones but subzones still one the zoneconfig in a RBR - > RBT migration

@otan
Copy link
Contributor Author

otan commented Feb 18, 2021

bors r=ajstorm

@craig
Copy link
Contributor

craig bot commented Feb 18, 2021

Build succeeded:

@craig craig bot merged commit 40a35fe into cockroachdb:master Feb 18, 2021
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.

3 participants