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

schemachanger: improve state management #96117

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

postamar
Copy link
Contributor

This commit endows the scpb.CurrentState with the set of element statuses which are in force at the beginning of the statement transaction. These are then used when planning the pre-commit reset stage.

This commit also rewrites the target-setting logic in the scbuild package in a more explicit manner with extra commentary.

This commit does not change any functional behavior in production.

Informs #88294.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@postamar
Copy link
Contributor Author

postamar commented Jan 27, 2023

Still in draft mode because I want to make sure that all tests pass first.

This commit came about because working on #95631 made me uneasy about whether it's legal for the builder to overwrite or elide existing targets. Also I wasn't quite convinced that the After state of the reset stage introduced by that PR was completely correct either. These concerns only applied to multi-statement transactions, which aren't supported in prod, but still I wanted to deal with this while the context was still fresh in my head.

@postamar postamar force-pushed the add-initial-to-current-state branch from a594919 to 38fdba3 Compare January 27, 2023 21:16
@postamar postamar marked this pull request as ready for review January 27, 2023 22:12
@postamar postamar requested a review from a team January 27, 2023 22:12
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/sql/schemachanger/scbuild/build.go Show resolved Hide resolved
pkg/sql/schemachanger/scbuild/build.go Outdated Show resolved Hide resolved
@postamar postamar force-pushed the add-initial-to-current-state branch from 38fdba3 to 2ab2ab8 Compare January 30, 2023 19:28
@postamar
Copy link
Contributor Author

Thanks for the review!

bors r+

This commit endows the scpb.CurrentState with the set of element
statuses which are in force at the beginning of the statement
transaction. These are then used when planning the pre-commit
reset stage.

This commit also rewrites the target-setting logic in the scbuild
package in a more explicit manner with extra commentary.

This commit does not change any functional behavior in production.

Informs cockroachdb#88294.

Release note: None
@postamar postamar force-pushed the add-initial-to-current-state branch from 2ab2ab8 to 1266859 Compare January 31, 2023 14:26
@postamar
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 31, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 31, 2023

Build succeeded:

@craig craig bot merged commit e402d82 into cockroachdb:master Jan 31, 2023
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