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-20.1: sqlmigrations: fix handling of mutations in schema change job migration #48838

Merged
merged 1 commit into from
May 14, 2020

Conversation

thoszhang
Copy link
Contributor

Backport 1/1 commits from #48823.

/cc @cockroachdb/release


The migration for schema change jobs assumed that a table descriptor's
MutationJobs were always synced with Mutations, so we were indexing
into Mutations with the MutationJobs index. In practice, if this
assumption doesn't hold due to some previous buggy schema change, we
risk crashing with an out of bounds error or looking up the wrong
mutation. This PR adds a step to find the mutation with the expected ID
and mark the job as failed if the mutation doesn't exist.

Fixes #48786.

Release note (bug fix): Fix a problem introduced in v20.1.0 where the
migration for ongoing schema change jobs would cause the node to panic
with an index out of bounds error, upon encountering a malformed table
descriptor with no schema change mutation corresponding to the job to be
migrated.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

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:

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

The migration for schema change jobs assumed that a table descriptor's
`MutationJobs` were always synced with `Mutations`, so we were indexing
into `Mutations` with the `MutationJobs` index. In practice, if this
assumption doesn't hold due to some previous buggy schema change, we
risk crashing with an out of bounds error or looking up the wrong
mutation. This PR adds a step to find the mutation with the expected ID
and mark the job as failed if the mutation doesn't exist.

Release note (bug fix): Fix a problem introduced in v20.1.0 where the
migration for ongoing schema change jobs would cause the node to panic
with an index out of bounds error, upon encountering a malformed table
descriptor with no schema change mutation corresponding to the job to be
migrated.
@thoszhang
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented May 14, 2020

Build succeeded

@craig craig bot merged commit fb9cc3f into cockroachdb:release-20.1 May 14, 2020
@thoszhang thoszhang deleted the backport20.1-48823 branch May 14, 2020 17:42
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.

None yet

4 participants