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-2.1: sqlmigrations: fix deadlock when ensuring privileges on Lease table #43633

Merged

Conversation

@nvanbenschoten
Copy link
Member

nvanbenschoten commented Dec 30, 2019

Backport 1/1 commits from #43508.

This was a clean backport outside of the diff in 47f6af7#diff-87d7b6600bf9a8becfc52392f1cdd19d.

/cc @cockroachdb/release


Closes #43497.

This commit resolves a deadlock that could occur when running the "ensure admin
role privileges in all descriptors" SQL migration. If the system.lease table
needed to be migrated then the migration transaction would deadlock on an inner
transaction that would query the system.lease table to enforce the "two leased
versions" descriptor invariant. The solution to this is to use a timestamp from
before the migration transaction to query the system.lease table, which
ensures that the two transactions don't conflict.

This fix is needed in the release-19.1 branch and the release-2.1 branch. I'll
send a PR to patch the latter once this review is signed off on.

Release note (bug fix): Migrating the privileges on the system.lease
table no longer creates a deadlock during a cluster upgrade.

@nvanbenschoten nvanbenschoten requested a review from petermattis Dec 30, 2019
@cockroach-teamcity

This comment has been minimized.

Copy link
Member

cockroach-teamcity commented Dec 30, 2019

This change is Reviewable

Closes #43497.

This commit resolves a deadlock that could occur when running the "ensure admin
role privileges in all descriptors" SQL migration. If the `system.lease` table
needed to be migrated then the migration transaction would deadlock on an inner
transaction that would query the system.lease table to enforce the "two leased
versions" descriptor invariant. The solution to this is to use a timestamp from
before the migration transaction to query the `system.lease` table, which
ensures that the two transactions don't conflict.

This fix is needed in the release-19.1 branch and the release-2.1 branch. I'll
send a PR to patch the latter once this review is signed off on.

Release note (bug fix): Migrating the privileges on the system.lease
table no longer creates a deadlock during a cluster upgrade.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten:backport2.1-43508 branch from a5edc92 to 112f67a Dec 30, 2019
@nvanbenschoten nvanbenschoten requested a review from ajwerner Dec 30, 2019
Copy link
Collaborator

ajwerner left a comment

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

@nvanbenschoten nvanbenschoten merged commit c96086a into cockroachdb:release-2.1 Dec 30, 2019
2 checks passed
2 checks passed
GitHub CI (Cockroach) TeamCity build finished
Details
license/cla Contributor License Agreement is signed.
Details
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten:backport2.1-43508 branch Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.