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

sql: fix deadlock in VALIDATE CONSTRAINT #32772

Merged
merged 1 commit into from Dec 4, 2018

Conversation

Projects
None yet
3 participants
@vivekmenezes
Copy link
Contributor

vivekmenezes commented Dec 3, 2018

This is present because of the call to the InternalExecutor
which has a limitation that while it can reuse a user transaction
it cannot reuse a TableCollection associated with a transaction.
Therefore if a user runs a schema change before a VALIDATE
in the same transaction the transaction can get deadlocked on:
the transaction having an outstanding intent on the table, and
the InternalExecutor triggering a table lease acquisition on the
table.

Stop using the InternalExecutor in VALIDATE CONSTRAINT.

Added the missing call to rows.Close() in validateCheckExpr()

related to #32118

Release note (sql change): Fix deadlock when using
ALTER TABLE VALIDATE CONSTRAINT in a transaction with a schema change.

sql: fix deadlock in VALIDATE CONSTRAINT
This is present because of the call to the InternalExecutor
which has a limitation that while it can reuse a user transaction
it cannot reuse a TableCollection associated with a transaction.
Therefore if a user runs a schema change before a VALIDATE
in the same transaction the transaction can get deadlocked on:
the transaction having an outstanding intent on the table, and
the InternalExecutor triggering a table lease acquisition on the
table.

Stop using the InternalExecutor in VALIDATE CONSTRAINT.

Added the missing call to rows.Close() in validateCheckExpr()

related to #32118

Release note (sql change): Fix deadlock when using
ALTER TABLE VALIDATE CONSTRAINT in a transaction with a schema change.

@vivekmenezes vivekmenezes requested a review from dt Dec 3, 2018

@vivekmenezes vivekmenezes requested review from cockroachdb/sql-execution-prs as code owners Dec 3, 2018

@cockroach-teamcity

This comment has been minimized.

Copy link
Member

cockroach-teamcity commented Dec 3, 2018

This change is Reviewable

@dt

dt approved these changes Dec 4, 2018

@vivekmenezes

This comment has been minimized.

Copy link
Contributor

vivekmenezes commented Dec 4, 2018

bors r+

craig bot pushed a commit that referenced this pull request Dec 4, 2018

Merge #32772
32772: sql: fix deadlock in VALIDATE CONSTRAINT r=vivekmenezes a=vivekmenezes

This is present because of the call to the InternalExecutor
which has a limitation that while it can reuse a user transaction
it cannot reuse a TableCollection associated with a transaction.
Therefore if a user runs a schema change before a VALIDATE
in the same transaction the transaction can get deadlocked on:
the transaction having an outstanding intent on the table, and
the InternalExecutor triggering a table lease acquisition on the
table.

Stop using the InternalExecutor in VALIDATE CONSTRAINT.

Added the missing call to rows.Close() in validateCheckExpr()

related to #32118

Release note (sql change): Fix deadlock when using
ALTER TABLE VALIDATE CONSTRAINT in a transaction with a schema change.

Co-authored-by: Vivek Menezes <vivek@cockroachlabs.com>
@craig

This comment has been minimized.

Copy link

craig bot commented Dec 4, 2018

Build succeeded

@craig craig bot merged commit 5205616 into cockroachdb:master Dec 4, 2018

3 checks passed

GitHub CI (Cockroach) TeamCity build finished
Details
bors Build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment