-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61159: sql: fix reverting schema changes for databases and schemas r=lucy-zhang a=lucy-zhang Previously, we were failing to handle the case where a schema change job to drop or rename a database or schema entered the reverting state. In `OnFailOrCancel`, we were always trying to look up the descriptor associated with the job assuming it was a table. This led to a panic in 20.2. On master we get return an internal error `relation [id] not found`. We also had the preexisting behavior that when dropping a database, we would return nil from `OnFailOrCancel` without indicating anything was wrong. This is undesirable, since it's abnormal for these jobs to enter the reverting state, and we can't actually either revert the schema change or clean up. This PR adds checks at the top of `OnFailOrCancel` so that we now exit early with an error if the descriptor is not a table, and makes the behavior for all database and schema jobs consistent. Fixes #59415. Release justification: Fixes for high-priority or high-severity bugs in existing functionality Release note (bug fix): Fixed a bug where schema changes on databases and schemas could return a `relation [<id>] does not exist` if they failed or were canceled and entered the reverting state. These jobs are not actually possible to revert. With this change, the correct error causing the job to fail will be returned, and the job will enter the failed state with an error indicating that the job could not be reverted. Co-authored-by: Lucy Zhang <[email protected]>
- Loading branch information
Showing
2 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters