[MDEV-18800] Server crash in instant_alter_column_possible or Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key Created: 2019-03-03  Updated: 2019-03-17  Resolved: 2019-03-17

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: 10.4.4

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Sachin Setiya (Inactive)
Resolution: Fixed Votes: 0
Labels: regression

Issue Links:
Problem/Incident
is caused by MDEV-371 Unique indexes for blobs Closed

 Description   

Note: The problem appeared in 10.4 tree with MDEV-371, even though there are no BLOBs in the scenario.

--source include/have_innodb.inc
CREATE TABLE t1 (pk INT, PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB;
ALTER TABLE t1 ADD INDEX (pk);
 
# Cleanup
DROP TABLE t1;

10.4 3b47587f

mysqld: /data/src/10.4/storage/innobase/handler/handler0alter.cc:1489: bool instant_alter_column_possible(const dict_table_t&, const Alter_inplace_info*, const TABLE*, const TABLE*): Assertion `!pk->has_virtual()' failed.
190303 14:51:32 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f27ba5adee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055e41be49ed7 in instant_alter_column_possible (ib_table=..., ha_alter_info=0x7f27b4123900, table=0x7f27601a2fb0, altered_table=0x7f2760153210) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:1489
#9  0x000055e41be4ad44 in ha_innobase::check_if_supported_inplace_alter (this=0x7f276000d1f8, altered_table=0x7f2760153210, ha_alter_info=0x7f27b4123900) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:1915
#10 0x000055e41b87bb3f in mysql_alter_table (thd=0x7f2760000b00, new_db=0x7f2760005290, new_name=0x7f2760005690, create_info=0x7f27b4124cd0, table_list=0x7f2760015590, alter_info=0x7f27b4124c10, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9890
#11 0x000055e41b90a0ee in Sql_cmd_alter_table::execute (this=0x7f2760015d08, thd=0x7f2760000b00) at /data/src/10.4/sql/sql_alter.cc:499
#12 0x000055e41b79b48e in mysql_execute_command (thd=0x7f2760000b00) at /data/src/10.4/sql/sql_parse.cc:6346
#13 0x000055e41b7a0636 in mysql_parse (thd=0x7f2760000b00, rawbuf=0x7f27600154a8 "ALTER TABLE t1 ADD INDEX (pk)", length=29, parser_state=0x7f27b4126180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8157
#14 0x000055e41b78bd24 in dispatch_command (command=COM_QUERY, thd=0x7f2760000b00, packet=0x7f2760139fd1 "ALTER TABLE t1 ADD INDEX (pk)", packet_length=29, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
#15 0x000055e41b78a4f8 in do_command (thd=0x7f2760000b00) at /data/src/10.4/sql/sql_parse.cc:1358
#16 0x000055e41b904003 in do_handle_one_connection (connect=0x55e41e0c4d10) at /data/src/10.4/sql/sql_connect.cc:1399
#17 0x000055e41b903d74 in handle_one_connection (arg=0x55e41e0c4d10) at /data/src/10.4/sql/sql_connect.cc:1302
#18 0x000055e41bdfad17 in pfs_spawn_thread (arg=0x55e41e10ab80) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#19 0x00007f27bc284494 in start_thread (arg=0x7f27b4127700) at pthread_create.c:333
#20 0x00007f27ba66a93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Non-debug builds crashes with the stack trace of MDEV-18798, minus prior "no matching column" error.

10.4 non-debug 3b47587f

#2  <signal handler called>
#3  0x00005581c1a498ce in ha_innobase::commit_inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>, commit=<optimized out>) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:11131
#4  0x00005581c1521714 in mysql_inplace_alter_table (thd=thd@entry=0x7f77300009a8, table_list=0x7f7730011f88, table=table@entry=0x7f77300825a8, altered_table=altered_table@entry=0x7f77300c7af8, ha_alter_info=ha_alter_info@entry=0x7f777c092e10, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_NOCOPY_NO_LOCK, alter_ctx=0x7f777c093660, target_mdl_request=0x7f777c092eb0) at /data/src/10.4/sql/sql_table.cc:7695
#5  0x00005581c16ad33b in mysql_alter_table (thd=<optimized out>, new_db=<optimized out>, new_name=<optimized out>, create_info=<optimized out>, table_list=0x7f7730011f88, alter_info=0x7f777c094160, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9922
#6  0x00005581c16fb57b in Sql_cmd_alter_table::execute (this=0x7f7730000040, thd=0x7f77300009a8) at /data/src/10.4/sql/sql_alter.cc:499
#7  0x00005581c1613256 in mysql_execute_command (thd=thd@entry=0x7f77300009a8) at /data/src/10.4/sql/sql_parse.cc:6346
#8  0x00005581c161a711 in mysql_parse (thd=thd@entry=0x7f77300009a8, rawbuf=<optimized out>, length=29, parser_state=parser_state@entry=0x7f777c0971d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:8157
#9  0x00005581c161cf3f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f77300009a8, packet=packet@entry=0x7f7730009b39 "ALTER TABLE t1 ADD INDEX (pk)", packet_length=packet_length@entry=29, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1829
#10 0x00005581c161e397 in do_command (thd=0x7f77300009a8) at /data/src/10.4/sql/sql_parse.cc:1358
#11 0x00005581c16f894c in do_handle_one_connection (connect=connect@entry=0x5581c376a718) at /data/src/10.4/sql/sql_connect.cc:1399
#12 0x00005581c16f8ab4 in handle_one_connection (arg=arg@entry=0x5581c376a718) at /data/src/10.4/sql/sql_connect.cc:1302
#13 0x00005581c1a16154 in pfs_spawn_thread (arg=0x5581c376a778) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#14 0x00007f77839f6494 in start_thread (arg=0x7f777c098700) at pthread_create.c:333
#15 0x00007f7781ddc93f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Sachin Setiya (Inactive) [ 2019-03-04 ]

Hash key can not be primary key. So it should automatically become btree key not hash key

Comment by Sachin Setiya (Inactive) [ 2019-03-04 ]

Serg it is in bb-10.4-serg branch

Comment by Elena Stepanova [ 2019-03-04 ]

Other failures, get fixed by the same patch.

--source include/have_innodb.inc
 
CREATE TABLE t1 (pk INT, c CHAR(8), FULLTEXT (c), PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'foo');
INSERT IGNORE INTO t1 SELECT * FROM t1;
 
# Cleanup
DROP TABLE t1;

10.4 47b7ca62

2019-03-05 01:33:45 0x7fe1a9c17700  InnoDB: Assertion failure in file /data/src/10.4/storage/innobase/row/row0row.cc line 1144
InnoDB: Failing assertion: pos != ULINT_UNDEFINED
 
#6  0x000055ebed904946 in ut_dbg_assertion_failed (expr=0x55ebedf1626b "pos != ULINT_UNDEFINED", file=0x55ebedf15e60 "/data/src/10.4/storage/innobase/row/row0row.cc", line=1144) at /data/src/10.4/storage/innobase/ut/ut0dbg.cc:60
#7  0x000055ebed86fee5 in row_build_row_ref_in_tuple (ref=0x7fe160084ae8, rec=0x7fe1aa43407d "", index=0x7fe160158e48, offsets=0x7fe1a9c13800) at /data/src/10.4/storage/innobase/row/row0row.cc:1144
#8  0x000055ebeda3999e in fts_add_doc_by_id (ftt=0x7fe1600841a8, doc_id=1, fts_indexes=0x0) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:3542
#9  0x000055ebeda381b3 in fts_add (ftt=0x7fe1600841a8, row=0x7fe160083e90) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:2885
#10 0x000055ebeda38959 in fts_commit_table (ftt=0x7fe1600841a8) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:3057
#11 0x000055ebeda38a4d in fts_commit (trx=0x7fe1aa6fd140) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:3106
#12 0x000055ebed8f6e25 in trx_commit_low (trx=0x7fe1aa6fd140, mtr=0x7fe1a9c144a0) at /data/src/10.4/storage/innobase/trx/trx0trx.cc:1482
#13 0x000055ebed8f6fe5 in trx_commit (trx=0x7fe1aa6fd140) at /data/src/10.4/storage/innobase/trx/trx0trx.cc:1570
#14 0x000055ebed8f73f1 in trx_commit_for_mysql (trx=0x7fe1aa6fd140) at /data/src/10.4/storage/innobase/trx/trx0trx.cc:1706
#15 0x000055ebed6d6403 in innobase_commit_low (trx=0x7fe1aa6fd140) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:4407
#16 0x000055ebed6d67c6 in innobase_commit_ordered_2 (trx=0x7fe1aa6fd140, thd=0x7fe160000b00) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:4529
#17 0x000055ebed6d6cbc in innobase_commit (hton=0x55ebef924350, thd=0x7fe160000b00, commit_trx=false) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:4645
#18 0x000055ebed3988eb in commit_one_phase_2 (thd=0x7fe160000b00, all=false, trans=0x7fe160004090, is_real_trans=true) at /data/src/10.4/sql/handler.cc:1741
#19 0x000055ebed3987ed in ha_commit_one_phase (thd=0x7fe160000b00, all=false) at /data/src/10.4/sql/handler.cc:1721
#20 0x000055ebed397b73 in ha_commit_trans (thd=0x7fe160000b00, all=false) at /data/src/10.4/sql/handler.cc:1534
#21 0x000055ebed1dc1a1 in trans_commit_stmt (thd=0x7fe160000b00) at /data/src/10.4/sql/transaction.cc:513
#22 0x000055ebed05e095 in mysql_execute_command (thd=0x7fe160000b00) at /data/src/10.4/sql/sql_parse.cc:6403
#23 0x000055ebed062f86 in mysql_parse (thd=0x7fe160000b00, rawbuf=0x7fe1600154a8 "INSERT INTO t1 VALUES (1,'foo')", length=31, parser_state=0x7fe1a9c16180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8157
#24 0x000055ebed04e674 in dispatch_command (command=COM_QUERY, thd=0x7fe160000b00, packet=0x7fe16013a181 "INSERT INTO t1 VALUES (1,'foo')", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
#25 0x000055ebed04ce48 in do_command (thd=0x7fe160000b00) at /data/src/10.4/sql/sql_parse.cc:1358
#26 0x000055ebed1c69ab in do_handle_one_connection (connect=0x55ebefca9d10) at /data/src/10.4/sql/sql_connect.cc:1399
#27 0x000055ebed1c671c in handle_one_connection (arg=0x55ebefca9d10) at /data/src/10.4/sql/sql_connect.cc:1302
#28 0x000055ebed6bd3fd in pfs_spawn_thread (arg=0x55ebefcefb80) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#29 0x00007fe1b25c4494 in start_thread (arg=0x7fe1a9c17700) at pthread_create.c:333
#30 0x00007fe1b09aa93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

--source include/have_innodb.inc
 
CREATE TABLE t1 (pk INT, c CHAR(8), FULLTEXT (c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'foo');
INSERT INTO t1 SELECT * FROM t1;
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD PRIMARY KEY USING HASH (pk);
 
# Cleanup
DROP TABLE t1;

10.4 47b7ca62

mysqld: /data/src/10.4/storage/innobase/include/rem0rec.ic:881: ulint rec_get_nth_field_offs(const ulint*, ulint, ulint*): Assertion `n < rec_offs_n_fields(offsets)' failed.
190305  1:39:19 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f0ca0963ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055836de46950 in rec_get_nth_field_offs (offsets=0x7f0c99c88000, n=18446744073709551615, len=0x7f0c99c87858) at /data/src/10.4/storage/innobase/include/rem0rec.ic:881
#9  0x000055836de5231f in fts_get_doc_id_from_rec (rec=0x7f0c9a51c07e "", index=0x7f0c481ae018, offsets=0x7f0c99c88000) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:5216
#10 0x000055836dc931bf in row_sel_store_mysql_rec (mysql_rec=0x7f0c481c7978 "\245\001", prebuilt=0x7f0c481c7f18, rec=0x7f0c9a51c07e "", vrow=0x0, rec_clust=false, index=0x7f0c481ae018, offsets=0x7f0c99c88000) at /data/src/10.4/storage/innobase/row/row0sel.cc:3158
#11 0x000055836dc98f5b in row_search_mvcc (buf=0x7f0c481c7978 "\245\001", mode=PAGE_CUR_GE, prebuilt=0x7f0c481c7f18, match_mode=1, direction=0) at /data/src/10.4/storage/innobase/row/row0sel.cc:5440
#12 0x000055836daf67fb in ha_innobase::index_read (this=0x7f0c481a8af8, buf=0x7f0c481c7978 "\245\001", key_ptr=0x7f0c99c88a50 "\320\002", key_len=8, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:9314
#13 0x000055836d7bfe88 in handler::index_read_map (this=0x7f0c481a8af8, buf=0x7f0c481c7978 "\245\001", key=0x7f0c99c88a50 "\320\002", keypart_map=18446744073709551615, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.h:3594
#14 0x000055836d7b1eda in handler::ha_index_read_map (this=0x7f0c481a8af8, buf=0x7f0c481c7978 "\245\001", key=0x7f0c99c88a50 "\320\002", keypart_map=18446744073709551615, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.cc:3039
#15 0x000055836d7bb10b in check_duplicate_long_entry_key (table=0x7f0c481a7830, h=0x7f0c481a8af8, new_rec=0x7f0c481a86a0 "\375\001", key_no=0) at /data/src/10.4/sql/handler.cc:6516
#16 0x000055836d7bb6fa in check_duplicate_long_entries (table=0x7f0c481a7830, h=0x7f0c481a8af8, new_rec=0x7f0c481a86a0 "\375\001") at /data/src/10.4/sql/handler.cc:6584
#17 0x000055836d7bba08 in handler::ha_write_row (this=0x7f0c481a8af8, buf=0x7f0c481a86a0 "\375\001") at /data/src/10.4/sql/handler.cc:6664
#18 0x000055836d555ee0 in copy_data_between_tables (thd=0x7f0c48000b00, from=0x7f0c4804af60, to=0x7f0c481a7830, create=..., ignore=false, order_num=0, order=0x0, copied=0x7f0c99c89800, deleted=0x7f0c99c89808, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f0c99c8a0e0) at /data/src/10.4/sql/sql_table.cc:10647
#19 0x000055836d553e85 in mysql_alter_table (thd=0x7f0c48000b00, new_db=0x7f0c48005290, new_name=0x7f0c48005690, create_info=0x7f0c99c8acd0, table_list=0x7f0c480155b0, alter_info=0x7f0c99c8ac10, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:10076
#20 0x000055836d5e1a96 in Sql_cmd_alter_table::execute (this=0x7f0c48015d28, thd=0x7f0c48000b00) at /data/src/10.4/sql/sql_alter.cc:499
#21 0x000055836d472dde in mysql_execute_command (thd=0x7f0c48000b00) at /data/src/10.4/sql/sql_parse.cc:6346
#22 0x000055836d477f86 in mysql_parse (thd=0x7f0c48000b00, rawbuf=0x7f0c480154a8 "ALTER TABLE t1 ADD PRIMARY KEY USING HASH (pk)", length=46, parser_state=0x7f0c99c8c180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8157
#23 0x000055836d463674 in dispatch_command (command=COM_QUERY, thd=0x7f0c48000b00, packet=0x7f0c4813a181 "ALTER TABLE t1 ADD PRIMARY KEY USING HASH (pk)", packet_length=46, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
#24 0x000055836d461e48 in do_command (thd=0x7f0c48000b00) at /data/src/10.4/sql/sql_parse.cc:1358
#25 0x000055836d5db9ab in do_handle_one_connection (connect=0x55836fb4dd10) at /data/src/10.4/sql/sql_connect.cc:1399
#26 0x000055836d5db71c in handle_one_connection (arg=0x55836fb4dd10) at /data/src/10.4/sql/sql_connect.cc:1302
#27 0x000055836dad23fd in pfs_spawn_thread (arg=0x55836fb93b80) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#28 0x00007f0ca263a494 in start_thread (arg=0x7f0c99c8d700) at pthread_create.c:333
#29 0x00007f0ca0a2093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

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