Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
N/A
-
Can result in hang or crash
Description
--source include/have_debug.inc
|
--source include/have_innodb.inc
|
|
|
CREATE TABLE t0 (b INT) ENGINE=InnoDB; |
INSERT INTO t0 VALUES (2); |
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1); |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
SET @@debug_dbug="+d,ddl_log_create_after_revert", @debug_crash_counter=1; |
--error 2013
|
CREATE OR REPLACE TABLE t1 ENGINE=InnoDB SELECT b FROM t0; |
--enable_reconnect
|
--source include/wait_until_connected_again.inc
|
|
|
--let $t1= query_get_value(SELECT COUNT(*) AS c FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1', c, 1)
|
if (!$t1) |
{
|
--die t1 is missing after the restart: the old and the new table are both gone |
}
|
--echo t1 exists after the restart
|
DROP TABLE t1, t0; |
Leads to:
|
MDEV-25292 CS 13.2.0 82964737c007bafad28cd45829874eb98593127a (Debug, Clang 22.1.8-20260622) Build 16/10/2026 |
mysqltest: At line 18: t1 is missing after the restart: the old and the new table are both gone
|
From the code it seems that end_create_table() drops the backup of the old table while the create chain is still active, so recovery reverts the create after the backup is gone. The plain and LIKE forms disable the create chain earlier when the binary log is off, so they keep the new table. atomic.create_replace_no_binlog records the loss: its result shows no t2 after ddl_log_create_after_revert for the SELECT form.
With binlog_storage_engine=innodb, the plain form loses both tables too:
--source include/have_debug.inc
|
--source include/have_innodb.inc
|
--source include/have_innodb_binlog.inc
|
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1); |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
SET @@debug_dbug="+d,ddl_log_create_after_revert", @debug_crash_counter=1; |
--error 2013
|
CREATE OR REPLACE TABLE t1 (b INT) ENGINE=InnoDB; |
--enable_reconnect
|
--source include/wait_until_connected_again.inc
|
|
|
--let $t1= query_get_value(SELECT COUNT(*) AS c FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1', c, 1)
|
if (!$t1) |
{
|
--die t1 is missing after the restart: the old and the new table are both gone |
}
|
--echo t1 exists after the restart
|
DROP TABLE t1; |
Leads to:
|
MDEV-25292 CS 13.2.0 82964737c007bafad28cd45829874eb98593127a (Debug, Clang 22.1.8-20260622) Build 16/10/2026 |
mysqltest: At line 17: t1 is missing after the restart: the old and the new table are both gone
|
Attachments
Issue Links
- is caused by
-
MDEV-25292 Atomic CREATE OR REPLACE TABLE
-
- Closed
-