Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
--source include/have_innodb.inc
|
|
CREATE TABLE t1 (pk INT, f INT, PRIMARY KEY(pk)) ENGINE=InnoDB; |
CREATE VIEW v1 AS SELECT * FROM t1; |
LOCK TABLES t1 READ, v1 WRITE; |
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
|
ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f); |
|
# Cleanup
|
UNLOCK TABLES;
|
DROP VIEW v1; |
DROP TABLE t1; |
10.1 ef0b91e |
mysqld: /data/src/10.1/sql/mdl.cc:2313: bool MDL_context::upgrade_shared_lock(MDL_ticket*, enum_mdl_type, double): Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE || mdl_ticket->m_type == MDL_SHARED_NO_WRITE || mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE' failed.
|
190129 20:39:54 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007fb854c45ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
#8 0x0000562de6bb5ba5 in MDL_context::upgrade_shared_lock (this=0x7fb84b7c7168, mdl_ticket=0x7fb83ec570c0, new_type=MDL_SHARED_NO_WRITE, lock_wait_timeout=31536000) at /data/src/10.1/sql/mdl.cc:2311
|
#9 0x0000562de6b3c727 in mysql_alter_table (thd=0x7fb84b7c7070, new_db=0x7fb83ec43790 "test", new_name=0x0, create_info=0x7fb856cb7300, table_list=0x7fb83ec431a0, alter_info=0x7fb856cb7270, order_num=0, order=0x0, ignore=false) at /data/src/10.1/sql/sql_table.cc:9117
|
#10 0x0000562de6bae1d5 in Sql_cmd_alter_table::execute (this=0x7fb83ec43990, thd=0x7fb84b7c7070) at /data/src/10.1/sql/sql_alter.cc:330
|
#11 0x0000562de6a7c6c7 in mysql_execute_command (thd=0x7fb84b7c7070) at /data/src/10.1/sql/sql_parse.cc:5701
|
#12 0x0000562de6a80f6b in mysql_parse (thd=0x7fb84b7c7070, rawbuf=0x7fb83ec43088 "ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)", length=53, parser_state=0x7fb856cb85e0) at /data/src/10.1/sql/sql_parse.cc:7468
|
#13 0x0000562de6a6f7bc in dispatch_command (command=COM_QUERY, thd=0x7fb84b7c7070, packet=0x7fb84d6aa071 "ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)", packet_length=53) at /data/src/10.1/sql/sql_parse.cc:1496
|
#14 0x0000562de6a6e535 in do_command (thd=0x7fb84b7c7070) at /data/src/10.1/sql/sql_parse.cc:1124
|
#15 0x0000562de6ba9710 in do_handle_one_connection (thd_arg=0x7fb84b7c7070) at /data/src/10.1/sql/sql_connect.cc:1330
|
#16 0x0000562de6ba9474 in handle_one_connection (arg=0x7fb84b7c7070) at /data/src/10.1/sql/sql_connect.cc:1242
|
#17 0x0000562de6f677d6 in pfs_spawn_thread (arg=0x7fb84fbea670) at /data/src/10.1/storage/perfschema/pfs.cc:1861
|
#18 0x00007fb856949494 in start_thread (arg=0x7fb856cb9b00) at pthread_create.c:333
|
#19 0x00007fb854d0293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
|
Query (0x7fb83ec43088): ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)
|
Connection ID (thread ID): 3
|
Status: NOT_KILLED
|
10.2 3fb6d25 |
mysqld: /data/src/10.2/sql/mdl.cc:2328: bool MDL_context::upgrade_shared_lock(MDL_ticket*, enum_mdl_type, double): Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE || mdl_ticket->m_type == MDL_SHARED_NO_WRITE || mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE || mdl_ticket->m_type == MDL_SHARED_READ || mdl_ticket->m_type == MDL_SHARED_WRITE' failed.
|
190130 1:59:49 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f7e517bbee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
#8 0x00005648e7df34ca in MDL_context::upgrade_shared_lock (this=0x7f7e00000c20, mdl_ticket=0x7f7e00155cb0, new_type=MDL_SHARED_NO_WRITE, lock_wait_timeout=86400) at /data/src/10.2/sql/mdl.cc:2324
|
#9 0x00005648e7d7046c in mysql_alter_table (thd=0x7f7e00000b00, new_db=0x7f7e00012b70 "test", new_name=0x0, create_info=0x7f7e4c091e50, table_list=0x7f7e00012560, alter_info=0x7f7e4c091da0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9451
|
#10 0x00005648e7deb639 in Sql_cmd_alter_table::execute (this=0x7f7e00012d70, thd=0x7f7e00000b00) at /data/src/10.2/sql/sql_alter.cc:329
|
#11 0x00005648e7ca2252 in mysql_execute_command (thd=0x7f7e00000b00) at /data/src/10.2/sql/sql_parse.cc:6228
|
#12 0x00005648e7ca70b3 in mysql_parse (thd=0x7f7e00000b00, rawbuf=0x7f7e00012448 "ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)", length=53, parser_state=0x7f7e4c093200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8015
|
#13 0x00005648e7c949ed in dispatch_command (command=COM_QUERY, thd=0x7f7e00000b00, packet=0x7f7e000963d1 "ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)", packet_length=53, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
|
#14 0x00005648e7c93344 in do_command (thd=0x7f7e00000b00) at /data/src/10.2/sql/sql_parse.cc:1379
|
#15 0x00005648e7de62cf in do_handle_one_connection (connect=0x5648ea49e9f0) at /data/src/10.2/sql/sql_connect.cc:1335
|
#16 0x00005648e7de605c in handle_one_connection (arg=0x5648ea49e9f0) at /data/src/10.2/sql/sql_connect.cc:1241
|
#17 0x00005648e820bf92 in pfs_spawn_thread (arg=0x5648ea3e4df0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
|
#18 0x00007f7e53492494 in start_thread (arg=0x7f7e4c094700) at pthread_create.c:333
|
#19 0x00007f7e5187893f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
10.1/10.2 non-debug and 10.3/10.4 debug builds dosn't crash, but they fail with the error I wouldn't expect:
mysqltest: At line 7: query 'ALTER TABLE t1 ADD FOREIGN KEY (pk) REFERENCES t1 (f)' failed with wrong errno 1005: 'Can't create table `test`.`#sql-48ba_3` (errno: 150 "Foreign key constraint is incorrectly formed")', instead of 1099...
|
The failure appeared in 10.1 tree with this commit:
commit 6472c5c015a174ffd680fddc8f20c7a94684a552
|
Author: Alexey Botchkov
|
Date: Sat Nov 3 14:24:15 2018 +0400
|
|
MDEV-15890 Strange error message if you try to FLUSH TABLES <view> after LOCK TABLES <view>.
|
|
LOCK view WRITE shouldn't block FLUSH view.
|
So we set the view's mdl_request type to it's tables.
|