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

sql: drop database cascade can fail resolving schemas #69789

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Sep 2, 2021

Fixes: #69713

Previously, drop database cascade would drop the schema first,
and then drop any objects under those schemas after. This was
inadequate because as we look up any objects under the schemas,
we may need to resolve types, which will may lead to a look up
on the schema. If the schema is dropped then we will fail while
resolving any types. To address this, this patch drops the objects
under the schema first followed by the database.

Release justification: Low risk bug fix for drop database cascade
Release note (bug fix): Drop database cascade can fail while resolving
a schema in a certain scenarios with the following error:
"ERROR: error resolving referenced table ID : descriptor is
being dropped"

Fixes: cockroachdb#69713

Previously, drop database cascade would drop the schema first,
and then drop any objects under those schemas after. This was
inadequate because as we look up any objects under the schemas,
we may need to resolve types, which will may lead to a look up
on the schema. If the schema is dropped then we will fail while
resolving any types. To address this, this patch drops the objects
under the schema first followed by the database.

Release justification: Low risk bug fix for drop database cascade
Release note (bug fix): Drop database cascade can fail while resolving
a schema in a certain scenarios with the following error:
 "ERROR: error resolving referenced table ID <ID>: descriptor is
  being dropped"
@fqazi fqazi requested review from ajwerner and a team September 2, 2021 20:00
@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:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @fqazi)

@fqazi
Copy link
Collaborator Author

fqazi commented Sep 9, 2021

@ajwerner TFTR!

@fqazi
Copy link
Collaborator Author

fqazi commented Sep 9, 2021

bors r=ajwerner

@craig
Copy link
Contributor

craig bot commented Sep 9, 2021

Build failed:

@fqazi
Copy link
Collaborator Author

fqazi commented Sep 10, 2021

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 10, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 10, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 10, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 10, 2021

Build succeeded:

@craig craig bot merged commit 6e91bed into cockroachdb:master Sep 10, 2021
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.

sql: combination of user defined schemas, enum and foreign key causes database to not be droppable
3 participants