[MDEV-18039] Assertion `!strcmp(index->table->name.m_name, "SYS_FOREIGN") || !strcmp(index->table->name.m_name, "SYS_FOREIGN_COLS")' failed in btr_node_ptr_max_size upon reducing VARCHAR column length to 0 Created: 2018-12-19  Updated: 2018-12-21  Resolved: 2018-12-21

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.4.2, 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:
Relates
relates to MDEV-17815 Assertion `!strcmp(index->table->name... Closed

 Description   

The test case from MDEV-17815, only with VARCHAR instead of CHAR, still fails. I'm filing it separately instead of re-opening MDEV-17815, because the fix for MDEV-17815 will likely make it to 10.4.1 release, and the fix for this one won't.

--source include/have_innodb.inc
 
CREATE TABLE t1 (c VARCHAR(3), KEY(c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('foo');
ALTER IGNORE TABLE t1 MODIFY c VARCHAR(0);
 
# Cleanup
DROP TABLE t1;

10.2 0c2fc9b3da

mysqld: /data/src/10.2/storage/innobase/btr/btr0cur.cc:789: ulint btr_node_ptr_max_size(const dict_index_t*): Assertion `!strcmp(index->table->name.m_name, "SYS_FOREIGN") || !strcmp(index->table->name.m_name, "SYS_FOREIGN_COLS")' failed.
181219 21:26:57 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f206836fee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005581daf00894 in btr_node_ptr_max_size (index=0x7f2018041d38) at /data/src/10.2/storage/innobase/btr/btr0cur.cc:786
#9  0x00005581daf01693 in btr_cur_search_to_nth_level (index=0x7f2018041d38, level=0, tuple=0x7f20180419b0, mode=PAGE_CUR_LE, latch_mode=2, cursor=0x7f20587a7ef0, has_search_latch=0, file=0x5581db38b548 "/data/src/10.2/storage/innobase/row/row0ins.cc", line=2903, mtr=0x7f20587a8a00, autoinc=0) at /data/src/10.2/storage/innobase/btr/btr0cur.cc:1159
#10 0x00005581dadea12b in row_ins_sec_index_entry_low (flags=0, mode=2, index=0x7f2018041d38, offsets_heap=0x7f201803f490, heap=0x7f2018043e60, entry=0x7f20180419b0, trx_id=0, thr=0x7f2018042f30, dup_chk_only=false) at /data/src/10.2/storage/innobase/row/row0ins.cc:2903
#11 0x00005581dadeafeb in row_ins_sec_index_entry (index=0x7f2018041d38, entry=0x7f20180419b0, thr=0x7f2018042f30, dup_chk_only=false) at /data/src/10.2/storage/innobase/row/row0ins.cc:3248
#12 0x00005581dadeb158 in row_ins_index_entry (index=0x7f2018041d38, entry=0x7f20180419b0, thr=0x7f2018042f30) at /data/src/10.2/storage/innobase/row/row0ins.cc:3294
#13 0x00005581dadeb645 in row_ins_index_entry_step (node=0x7f2018042cd0, thr=0x7f2018042f30) at /data/src/10.2/storage/innobase/row/row0ins.cc:3442
#14 0x00005581dadeba38 in row_ins (node=0x7f2018042cd0, thr=0x7f2018042f30) at /data/src/10.2/storage/innobase/row/row0ins.cc:3585
#15 0x00005581dadec011 in row_ins_step (thr=0x7f2018042f30) at /data/src/10.2/storage/innobase/row/row0ins.cc:3811
#16 0x00005581dae09447 in row_insert_for_mysql (mysql_rec=0x7f201803dfb8 "\376", prebuilt=0x7f20180427b8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1413
#17 0x00005581dacceb1a in ha_innobase::write_row (this=0x7f201803ed88, record=0x7f201803dfb8 "\376") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8243
#18 0x00005581da9c4789 in handler::ha_write_row (this=0x7f201803ed88, buf=0x7f201803dfb8 "\376") at /data/src/10.2/sql/handler.cc:5961
#19 0x00005581da815b02 in copy_data_between_tables (thd=0x7f2018000b00, from=0x7f2018134010, to=0x7f201803fff0, create=..., ignore=true, order_num=0, order=0x0, copied=0x7f20587aa548, deleted=0x7f20587aa550, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f20587ab240) at /data/src/10.2/sql/sql_table.cc:10094
#20 0x00005581da813f81 in mysql_alter_table (thd=0x7f2018000b00, new_db=0x7f2018012b58 "test", new_name=0x0, create_info=0x7f20587abe50, table_list=0x7f2018012548, alter_info=0x7f20587abda0, order_num=0, order=0x0, ignore=true) at /data/src/10.2/sql/sql_table.cc:9576
#21 0x00005581da88e95d in Sql_cmd_alter_table::execute (this=0x7f2018012c50, thd=0x7f2018000b00) at /data/src/10.2/sql/sql_alter.cc:329
#22 0x00005581da745a45 in mysql_execute_command (thd=0x7f2018000b00) at /data/src/10.2/sql/sql_parse.cc:6227
#23 0x00005581da74a8a7 in mysql_parse (thd=0x7f2018000b00, rawbuf=0x7f2018012448 "ALTER IGNORE TABLE t1 MODIFY c VARCHAR(0)", length=41, parser_state=0x7f20587ad200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8014
#24 0x00005581da7381df in dispatch_command (command=COM_QUERY, thd=0x7f2018000b00, packet=0x7f2018096761 "ALTER IGNORE TABLE t1 MODIFY c VARCHAR(0)", packet_length=41, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1825
#25 0x00005581da736b42 in do_command (thd=0x7f2018000b00) at /data/src/10.2/sql/sql_parse.cc:1379
#26 0x00005581da8895f3 in do_handle_one_connection (connect=0x5581ddaabd90) at /data/src/10.2/sql/sql_connect.cc:1335
#27 0x00005581da889380 in handle_one_connection (arg=0x5581ddaabd90) at /data/src/10.2/sql/sql_connect.cc:1241
#28 0x00005581dacaf20c in pfs_spawn_thread (arg=0x5581ddab1ba0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#29 0x00007f2069e2b494 in start_thread (arg=0x7f20587ae700) at pthread_create.c:333
#30 0x00007f206842c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Marko Mäkelä [ 2018-12-21 ]

I believe that this bug only had a prominent impact for debug builds.
Release builds could unnecessarily reserve extra space for indexed VARCHAR(0) columns.

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