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

release-21.1: block concurrent ADD/DROP REGION and REGIONAL BY ROW changes #64255

Conversation

otan
Copy link
Contributor

@otan otan commented Apr 27, 2021

Backport:

Please see individual PRs for details.

/cc @cockroachdb/release

arulajmani and others added 9 commits April 27, 2021 12:46
There was an error in the `RunBeforeMultiRegionUpdates` knob such that
if it were set, we would short circuit. The intention, instead, was to
only short circuit in the error case.

Release note: None
This is a fix to a problem facing validation - namely - the type schema
changer modifies the enum and the table separately. If we change the
enum first, the table no longer validates partitions correctly. We can't
change the table partition first as the enum members are no longer
public.

To alleviate this, we pre-fetch the tables before the enum gets changed
and re-hydrate the enum descriptor after the enum gets changed to add
the new partitioning.

Release note: None
This commit adds validation that partitions for a REGIONAL BY ROW table
matches regions in the  type descriptor.

Release note: None
Multi-region tests check to ensure partitioning is sane from a few
different tests. This pulls out that logic into its own function.

Release note: None
This patch adds TestAlterRegionalByRowEnclosingRegionAddDrop, with the
following sketch:

- Client 1 performs an
`ALTER TABLE ... SET LOCALITY REGIONAL BY ROW TABLE`
- Let the user txn commit.
- Block in the (table) schema changer.
- Client 2 performs an ALTER ADD / DROP REGION. Let the operation
complete
(succeed or fail, depending on the particular setup).
- Resume the ALTER operation in the schema changer.
Currently, this ALTER operation is bound to fail because of
Once the issue is addressed, this test should be updated to assert the
correct partitioning values (in all cases).

Release note: None
Release note (bug fix): Previously, if a DROP INDEX failed during a
REGIONAL BY ROW transition, the index may be re-inserted back into the
REGIONAL BY ROW table but would be invalid if it was sharded or
partitioned. This is now rectified.
This is helpful for error messages which allows the schema name to be
output in the error message.

Release note: None
Release note (sql change): Disallow ADD/DROP REGION whilst a
REGIONAL BY ROW table has index changes underway or a table is
transitioning to or from REGIONAL BY ROW.
Release note (sql change): Prevent index modification on REGIONAL BY ROW
tables and locality to/from REGIONAL BY ROW changes during a ADD/DROP
REGION.
@otan otan requested review from ajstorm and arulajmani April 27, 2021 03:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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.

:lgtm:

@arulajmani can you quickly confirm that this is the necessary and sufficient list of commits to backport for this issue?

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

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

I think technically you might not need the second commit from #64017, as that test gets removed in a subsequent commit, but probably not worth the cherry-pick/conflict hassle. :shipit:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

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.

4 participants