Skip to content

Conversation

@Olernov
Copy link
Contributor

@Olernov Olernov commented Dec 25, 2025

…E TABLE

  • The Jira issue number for this PR is: MDEV-27027

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 the thd->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_handler is 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.rename

If 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

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

…E TABLE

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 the `thd->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_handler` is introduced for
this purpose. Only after all operations are completed (including
possible DDL reversion), the captured errors are emitted.
@Olernov Olernov force-pushed the 10.11-MDEV-27027-atom-ddl branch from fd09394 to be9052f Compare December 25, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants