Skip to content

sql: add test TestAlterRegionalByRowEnclosingRegionAddDrop#64017

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
arulajmani:alter-sandwich
Apr 22, 2021
Merged

sql: add test TestAlterRegionalByRowEnclosingRegionAddDrop#64017
craig[bot] merged 2 commits intocockroachdb:masterfrom
arulajmani:alter-sandwich

Conversation

@arulajmani
Copy link
Copy Markdown
Collaborator

See individual commits for details.

There's more test scenarios I want to add where we sandwich an ADD/DROP region inside of an ALTER to REGIONAL BY ROW/or an operation on one of these tables, but here's a start. The error messages aren't wrapped yet, so they may appear a bit ugly in the jobs table. What this test ensures, which I think is quite valuable, is that the rollback is fine and no manual cleanup is required.

@arulajmani arulajmani requested review from a team, ajstorm and otan April 21, 2021 20:06
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

},
{
name: "alter-from-explicit-regional",
setup: `CREATE TABLE db.t () LOCALITY REGIONAL IN "us-east2"`,
Copy link
Copy Markdown
Contributor

@otan otan Apr 21, 2021

Choose a reason for hiding this comment

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

i'm convinced REGIONAL BY ROW -> GLOBAL / REGIONAL BY TABLE is broken when a sandwiched ADD/DROP REGION comes in in that it creates extraneous partitions / zone configs on the GLOBAL table because we repartition on all Non-Drop indexes, but looks like we're not there yet....

@blathers-crl blathers-crl bot requested a review from otan April 21, 2021 22:29
Copy link
Copy Markdown
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: with just one nit

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


pkg/ccl/multiregionccl/multiregionccltestutils/testutils.go, line 69 at r3 (raw file):

// expected partitions.
func TestingEnsureCorrectPartitioning(
	sqlDB *gosql.DB, expectedPartitions []string, expectedIndexes []string, tableFQN string,

Nit: for expected partitions here, does it make sense to derive that from a SHOW REGIONS FROM DATABASE command? That would make this both easier to call, less error prone (hopefully), and a truer validation.

Copy link
Copy Markdown
Collaborator Author

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

TFTR! bors r=ajstorm

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajstorm, @arulajmani, and @otan)


pkg/ccl/multiregionccl/multiregionccltestutils/testutils.go, line 69 at r3 (raw file):

Previously, ajstorm (Adam Storm) wrote…

Nit: for expected partitions here, does it make sense to derive that from a SHOW REGIONS FROM DATABASE command? That would make this both easier to call, less error prone (hopefully), and a truer validation.

Done.

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
@arulajmani
Copy link
Copy Markdown
Collaborator Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 22, 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.

4 participants