[MDEV-17816] InnoDB: Failing assertion: trx->dict_operation_lock_mode == RW_X_LATCH upon TRUNCATE TABLE after converting to REDUNDANT Created: 2018-11-23  Updated: 2020-01-16  Resolved: 2018-11-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.4.1, 10.2.20, 10.3.12

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-21496 Downgrade from current 10.2 to 10.2.1... Closed
Problem/Incident
causes MDEV-17859 Operating system errors in file opera... Closed
is caused by MDEV-13564 TRUNCATE TABLE and undo tablespace tr... Closed
Relates
relates to MDEV-17833 ALTER TABLE is not enforcing prefix i... Closed
relates to MDEV-17885 TRUNCATE on temporary table causes ER... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (c VARCHAR(1024), KEY(c)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
TRUNCATE TABLE t1;
 
# Cleanup
DROP TABLE t1;

10.3 06e5f28f9

2018-11-23 15:22:36 13 [ERROR] InnoDB: Cannot rename table 'test/#sql-ib269-2948221008' to 'test/t8' since the dictionary cache already contains 'test/t8'.
2018-11-23 15:22:36 0x7f1b1dbb5700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/row/row0mysql.cc line 2341
InnoDB: Failing assertion: trx->dict_operation_lock_mode == RW_X_LATCH
 
#6  0x000055db7a8f213d in ut_dbg_assertion_failed (expr=0x55db7ae96aa8 "trx->dict_operation_lock_mode == RW_X_LATCH", file=0x55db7ae95980 "/data/src/10.3/storage/innobase/row/row0mysql.cc", line=2341) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:60
#7  0x000055db7a8244a7 in row_mysql_unlock_data_dictionary (trx=0x7f1b30093450) at /data/src/10.3/storage/innobase/row/row0mysql.cc:2341
#8  0x000055db7a6e7639 in ha_innobase::create (this=0x7f1ac0179128, name=0x7f1ac008b168 "test/t8", form=0x7f1ac009aa30, create_info=0x7f1b1dbb31c0, file_per_table=true, trx=0x7f1b30093450) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:12587
#9  0x000055db7a6d49a4 in ha_innobase::truncate (this=0x7f1ac0179128) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13200
#10 0x000055db7a3b0247 in handler::ha_truncate (this=0x7f1ac0179128) at /data/src/10.3/sql/handler.cc:4306
#11 0x000055db7a57a29a in Sql_cmd_truncate_table::handler_truncate (this=0x7f1ac002a670, thd=0x7f1ac0000b00, table_ref=0x7f1ac002a020, is_tmp_table=false) at /data/src/10.3/sql/sql_truncate.cc:242
#12 0x000055db7a57a9a1 in Sql_cmd_truncate_table::truncate_table (this=0x7f1ac002a670, thd=0x7f1ac0000b00, table_ref=0x7f1ac002a020) at /data/src/10.3/sql/sql_truncate.cc:448
#13 0x000055db7a57ab26 in Sql_cmd_truncate_table::execute (this=0x7f1ac002a670, thd=0x7f1ac0000b00) at /data/src/10.3/sql/sql_truncate.cc:504
#14 0x000055db7a0b7043 in mysql_execute_command (thd=0x7f1ac0000b00) at /data/src/10.3/sql/sql_parse.cc:6283
#15 0x000055db7a0bc113 in mysql_parse (thd=0x7f1ac0000b00, rawbuf=0x7f1ac0029f18 "TRUNCATE TABLE t8 /* QNO 8334 CON_ID 18 */", length=42, parser_state=0x7f1b1dbb4640, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8090
#16 0x000055db7a0a92d9 in dispatch_command (command=COM_QUERY, thd=0x7f1ac0000b00, packet=0x7f1ac000b1e1 "TRUNCATE TABLE t8 /* QNO 8334 CON_ID 18 */", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
#17 0x000055db7a0a7cfd in do_command (thd=0x7f1ac0000b00) at /data/src/10.3/sql/sql_parse.cc:1395
#18 0x000055db7a20f9d2 in do_handle_one_connection (connect=0x55db7d139b70) at /data/src/10.3/sql/sql_connect.cc:1402
#19 0x000055db7a20f756 in handle_one_connection (arg=0x55db7d139b70) at /data/src/10.3/sql/sql_connect.cc:1308
#20 0x00007f1b34e3f494 in start_thread (arg=0x7f1b1dbb5700) at pthread_create.c:333
#21 0x00007f1b3344093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible on 10.1.



 Comments   
Comment by Marko Mäkelä [ 2018-11-26 ]

This occurs due to misplaced error handling in MDEV-13564:

diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e6c57b015a0..96ed8de1adf 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -12839,8 +12839,8 @@ ha_innobase::create(
 		row_mysql_unlock_data_dictionary(trx);
 		if (own_trx) {
 			trx_free_for_mysql(trx);
-			DBUG_RETURN(error);
 		}
+		DBUG_RETURN(error);
 	}
 
 	innobase_commit_low(trx);

There also is an error in ALTER TABLE that fails to enforce the maximum index size. With ALGORITHM=COPY, the ALTER TABLE would fail:

CREATE TABLE t1 (c VARCHAR(1024), KEY(c)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
--error ER_INDEX_COLUMN_TOO_LONG
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=COPY;

This has been filed as MDEV-17833.

Generated at Thu Feb 08 08:39:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.