Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
N/A
-
None
Description
Likely cause: commit d0b279f18527ba9188d4d9d95d20a4b415bcdb8d (MDEV-25292), which added the revert of a failed create in create_table_impl(). The revert hits the ER_UNKNOWN_SEQUENCES check in ha_discover_table(), from commit bb4dd70e7c6509ed9bf8c38d44dffb6d2fcca415 (MDEV-13005, 10.4.25). CS 13.1.0, from before MDEV-25292, loses the old t1 too, also with SELECT 1 AS a in place of NEXTVAL(s1).
--source include/have_innodb.inc
|
CREATE SEQUENCE s1; |
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1); |
--error ER_UNKNOWN_OPTION
|
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB FOO=1 SELECT NEXTVAL(s1) AS a; |
if (`SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE 'test/#sql-create%'`) |
{
|
--die The old table t1 is left under a #sql-create name |
}
|
SELECT * FROM t1; |
DROP TABLE t1; |
DROP SEQUENCE s1; |
Leads to:
|
MDEV-25292 CS 13.2.0 82964737c007bafad28cd45829874eb98593127a (Debug, Clang 22.1.8-20260622) Build 16/10/2026 |
mysqltest: At line 9: The old table t1 is left under a #sql-create name
|
The error log has:
|
MDEV-25292 CS 13.2.0 82964737c007bafad28cd45829874eb98593127a (Debug, Clang 22.1.8-20260622) Build 16/10/2026 |
2026-10-26 14:12:33 4 [ERROR] DDL_LOG: Got error 4091 when trying to execute action for entry 3 of type 'create table'
|
Optimized builds give the same result. A restart does not bring t1 back. With SELECT 1 AS a in place of NEXTVAL(s1), the statement gives the same error and t1 is kept. The old t1 is lost the same way with LASTVAL(s1), with a MyISAM t1, with a table comment that is too long, and with an unknown column option.
From the code it seems that the DDL log opens the new t1 to drop it, when it reverts the failed create. The new t1 has no .frm file, so ha_discover_table() runs. It gives ER_UNKNOWN_SEQUENCES because the first table of the statement is the sequence s1. The DDL log does not skip that error, so it stops before it renames the old t1 back.
Attachments
Issue Links
- is caused by
-
MDEV-25292 Atomic CREATE OR REPLACE TABLE
-
- Closed
-