Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2
Description
Likely cause: the fix for MDEV-36122, commit d1a67923244d835b4dad53842dc53a7cb3ff6053, in ha_innobase::truncate(). That fix made TRUNCATE stop purge while the table has more than one reference. CS 10.11.11, which does not have that fix, also gives ERROR 1205 here, but purge goes on.
--source include/have_partition.inc
|
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH (a) PARTITIONS 2; |
INSERT INTO t1 VALUES (1), (2); |
LOCK TABLES t1 WRITE, t1 AS a1 READ; |
--error 0,ER_LOCK_WAIT_TIMEOUT
|
ALTER TABLE t1 TRUNCATE PARTITION p0; |
UNLOCK TABLES;
|
CREATE TABLE t2 (a INT) ENGINE=InnoDB; |
INSERT INTO t2 SELECT seq FROM seq_1_to_100; |
DELETE FROM t2; |
--let $n= 0
|
--let $h= 1
|
while ($h)
|
{
|
if ($n == 100) |
{
|
--die InnoDB purge stays stopped after a failed TRUNCATE PARTITION under LOCK TABLES with an alias, and the history list length stays at $h |
}
|
--sleep 0.1 |
--let $h= query_get_value(SHOW GLOBAL STATUS LIKE 'Innodb_history_list_length', Value, 1) |
--inc $n |
}
|
DROP TABLE t1, t2; |
Leads to:
|
CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 06/10/2026 |
mysqltest: At line 24: InnoDB purge stays stopped after a failed TRUNCATE PARTITION under LOCK TABLES with an alias, and the history list length stays at 11
|
The ALTER TABLE ... TRUNCATE PARTITION gives ERROR 1205, and so does TRUNCATE TABLE t1. That error is MDEV-41734. After it, InnoDB purge stays stopped. The history list length does not go down, a later FLUSH TABLES t2 FOR EXPORT does not return, and a normal shutdown does not finish. The shutdown waits in srv_purge_shutdown(), and the purge coordinator loops in purge_sys_t::wait_FTS(). A view or a trigger that holds t1 in LOCK TABLES gives the same result. Without the alias, purge goes on. Debug builds give the same result.
From the code it seems that ha_innobase::truncate() calls purge_sys.stop_FTS() when the table has a second reference (pause_purge), but calls purge_sys.resume_FTS() only when the table has a FULLTEXT index. ha_innobase::rename_table() resumes in both cases.
Attachments
Issue Links
- is caused by
-
MDEV-36122 Assertion failure ctx0->old_table->get_ref_count() == 1 in ha_innobase::commit_inplace_alter_table()
-
- Closed
-
- relates to
-
MDEV-26012 InnoDB purge and shutdown hangs after failed ALTER TABLE
-
- Closed
-
-
MDEV-41734 TRUNCATE on a partitioned InnoDB table fails with ERROR 1205 when LOCK TABLES also holds the table through an alias, a view or a trigger
-
- Open
-