release-20.1: sql: fix handling of errors in reversing schema change mutations #47575
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #47553.
/cc @cockroachdb/release
As part of fixing error handling for rolling back schema changes in
general, a bug was introduced: When an error was returned from reversing
the direction of mutations, instead of returning that error, we would
instead return the original resumer error. This would prevent some
retriable errors from producing retries, and could lead to failed jobs
that weren't cleaned up even though they could have been; fixing these
problems was the point of the original PR. This patch replaces the wrong
error with the right error.
A new schema change testing knob has been added to inject errors for
testing.
See #47446 for the original error handling fix.
Closes #47532.
Release note (bug fix): Fixed a bug causing some schema change rollbacks
to fail permanently even on transient errors.