[MDEV-30105] ER_TABLE_EXISTS_ERROR or Assertion `err != DB_DUPLICATE_KEY' failed in row_rename_table_for_mysql Created: 2022-11-27  Updated: 2023-10-30

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: not-10.5+

Issue Links:
Relates
relates to MDEV-30883 Assertion `err != DB_DUPLICATE_KEY' f... Confirmed

 Description   

Given that it's a 10.3-10.4-only problem with FK check OFF, I don't expect it to be fixed, but need it to be filed so that the tests can start ignoring it.

--source include/have_innodb.inc
 
CREATE TABLE t1 (a CHAR(8), b CHAR(16), KEY(b)) ENGINE=InnoDB;
CREATE TABLE t2 (c CHAR(16)) ENGINE=InnoDB;
CREATE TABLE t3 (d CHAR(8)) ENGINE=InnoDB;
 
--write_file $MYSQL_TMP_DIR/data.txt
a
b
c
d
e
f
g
h
EOF
 
--connect (con1,localhost,root,,test)
SET FOREIGN_KEY_CHECKS = OFF;
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (b);
--send
  ALTER TABLE t1 MODIFY a INT;
 
--connection default
eval LOAD DATA LOCAL INFILE '$MYSQL_TMP_DIR/data.txt' INTO TABLE t2;
 
--connection con1
--reap
ALTER TABLE t3 MODIFY d INT;
 
# Cleanup
--disconnect con1
--connection default
DROP TABLE t3, t2, t1;

10.3 602124bb non-debug

mysqltest: At line 29: query 'ALTER TABLE t3 MODIFY d INT' failed: 1050: Table './test/#sql2-17928a-a' already exists

10.3 162c1505 debug

mysqld: /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0mysql.cc:4333: dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, bool, bool): Assertion `err != DB_DUPLICATE_KEY' failed.
221128  0:37:52 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc9da08c662 in __GI___assert_fail (assertion=0x557b7dd104a0 "err != DB_DUPLICATE_KEY", file=0x557b7dd09fe0 "/home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0mysql.cc", line=4333, function=0x557b7dd10180 "dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, bool, bool)") at assert.c:101
#8  0x0000557b7cb5db44 in row_rename_table_for_mysql (old_name=0x7fc9c3629ca0 "test/t3", new_name=0x7fc9c3629a60 "test/#sql2-179199-a", trx=0x7fc9d049ba18, commit=true, use_fk=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0mysql.cc:4333
#9  0x0000557b7c86c07a in innobase_rename_table (trx=0x7fc9d049ba18, from=0x7fc9c362af70 "./test/t3", to=0x7fc9c362b200 "./test/#sql2-179199-a", commit=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/handler/ha_innodb.cc:13541
#10 0x0000557b7c836ecf in ha_innobase::rename_table (this=0x62b0000407b8, from=0x7fc9c362af70 "./test/t3", to=0x7fc9c362b200 "./test/#sql2-179199-a") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/handler/ha_innodb.cc:13736
#11 0x0000557b7c2c44d5 in handler::ha_rename_table (this=0x62b0000407b8, from=0x7fc9c362af70 "./test/t3", to=0x7fc9c362b200 "./test/#sql2-179199-a") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/handler.cc:4708
#12 0x0000557b7bd868cb in mysql_rename_table (base=0x614000002248, old_db=0x7fc9c362c840, old_name=0x7fc9c362c850, new_db=0x7fc9c362c840, new_name=0x7fc9c362bc80, flags=2) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_table.cc:5633
#13 0x0000557b7bda73be in mysql_alter_table (thd=0x62a0000c0208, new_db=0x62a0000c4918, new_name=0x62a0000c4d00, create_info=0x7fc9c362d550, table_list=0x62b00003f338, alter_info=0x7fc9c362d450, order_num=0, order=0x0, ignore=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_table.cc:10373
#14 0x0000557b7bf0f2a2 in Sql_cmd_alter_table::execute (this=0x62b00003fb08, thd=0x62a0000c0208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_alter.cc:512
#15 0x0000557b7bb5b068 in mysql_execute_command (thd=0x62a0000c0208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:6076
#16 0x0000557b7bb66e9a in mysql_parse (thd=0x62a0000c0208, rawbuf=0x62b00003f228 "ALTER TABLE t3 MODIFY d INT", length=27, parser_state=0x7fc9c362f950, is_com_multi=false, is_next_command=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:7855
#17 0x0000557b7bb3e4e8 in dispatch_command (command=COM_QUERY, thd=0x62a0000c0208, packet=0x629000140209 "", packet_length=27, is_com_multi=false, is_next_command=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1852
#18 0x0000557b7bb3b0a0 in do_command (thd=0x62a0000c0208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1398
#19 0x0000557b7befeb8c in do_handle_one_connection (connect=0x608000000fa8) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1404
#20 0x0000557b7befe488 in handle_one_connection (arg=0x608000000fa8) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1309
#21 0x0000557b7d4ab929 in pfs_spawn_thread (arg=0x615000007d88) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:1869
#22 0x00007fc9da237ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x00007fc9da157aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible


Generated at Thu Feb 08 10:13:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.