MDEV-27027 Atomic DDL: Assertion failed upon unsuccessful multi-RENAM… #4499
+165
−0
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.
…E TABLE
Description
When executing an atomic sequence of RENAME operations, such as:
RENAME TABLE t1 TO t2, t3 TO t4, ...
any failure in the sequence triggers a rollback of previously completed renames to preserve atomicity.
However, when an error occurs,
my_error()is invoked immediately, which sets thethd->is_error()flag. This premature flag setting causes the rollback logic to misinterpret the thread state, leading to incorrect reversion behavior and assertion failures.To address this, the errors are now not emitted immediately but captured and postponed. A new class
Postponed_error_handleris introduced for this purpose. Only after all operations are completed (including possible DDL reversion), the captured errors and warnings are emitted.Release Notes
Unsuccessful multi-table RENAME operations might lead to undefined behavior or a crash instead of proper DDL reversion and printing the error message.
How can this PR be tested?
/mtr main.renameIf the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
Basing the PR against the correct MariaDB version
mainbranch.PR quality check