Skip to content

sql: move validation of primary key existence to TableCollection#45765

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:validate-pk
Mar 6, 2020
Merged

sql: move validation of primary key existence to TableCollection#45765
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:validate-pk

Conversation

@thoszhang
Copy link
Copy Markdown

To support ADD/DROP PRIMARY KEY operations within a single
transaction, we had added a step in the connExecutor to verify that
all tables modified in the transaction have a primary key before we
commit the transaction. This was done by examining SchemaChangers
queued in the transaction in extraTxnState. To ease the process of
removing SchemaChangers from extraTxnState as part of moving them to
jobs, this PR moves the validation implementation to a method on
TableCollection that examines all modified tables.

Release note: None

@thoszhang thoszhang requested a review from rohany March 5, 2020 19:38
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rohany
Copy link
Copy Markdown
Contributor

rohany commented Mar 5, 2020

This LGTM (aside from the lint failure)

To support `ADD/DROP PRIMARY KEY` operations within a single
transaction, we had added a step in the `connExecutor` to verify that
all tables modified in the transaction have a primary key before we
commit the transaction. This was done by examining `SchemaChanger`s
queued in the transaction in `extraTxnState`. To ease the process of
removing `SchemaChanger`s from `extraTxnState` as part of moving them to
jobs, this PR moves the validation implementation to a method on
`TableCollection` that examines all modified tables.

Release note: None
@thoszhang
Copy link
Copy Markdown
Author

I also got a TestClusterVersionPersistedOnJoin failure on CI which I'm almost certain is a flake.

@thoszhang
Copy link
Copy Markdown
Author

TFTR

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 5, 2020

Build failed (retrying...)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 5, 2020

Build failed (retrying...)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 6, 2020

Build succeeded

@craig craig bot merged commit 2bd9e6a into cockroachdb:master Mar 6, 2020
@thoszhang thoszhang deleted the validate-pk branch March 6, 2020 05:53
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