The problem was found during RQG testing on MariaDB 10.4 30641f9df77be99d93524e39cdc2b2d783e6d3e1 2018-12-18
|
compiled with debug.
|
There was no replay of the assert on actual 10.2 and 10.3.
|
|
ts_3.test
|
--------------
|
--source include/have_innodb.inc
|
CREATE TABLE t1 (col2 INT, col_int INTEGER) ENGINE = InnoDB ROW_FORMAT = Redundant ;
|
ALTER TABLE t1 ADD UNIQUE INDEX IF NOT EXISTS `uidx3` ( col2 ) ;
|
ALTER TABLE t1 ADD PRIMARY KEY ( col_int, col2 ) ;
|
ALTER TABLE t1 ADD UNIQUE INDEX `uidx2` ( col_int ) ;
|
ALTER TABLE t1 DROP PRIMARY KEY ;
|
ALTER TABLE t1 CHANGE COLUMN col2 col2 INT ;
|
DELETE FROM t1 WHERE col2 = NULL OR col2 IS NULL;
|
|
SHOW PROCESSLIST;
|
|
...
|
Version: '10.4.1-MariaDB-debug-log' socket: 'bld_debug/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
|
2018-12-19 15:34:42 0x7f365a76c700 InnoDB: Assertion failure in file storage/innobase/row/row0sel.cc line 2549
|
InnoDB: Failing assertion: field->col->mtype == type
|
....
|
Query (0x7f3604014190): DELETE FROM t1 WHERE col2 = NULL OR col2 IS NULL
|
Connection ID (thread ID): 9
|
Status: NOT_KILLED
|
...
|
Thread 1 (Thread 0x7f365a76c700 (LWP 1205)):
|
#0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x000055d4a5055b94 in my_write_core (sig=6) at mysys/stacktrace.c:481
|
#2 0x000055d4a489bca3 in handle_fatal_signal (sig=6) at sql/signal_handler.cc:305
|
#3 <signal handler called>
|
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
|
#5 0x00007f3665479f5d in __GI_abort () at abort.c:90
|
#6 0x000055d4a4ce16e9 in ut_dbg_assertion_failed (expr=0x55d4a53cbc8a "field->col->mtype == type", file=0x55d4a53cb558 "storage/innobase/row/row0sel.cc", line=2549) at storage/innobase/ut/ut0dbg.cc:60
|
#7 0x000055d4a4c5b536 in row_sel_convert_mysql_key_to_innobase (tuple=0x7f36040662f8, buf=0x7f3604044acc "\217\217\217\217", buf_len=4, index=0x7f3604180da8, key_ptr=0x7f36040652ec "", key_len=5) at storage/innobase/row/row0sel.cc:2549
|
#8 0x000055d4a4ac8147 in ha_innobase::records_in_range (this=0x7f360417a3c0, keynr=1, min_key=0x7f365a7692a0, max_key=0x7f365a7692c0) at storage/innobase/handler/ha_innodb.cc:13439
|
#9 0x000055d4a47421e9 in handler::multi_range_read_info_const (this=0x7f360417a3c0, keyno=1, seq=0x7f365a769440, seq_init_param=0x7f365a769470, n_ranges_arg=0, bufsz=0x7f365a769344, flags=0x7f365a769340, cost=0x7f365a769a70) at sql/multi_range_read.cc:108
|
#10 0x000055d4a4745664 in DsMrr_impl::dsmrr_info_const (this=0x7f360417a808, keyno=1, seq=0x7f365a769440, seq_init_param=0x7f365a769470, n_ranges=0, bufsz=0x7f365a769a00, flags=0x7f365a7699fc, cost=0x7f365a769a70) at sql/multi_range_read.cc:1461
|
#11 0x000055d4a4ad2de2 in ha_innobase::multi_range_read_info_const (this=0x7f360417a3c0, keyno=1, seq=0x7f365a769440, seq_init_param=0x7f365a769470, n_ranges=0, bufsz=0x7f365a769a00, flags=0x7f365a7699fc, cost=0x7f365a769a70) at storage/innobase/handler/ha_innodb.cc:20366
|
#12 0x000055d4a4a12d8e in check_quick_select (param=0x7f365a769c30, idx=1, index_only=false, tree=0x7f3604065408, update_tbl_stats=true, mrr_flags=0x7f365a7699fc, bufsize=0x7f365a769a00, cost=0x7f365a769a70) at sql/opt_range.cc:10590
|
#13 0x000055d4a4a09967 in get_key_scans_params (param=0x7f365a769c30, tree=0x7f3604065380, index_read_must_be_used=false, update_tbl_stats=true, read_time=3.3000000000000003) at sql/opt_range.cc:6926
|
#14 0x000055d4a4a0018d in SQL_SELECT::test_quick_select (this=0x7f36040152a0, thd=0x7f3604000ce8, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=false) at sql/opt_range.cc:2704
|
#15 0x000055d4a4691ebc in SQL_SELECT::check_quick (this=0x7f36040152a0, thd=0x7f3604000ce8, force_quick_range=false, limit=18446744073709551615) at sql/opt_range.h:1648
|
#16 0x000055d4a4a44807 in mysql_delete (thd=0x7f3604000ce8, table_list=0x7f36040142a0, conds=0x7f3604014ea0, order_list=0x7f3604005590, limit=18446744073709551615, options=0, result=0x0) at sql/sql_delete.cc:502
|
#17 0x000055d4a45927bc in mysql_execute_command (thd=0x7f3604000ce8) at sql/sql_parse.cc:4925
|
#18 0x000055d4a459ca8c in mysql_parse (thd=0x7f3604000ce8, rawbuf=0x7f3604014190 "DELETE FROM t1 WHERE col2 = NULL OR col2 IS NULL", length=48, parser_state=0x7f365a76b5f0, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:8104
|
#19 0x000055d4a45899ba in dispatch_command (command=COM_QUERY, thd=0x7f3604000ce8, packet=0x7f360400acd9 "DELETE FROM t1 WHERE col2 = NULL OR col2 IS NULL", packet_length=48, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:1850
|
#20 0x000055d4a45883cf in do_command (thd=0x7f3604000ce8) at sql/sql_parse.cc:1395
|
#21 0x000055d4a46f329e in do_handle_one_connection (connect=0x55d4a70e33b8) at sql/sql_connect.cc:1402
|
#22 0x000055d4a46f3015 in handle_one_connection (arg=0x55d4a70e33b8) at sql/sql_connect.cc:1308
|
#23 0x000055d4a4fedd63 in pfs_spawn_thread (arg=0x55d4a7149d08) at storage/perfschema/pfs.cc:1862
|
#24 0x00007f366611b7fc in start_thread (arg=0x7f365a76c700) at pthread_create.c:465
|
#25 0x00007f3665555b5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Here is a little simpler test case:
--source include/have_innodb.inc
During the DELETE, InnoDB thinks that the UNIQUE INDEX(col2) serves as a PRIMARY KEY.
The instant NOT NULL attribute removal should have been blocked on the key of the clustered index, and the last ALTER TABLE should have rebuilt the table.
This is a regression caused by the first part of
MDEV-15563.