Repository navigation
MDEV-38839 Assertion (thd->state_flags & Open_tables_state::BACKUPS_A… - #5027
Merged
Merged
Conversation
mariadb-PranavTiwari
marked this pull request as draft
May 1, 2026 03:29
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
4 times, most recently
from
May 3, 2026 01:13
58ff35c to
afea455
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes binlog table-access classification for CREATE TABLE ... SELECT when the source is a temporary table, aiming to avoid incorrectly treating read-only temp-table access as a write and thereby prevent MIXED-mode binlog cache state from getting stuck and triggering the reported assertion.
Changes:
- Add a dedicated
stmt_writes_to_non_trans_temp_table()helper and use it when marking non-transactional temp-table modifications in binlog write paths. - Adjust
THD::decide_logging_format()soCREATE TABLE ... SELECTcan classify temporary source-table access as reads instead of writes. - Add an MTR regression test covering several temp-table engine combinations around
CREATE TABLE ... SELECT ... FOR UPDATE.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
sql/sql_lex.h |
Adds a helper to distinguish non-transactional temp-table writes from general access. |
sql/sql_class.cc |
Changes table-access flag assignment during logging-format analysis for CREATE TABLE. |
sql/log.cc |
Narrows the condition that marks a non-transactional temp table as modified in transactional cache paths. |
mysql-test/main/binlog_mdev38839.test |
Adds a regression test for the reported assertion scenario. |
mysql-test/main/binlog_mdev38839.result |
Records the expected output for the new regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
May 4, 2026 03:18
afea455 to
9bd571d
Compare
mariadb-PranavTiwari
marked this pull request as ready for review
May 4, 2026 08:58
midenok
reviewed
May 4, 2026
midenok
reviewed
May 4, 2026
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
May 5, 2026 13:03
f380b5e to
10c48d3
Compare
midenok
reviewed
May 5, 2026
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
3 times, most recently
from
May 7, 2026 05:57
2393bb5 to
f3b5b86
Compare
midenok
reviewed
May 7, 2026
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
2 times, most recently
from
May 7, 2026 10:35
76b8145 to
fa8cf40
Compare
mariadb-PranavTiwari
marked this pull request as draft
May 8, 2026 11:29
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
May 10, 2026 10:44
46271ef to
135f4ae
Compare
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
May 18, 2026 10:57
135f4ae to
aa71e6c
Compare
midenok
requested changes
Jul 6, 2026
midenok
reviewed
Jul 6, 2026
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
July 9, 2026 06:15
dfde0ab to
973b68a
Compare
Contributor
Author
Incorporated code review comments. |
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
July 15, 2026 12:20
973b68a to
8dc22e0
Compare
…_AVAIL) || !thd->has_pending_row_events()` failed in close_thread_tables on CREATE TABLE Problem: CREATE TABLE ... SELECT ... FOR UPDATE involving a MyISAM temporary table can trigger an assertion in close_thread_tables() when binary logging is enabled in MIXED mode. Cause: MyISAM temporary tables do not support row-level locking, so SELECT ... FOR UPDATE acquires a write lock even when the access is read-only. This causes the table to be incorrectly classified as a write operation, preventing binlog_truncate_trx_cache() from running and eventually triggering the assertion. Fix: Update decide_logging_format() to use tbl->updating to distinguish actual table modifications from read-only accesses. For read-only access to temporary non-transactional tables, mark the statement as STMT_READS_TEMP_NON_TRANS_TABLE instead of treating it as a write operation. This prevents incorrect write classification and avoids the assertion failure.
mariadb-PranavTiwari
force-pushed
the
12.3-MDEV-38839
branch
from
October 10, 2026 12:35
8dc22e0 to
5e1d303
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fixes MDEV-38839
Problem:
CREATE TABLE ... SELECT ... FOR UPDATE involving a MyISAM temporary table can trigger an assertion in close_thread_tables() when binary logging is enabled in MIXED mode.
Cause:
MyISAM temporary tables do not support row-level locking, so FOR UPDATE acquires a write lock even for read-only access. This causes the table to be incorrectly classified as a write operation, preventing binlog_truncate_trx_cache() from running and ultimately triggering an assertion.
Fix:
Update decide_logging_format() to check tbl->updating and distinguish actual writes from read-only access. For read-only access to temporary non-transactional tables, mark the statement as STMT_READS_TEMP_NON_TRANS_TABLE instead of treating it as a write. This prevents incorrect write classification and avoids the assertion failure.