Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL)
Description
10.2 1ff8588c non-debug |
2020-10-27 15:12:55 139934267832064 [Warning] InnoDB: In ALTER TABLE `test`.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.
|
201027 15:12:55 [ERROR] mysqld got signal 11 ;
|
|
#3 <signal handler called>
|
#4 0x00005589c7ea5253 in init_fts_doc_id_for_ref (depth=0x7f44fc4e9928, table=0x7f44a80940a8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1722
|
#5 init_fts_doc_id_for_ref (depth=0x7f44fc4e9928, table=0x7f44a80940a8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1696
|
#6 row_update_for_mysql (prebuilt=0x7f44a80a7528) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1772
|
#7 0x00005589c7df5953 in ha_innobase::update_row (this=0x7f44a80a2150, old_row=0x7f44a8094908 "\375=", new_row=0x7f44a80948f8 "\375=") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8954
|
#8 0x00005589c7c57a44 in handler::ha_update_row (this=0x7f44a80a2150, old_data=0x7f44a8094908 "\375=", new_data=0x7f44a80948f8 "\375=") at /data/src/10.2/sql/handler.cc:6141
|
#9 0x00005589c7b47eff in mysql_update (thd=thd@entry=0x7f44ac000c48, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551555, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f44fc4e9fa0, updated_return=0x7f44fc4ea050) at /data/src/10.2/sql/sql_update.cc:819
|
#10 0x00005589c7a9e9e2 in mysql_execute_command (thd=0x7f44ac000c48) at /data/src/10.2/sql/sql_parse.cc:4001
|
#11 0x00005589c7aa445b in mysql_parse (thd=thd@entry=0x7f44ac000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f44fc4eb5b0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:7733
|
#12 0x00005589c7aa770d in dispatch_command (command=COM_QUERY, thd=0x7f44ac000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_class.h:1095
|
#13 0x00005589c7aa8897 in do_command (thd=0x7f44ac000c48) at /data/src/10.2/sql/sql_parse.cc:1380
|
#14 0x00005589c7b80f36 in do_handle_one_connection (connect=connect@entry=0x5589cb484b38) at /data/src/10.2/sql/sql_connect.cc:1336
|
#15 0x00005589c7b810af in handle_one_connection (arg=arg@entry=0x5589cb484b38) at /data/src/10.2/sql/sql_connect.cc:1241
|
#16 0x00005589c8118c76 in pfs_spawn_thread (arg=0x5589cb4379c8) at /data/src/10.2/storage/perfschema/pfs.cc:1869
|
#17 0x00007f45025af609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#18 0x00007f45021a4293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
10.2 1ff8588c debug |
2020-10-27 15:10:50 139714472048384 [Warning] InnoDB: In ALTER TABLE `test`.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.
|
mysqld: /data/src/10.2/storage/innobase/row/row0mysql.cc:1720: void init_fts_doc_id_for_ref(dict_table_t*, ulint*): Assertion `foreign->foreign_table != __null' failed.
|
201027 15:10:50 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f11d9394f36 in __GI___assert_fail (assertion=0x560917e53bd8 "foreign->foreign_table != __null", file=0x560917e52dd8 "/data/src/10.2/storage/innobase/row/row0mysql.cc", line=1720, function=0x560917e53ba0 "void init_fts_doc_id_for_ref(dict_table_t*, ulint*)") at assert.c:101
|
#8 0x0000560917822f31 in init_fts_doc_id_for_ref (table=0x7f11800a05e0, depth=0x7f11cf7523c0) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1720
|
#9 0x000056091782319a in row_update_for_mysql (prebuilt=0x7f118009b890) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1772
|
#10 0x00005609176e3f8a in ha_innobase::update_row (this=0x7f1180191488, old_row=0x7f11800a80d0 "\375\f", new_row=0x7f11800a80c0 "\375\f") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8954
|
#11 0x00005609174e515c in handler::ha_update_row (this=0x7f1180191488, old_data=0x7f11800a80d0 "\375\f", new_data=0x7f11800a80c0 "\375\f") at /data/src/10.2/sql/handler.cc:6141
|
#12 0x000056091734821c in mysql_update (thd=0x7f1174000d90, table_list=0x7f1174011410, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551604, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f11cf752c60, updated_return=0x7f11cf752d10) at /data/src/10.2/sql/sql_update.cc:819
|
#13 0x0000560917255111 in mysql_execute_command (thd=0x7f1174000d90) at /data/src/10.2/sql/sql_parse.cc:4001
|
#14 0x0000560917260ec1 in mysql_parse (thd=0x7f1174000d90, rawbuf=0x7f1174011338 "UPDATE t1 SET a = 6", length=19, parser_state=0x7f11cf7535f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
|
#15 0x000056091724f25e in dispatch_command (command=COM_QUERY, thd=0x7f1174000d90, packet=0x7f1174008b51 "UPDATE t1 SET a = 6", packet_length=19, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
|
#16 0x000056091724dd59 in do_command (thd=0x7f1174000d90) at /data/src/10.2/sql/sql_parse.cc:1380
|
#17 0x00005609173a7bb1 in do_handle_one_connection (connect=0x56091a604f60) at /data/src/10.2/sql/sql_connect.cc:1336
|
#18 0x00005609173a7916 in handle_one_connection (arg=0x56091a604f60) at /data/src/10.2/sql/sql_connect.cc:1241
|
#19 0x0000560917bcc0cc in pfs_spawn_thread (arg=0x56091a645920) at /data/src/10.2/storage/perfschema/pfs.cc:1869
|
#20 0x00007f11d98a4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
|
#21 0x00007f11d9480293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
rr profile is available.
Reproducible on 10.2-10.5 with the test case below. 10.1 rejects the first ALTER TABLE despite the disabled foreign key checks.
The test case is non-deterministic, run with --repeat=N. It currently fails for me reasonably well, within ~10 attempts or so (but it takes much longer with rr, hundreds of attempts).
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
|
call mtr.add_suppression("has or is referenced in foreign key constraints"); |
|
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, a INT, KEY(a)) ENGINE=InnoDB; |
CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=InnoDB; |
|
INSERT INTO t1 (a) SELECT 1 FROM seq_1_to_100; |
|
SET FOREIGN_KEY_CHECKS= OFF; |
ALTER TABLE t2 MODIFY COLUMN b YEAR; |
|
--connect (con1,localhost,root,,test)
|
--send
|
UPDATE t1 SET a = 6; |
|
--connection default
|
ALTER TABLE t2 ADD INDEX ind (b); |
|
--source include/restart_mysqld.inc |
Attachments
Issue Links
- relates to
-
MDEV-24876 InnoDB: Failing assertion: lock->lock_word == X_LOCK_DECR or safe_mutex: Trying to destroy a mutex cache->lock that was locked
-
- Stalled
-
-
MDEV-21175 Remove dict_table_t::n_foreign_key_checks_running from InnoDB
-
- Closed
-
-
MDEV-29998 Missing FK constraint after changing column type under disabled FK checks
-
- Open
-
(rr) t 2
[Switching to thread 2 (Thread 19240.19274)]
#10 0x00005652d7fdf81a in dict_foreign_add_to_cache (
foreign=0x7f705404f860, col_names=0x0, check_charsets=false,
ignore_err=DICT_ERR_IGNORE_NONE)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0dict.cc:3193
3193 dict_foreign_error_report(
(rr) where
#0 _IO_vfscanf_internal (s=s@entry=0x7f70b00eeb00,
format=format@entry=0x7f70c7c61464 "%hu%n:%hu%n:%hu%n",
argptr=argptr@entry=0x7f70b00eec30, errp=errp@entry=0x0)
at vfscanf.c:1803
#1 0x00007f70c7b2d80d in _IO_vsscanf (string=0x5652da834214 "5:30",
format=0x7f70c7c61464 "%hu%n:%hu%n:%hu%n",
args=args@entry=0x7f70b00eec30) at iovsscanf.c:41
#2 0x00007f70c7b27214 in __sscanf (s=s@entry=0x5652da834214 "5:30",
format=format@entry=0x7f70c7c61464 "%hu%n:%hu%n:%hu%n")
at sscanf.c:32
#3 0x00007f70c7b7f6f6 in parse_offset (whichrule=0,
tzp=0x7f70b00eed38) at tzset.c:208
#4 __tzset_parse_tz (tz=<optimized out>) at tzset.c:329
#5 0x00007f70c7b81cc0 in __tzfile_compute (timer=<optimized out>,
use_localtime=use_localtime@entry=1,
leap_correct=leap_correct@entry=0x7f70b00eee20,
leap_hit=leap_hit@entry=0x7f70b00eee1c, tp=tp@entry=0x7f70b00eee90)
at tzfile.c:684
#6 0x00007f70c7b8057e in __tz_convert (timer=0x7f70b00eee78,
use_localtime=1, tp=0x7f70b00eee90) at tzset.c:587
#7 0x00005652d7f3873f in ut_print_timestamp (file=0x5652dab24550)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/ut/ut0ut.cc:86
#8 0x00005652d7fdf2aa in dict_foreign_error_report_low (
file=0x5652dab24550, name=0x7f705404f8e0 "test/t2")
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0dict.cc:3059
#9 0x00005652d7fdf340 in dict_foreign_error_report (
file=0x5652dab24550, fk=0x7f705404f860,
msg=0x5652d8592280 "there is no index in the table which would contain\nthe columns as the first columns, or the data types in the\ntable do not match the ones in the referenced table\nor one of the ON ... SET NULL columns "...)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0dict.cc:3076
#10 0x00005652d7fdf81a in dict_foreign_add_to_cache (
--Type <RET> for more, q to quit, c to continue without paging--
foreign=0x7f705404f860, col_names=0x0, check_charsets=false,
ignore_err=DICT_ERR_IGNORE_NONE)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0dict.cc:3193
#11 0x00005652d7ff87ac in dict_load_foreign (
id=0x7f70b00efa60 "test/t2_ibfk_1", col_names=0x0,
check_recursive=false, check_charsets=false,
ignore_err=DICT_ERR_IGNORE_NONE,
fk_tables=std::deque with 0 elements)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0load.cc:3561
#12 0x00005652d7ff8d10 in dict_load_foreigns (
table_name=0x5652dab413f0 "test/t2", col_names=0x0,
check_recursive=false, check_charsets=false,
ignore_err=DICT_ERR_IGNORE_NONE,
fk_tables=std::deque with 0 elements)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/dict/dict0load.cc:3701
#13 0x00005652d7d732ba in innobase_update_foreign_cache (
ctx=0x7f7054015ff8, user_thd=0x7f7054000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/handler/handler0alter.cc:7456
#14 0x00005652d7d75490 in ha_innobase::commit_inplace_alter_table (
this=0x7f705412f878, altered_table=0x7f70540aee40,
ha_alter_info=0x7f70b00f1020, commit=true)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/handler/handler0alter.cc:8633
#15 0x00005652d7b419b6 in handler::ha_commit_inplace_alter_table (
this=0x7f705412f878, altered_table=0x7f70540aee40,
ha_alter_info=0x7f70b00f1020, commit=true)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/handler.cc:4378
#16 0x00005652d7991fbf in mysql_inplace_alter_table (
thd=0x7f7054000d50, table_list=0x7f70540148a8,
table=0x7f705412ec70, altered_table=0x7f70540aee40,
ha_alter_info=0x7f70b00f1020,
inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE,
--Type <RET> for more, q to quit, c to continue without paging--
target_mdl_request=0x7f70b00f10b0, alter_ctx=0x7f70b00f1660)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_table.cc:7480
#17 0x00005652d7997c0a in mysql_alter_table (thd=0x7f7054000d50,
new_db=0x7f7054014ec0 "test", new_name=0x0,
create_info=0x7f70b00f2280, table_list=0x7f70540148a8,
alter_info=0x7f70b00f21d0, order_num=0, order=0x0, ignore=false)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_table.cc:9622
#18 0x00005652d7a140a0 in Sql_cmd_alter_table::execute (
this=0x7f7054014f90, thd=0x7f7054000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_alter.cc:333
#19 0x00005652d78c7c6f in mysql_execute_command (thd=0x7f7054000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:5964
#20 0x00005652d78ccbbd in mysql_parse (thd=0x7f7054000d50,
rawbuf=0x7f70540147b8 "ALTER TABLE t2 ADD INDEX ind (b)",
length=32, parser_state=0x7f70b00f35f0, is_com_multi=false,
is_next_command=false)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:7733
#21 0x00005652d78bb065 in dispatch_command (command=COM_QUERY,
thd=0x7f7054000d50,
packet=0x7f7054008b11 "ALTER TABLE t2 ADD INDEX ind (b)",
packet_length=32, is_com_multi=false, is_next_command=false)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:1826
#22 0x00005652d78b9aea in do_command (thd=0x7f7054000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:1380
#23 0x00005652d7a0ec8e in do_handle_one_connection (
connect=0x5652da96c180)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_connect.cc:1336
#24 0x00005652d7a0e9f9 in handle_one_connection (arg=0x5652da96c180)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_connect.cc:1241
#25 0x00005652d820eb4e in pfs_spawn_thread (arg=0x5652dae8b500)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/perfschema/pfs.cc:1869
#26 0x00007f70c882e6db in start_thread (arg=0x7f70b00f4700)
at pthread_create.c:463
#27 0x00007f70c7bcda3f in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
t 29:
(rr) t 29
[Switching to thread 29 (Thread 19240.19283)]
#0 init_fts_doc_id_for_ref (table=0x7f705415bb90,
depth=0x7f70b00a73a8)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/row/row0mysql.cc:1720
1720 ut_ad(foreign->foreign_table != NULL);
(rr) where
#0 init_fts_doc_id_for_ref (table=0x7f705415bb90,
depth=0x7f70b00a73a8)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/row/row0mysql.cc:1720
#1 0x00005652d7e712ea in row_update_for_mysql (
prebuilt=0x7f70540a4620)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/row/row0mysql.cc:1772
#2 0x00005652d7d37627 in ha_innobase::update_row (
this=0x7f70540a3e98, old_row=0x7f7054152830 "\375\b",
new_row=0x7f7054152820 "\375\b")
at /home/thiru/mariarepo/10.2/10.2-sample/storage/innobase/handler/ha_innodb.cc:8954
#3 0x00005652d7b46076 in handler::ha_update_row (this=0x7f70540a3e98,
old_data=0x7f7054152830 "\375\b", new_data=0x7f7054152820 "\375\b")
at /home/thiru/mariarepo/10.2/10.2-sample/sql/handler.cc:6141
#4 0x00005652d79b08e4 in mysql_update (thd=0x7f7058000d50,
table_list=0x7f70580113d0, fields=..., values=..., conds=0x0,
order_num=0, order=0x0, limit=18446744073709551608,
handle_duplicates=DUP_ERROR, ignore=false,
found_return=0x7f70b00a7c50, updated_return=0x7f70b00a7d00)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_update.cc:819
#5 0x00005652d78c0e92 in mysql_execute_command (thd=0x7f7058000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:4001
#6 0x00005652d78ccbbd in mysql_parse (thd=0x7f7058000d50,
rawbuf=0x7f70580112f8 "UPDATE t1 SET a = 6", length=19,
parser_state=0x7f70b00a85f0, is_com_multi=false,
is_next_command=false)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:7733
#7 0x00005652d78bb065 in dispatch_command (command=COM_QUERY,
thd=0x7f7058000d50, packet=0x7f7058008b11 "UPDATE t1 SET a = 6",
packet_length=19, is_com_multi=false, is_next_command=false)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:1826
#8 0x00005652d78b9aea in do_command (thd=0x7f7058000d50)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_parse.cc:1380
#9 0x00005652d7a0ec8e in do_handle_one_connection (
--Type <RET> for more, q to quit, c to continue without paging--
connect=0x5652daf46310)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_connect.cc:1336
#10 0x00005652d7a0e9f9 in handle_one_connection (arg=0x5652daf46310)
at /home/thiru/mariarepo/10.2/10.2-sample/sql/sql_connect.cc:1241
#11 0x00005652d820eb4e in pfs_spawn_thread (arg=0x5652daf46650)
at /home/thiru/mariarepo/10.2/10.2-sample/storage/perfschema/pfs.cc:1869
#12 0x00007f70c882e6db in start_thread (arg=0x7f70b00a9700)
at pthread_create.c:463
#13 0x00007f70c7bcda3f in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Alter table t2 does create a foreign key constraint and failed to find the index for it. But before alter frees the foreign.
Update statement of parent table t1 uses the foreign structure and asserts it.