Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2
-
None
Description
Likely cause: MDEV-17554, commit 92bfc0e8c4bb5c86359c29458d67f3e7836ec18a, which added the AUTO creation of history partitions in 10.9.1. The fix for MDEV-25654 made a manual ADD PARTITION keep the hidden hash column, but not the automatic one. CS 10.11.2, which does not have that fix, gives the same error.
--source include/have_partition.inc
|
--source include/have_innodb.inc
|
SET timestamp= UNIX_TIMESTAMP('2026-01-01 00:00:00'); |
CREATE TABLE t1 (a INT, b VARCHAR(20), UNIQUE KEY (b) USING HASH) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY AUTO; |
INSERT INTO t1 VALUES (1, 'x'); |
SET timestamp= UNIX_TIMESTAMP('2026-01-03 00:00:00'); |
--error 0,ER_CRASHED_ON_USAGE
|
UPDATE t1 SET a = 2; |
if ($mysql_errno) |
{
|
--die An UPDATE that adds a history partition fails, and the table with a short UNIQUE USING HASH index reads as crashed |
}
|
FLUSH TABLES;
|
--error 0,ER_TABLE_CORRUPT
|
SELECT * FROM t1; |
if ($mysql_errno) |
{
|
--die After history partitions are added automatically, a table with a short UNIQUE USING HASH index cannot be read |
}
|
DROP TABLE t1; |
Leads to:
|
CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 06/10/2026 |
mysqltest: At line 11: An UPDATE that adds a history partition fails, and the table with a short UNIQUE USING HASH index reads as crashed
|
The error log:
|
CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 06/10/2026 |
2026-11-12 16:16:44 4 [Warning] InnoDB: Table test/t1#P#p0 contains 5 user defined columns in InnoDB, but 4 columns in MariaDB. Please check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-troubleshooting/innodb-data-dictionary-troubleshooting for how to resolve the issue.
|
2026-11-12 16:16:44 4 [ERROR] mariadbd: Table 't1' is marked as crashed and should be repaired
|
The UPDATE gives ERROR 1194 (HY000): Table 't1' is marked as crashed and should be repaired. After a FLUSH TABLES or a restart, SELECT, INSERT, UPDATE, DELETE, SHOW CREATE TABLE and ALTER TABLE on t1 give ERROR 1877 (t1#P#p0 is corrupted). Debug builds give the same errors. With MyISAM, the UPDATE gives ERROR 1030 (error 190). With PARTITION BY RANGE COLUMNS ... INTERVAL, the INSERT that adds the partitions gives ERROR 1194. A TEXT column is not affected.
On an optimized build, a background thread then writes the "is corrupted" and "Failed to open table" errors to the error log about 50,000 times a second, also while no statement runs. A debug build crashes in the InnoDB purge thread when it starts again.
From the code it seems that alter_add_partitions() (vers_create_partitions() in 10.11 to 13.0) keeps the result of prep_alter_part_table() in a local variable, so alter_ctx.fast_alter_partition stays false. mysql_prepare_alter_table() then sets the algorithm of the hash key to HA_KEY_ALG_UNDEF, and a key that is short enough becomes a plain UNIQUE index without the hash column.
Attachments
Issue Links
- is caused by
-
MDEV-17554 Auto-create history partitions for system-versioned tables
-
- Closed
-
- relates to
-
MDEV-25654 Unexpected ER_CRASHED_ON_USAGE and Assertion `limit >= trx_id' failed in purge_node_t::skip
-
- Closed
-
-
MDEV-41712 Aria or MyISAM table can no longer be opened after SYSTEM_TIME AUTO or INTERVAL partitioning adds partitions without its ROW_FORMAT
-
- Open
-
-
MDEV-18858 Assertion `table->s->db_options_in_use == part_table->s->db_options_in_use' failed in compare_table_with_partition
-
- Confirmed
-