[MDEV-18173] Assertion `o->ind == vers_end' or `o->ind == vers_start' failed in dict_table_t::instant_column Created: 2019-01-08  Updated: 2019-01-25  Resolved: 2019-01-15

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB, Versioned Tables, Virtual Columns
Affects Version/s: 10.4
Fix Version/s: 10.4.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-18121 Assertion `type.vers_sys_end()' faile... Closed
Relates
relates to MDEV-17697 Broken versioning info after instant ... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (
  pk INTEGER,
  a INT,
  b INT,
  v INT AS (a),
  PRIMARY KEY (pk)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
SET system_versioning_alter_history= KEEP;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DROP COLUMN b;
 
# Cleanup
DROP TABLE t1;

10.4 30da40bb8c30

mysqld: /data/src/10.4/storage/innobase/handler/handler0alter.cc:546: bool dict_table_t::instant_column(const dict_table_t&, const ulint*): Assertion `o->ind == vers_end' failed.
190109  0:35:10 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fb8517b7ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055b846cb936c in dict_table_t::instant_column (this=0x7fb7f804b018, table=..., col_map=0x7fb7f805f9d0) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:546
#9  0x000055b846cbbe1d in ha_innobase_inplace_ctx::instant_column (this=0x7fb7f8016e90) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:1080
#10 0x000055b846ca1ecd in innobase_instant_try (ha_alter_info=0x7fb84c147bc0, ctx=0x7fb7f8016e90, altered_table=0x7fb7f805c550, table=0x7fb7f804b9a0, trx=0x7fb847400218) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:5471
#11 0x000055b846cbe5d3 in commit_try_norebuild (ha_alter_info=0x7fb84c147bc0, ctx=0x7fb7f8016e90, altered_table=0x7fb7f805c550, old_table=0x7fb7f804b9a0, trx=0x7fb847400218, table_name=0x7fb7f804e32d "t1") at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10138
#12 0x000055b846cb0e98 in ha_innobase::commit_inplace_alter_table (this=0x7fb7f81324d8, altered_table=0x7fb7f805c550, ha_alter_info=0x7fb84c147bc0, commit=true) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10767
#13 0x000055b84694136c in handler::ha_commit_inplace_alter_table (this=0x7fb7f81324d8, altered_table=0x7fb7f805c550, ha_alter_info=0x7fb84c147bc0, commit=true) at /data/src/10.4/sql/handler.cc:4492
#14 0x000055b846700c1e in mysql_inplace_alter_table (thd=0x7fb7f8000b00, table_list=0x7fb7f8015080, table=0x7fb7f804b9a0, altered_table=0x7fb7f805c550, ha_alter_info=0x7fb84c147bc0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7fb84c147cf0, alter_ctx=0x7fb84c1488e0) at /data/src/10.4/sql/sql_table.cc:7590
#15 0x000055b846706a7f in mysql_alter_table (thd=0x7fb7f8000b00, new_db=0x7fb7f80051c8, new_name=0x7fb7f8005598, create_info=0x7fb84c1494d0, table_list=0x7fb7f8015080, alter_info=0x7fb84c149410, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9690
#16 0x000055b8467910fd in Sql_cmd_alter_table::execute (this=0x7fb7f80156e8, thd=0x7fb7f8000b00) at /data/src/10.4/sql/sql_alter.cc:497
#17 0x000055b84662e398 in mysql_execute_command (thd=0x7fb7f8000b00) at /data/src/10.4/sql/sql_parse.cc:6302
#18 0x000055b8466332c4 in mysql_parse (thd=0x7fb7f8000b00, rawbuf=0x7fb7f8014f98 "ALTER TABLE t1 DROP COLUMN b", length=28, parser_state=0x7fb84c14a600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#19 0x000055b8466204ee in dispatch_command (command=COM_QUERY, thd=0x7fb7f8000b00, packet=0x7fb7f8137fd1 "ALTER TABLE t1 DROP COLUMN b", packet_length=28, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#20 0x000055b84661ef12 in do_command (thd=0x7fb7f8000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#21 0x000055b84678b140 in do_handle_one_connection (connect=0x55b84a5e54c0) at /data/src/10.4/sql/sql_connect.cc:1402
#22 0x000055b84678aec4 in handle_one_connection (arg=0x55b84a5e54c0) at /data/src/10.4/sql/sql_connect.cc:1308
#23 0x000055b846c4a308 in pfs_spawn_thread (arg=0x55b84a5e0460) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#24 0x00007fb853273494 in start_thread (arg=0x7fb84c14b700) at pthread_create.c:333
#25 0x00007fb85187493f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible on 10.3.



 Comments   
Comment by Elena Stepanova [ 2019-01-13 ]

A variation of the test case which causes a similar yet slightly different failure:

--source include/have_innodb.inc
 
CREATE TABLE t1 (
  pk INTEGER,
  a INT,
  b INT,
  v1 INT AS (a),
  v2 INT AS (b) PERSISTENT,
  PRIMARY KEY (pk)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
SET system_versioning_alter_history= KEEP;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DROP COLUMN v2;
 
# Cleanup
DROP TABLE t1;

10.4 301bd62b25

mysqld: /data/src/10.4/storage/innobase/handler/handler0alter.cc:543: bool dict_table_t::instant_column(const dict_table_t&, const ulint*): Assertion `o->ind == vers_start' failed.
190113 12:58:58 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fd878bf8ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005654473ba6f0 in dict_table_t::instant_column (this=0x7fd82004c278, table=..., col_map=0x7fd820060898) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:543
#9  0x00005654473bd259 in ha_innobase_inplace_ctx::instant_column (this=0x7fd820017088) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:1080
#10 0x00005654473a32e9 in innobase_instant_try (ha_alter_info=0x7fd86df08bc0, ctx=0x7fd820017088, altered_table=0x7fd82005da00, table=0x7fd820043470, trx=0x7fd86e9f3258) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:5471
#11 0x00005654473bfa0f in commit_try_norebuild (ha_alter_info=0x7fd86df08bc0, ctx=0x7fd820017088, altered_table=0x7fd82005da00, old_table=0x7fd820043470, trx=0x7fd86e9f3258, table_name=0x7fd820190bfd "t1") at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10138
#12 0x00005654473b22d4 in ha_innobase::commit_inplace_alter_table (this=0x7fd820190e78, altered_table=0x7fd82005da00, ha_alter_info=0x7fd86df08bc0, commit=true) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10767
#13 0x0000565447041cf4 in handler::ha_commit_inplace_alter_table (this=0x7fd820190e78, altered_table=0x7fd82005da00, ha_alter_info=0x7fd86df08bc0, commit=true) at /data/src/10.4/sql/handler.cc:4492
#14 0x0000565446e0151c in mysql_inplace_alter_table (thd=0x7fd820000b00, table_list=0x7fd820015080, table=0x7fd820043470, altered_table=0x7fd82005da00, ha_alter_info=0x7fd86df08bc0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7fd86df08cf0, alter_ctx=0x7fd86df098e0) at /data/src/10.4/sql/sql_table.cc:7590
#15 0x0000565446e0737d in mysql_alter_table (thd=0x7fd820000b00, new_db=0x7fd8200051c8, new_name=0x7fd820005598, create_info=0x7fd86df0a4d0, table_list=0x7fd820015080, alter_info=0x7fd86df0a410, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9690
#16 0x0000565446e919fb in Sql_cmd_alter_table::execute (this=0x7fd8200156e8, thd=0x7fd820000b00) at /data/src/10.4/sql/sql_alter.cc:497
#17 0x0000565446d2ec96 in mysql_execute_command (thd=0x7fd820000b00) at /data/src/10.4/sql/sql_parse.cc:6302
#18 0x0000565446d33bc2 in mysql_parse (thd=0x7fd820000b00, rawbuf=0x7fd820014f98 "ALTER TABLE t1 DROP COLUMN v2", length=29, parser_state=0x7fd86df0b600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#19 0x0000565446d20dec in dispatch_command (command=COM_QUERY, thd=0x7fd820000b00, packet=0x7fd82000b421 "ALTER TABLE t1 DROP COLUMN v2", packet_length=29, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#20 0x0000565446d1f810 in do_command (thd=0x7fd820000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#21 0x0000565446e8ba3e in do_handle_one_connection (connect=0x56544ad0d000) at /data/src/10.4/sql/sql_connect.cc:1402
#22 0x0000565446e8b7c2 in handle_one_connection (arg=0x56544ad0d000) at /data/src/10.4/sql/sql_connect.cc:1308
#23 0x000056544734ac90 in pfs_spawn_thread (arg=0x56544ad07fa0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#24 0x00007fd87a8cf494 in start_thread (arg=0x7fd86df0c700) at pthread_create.c:333
#25 0x00007fd878cb593f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Comment by Marko Mäkelä [ 2019-01-14 ]

It looks like MDEV-17697 was not fully fixed.

Comment by Elena Stepanova [ 2019-01-14 ]

Here is another test case and another failure which the current version of the patch also fixes. If the patch changes, please make sure it's still fixed:

--source include/have_innodb.inc
 
CREATE TABLE t1 (
  pk INT,
  a TINYINT NOT NULL,
  b TINYINT NOT NULL,
  v TINYINT AS (a) VIRTUAL,
  PRIMARY KEY (pk),
  KEY (a)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
INSERT INTO t1 (pk, a, b) VALUES (1, 0, 0);
ALTER TABLE t1 FORCE;
ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a);
 
# Cleanup
DROP TABLE t1;

10.4 301bd62b25

mysqld: /data/src/10.4/storage/innobase/dict/dict0mem.cc:1305: bool dict_index_t::vers_history_row(const rec_t*, const ulint*): Assertion `col.vers_sys_end()' failed.
 
#7  0x00007f7570673ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000056475e31fafc in dict_index_t::vers_history_row (this=0x7f751c19a138, rec=0x7f756a19407d "\200", offsets=0x7f75699af6d0) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:1305
#9  0x000056475e31fd7d in dict_index_t::vers_history_row (this=0x7f751c0824b8, rec=0x7f756a19807d "\200\200", history_row=@0x7f75699aff60: false) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:1343
#10 0x000056475e15ccfc in row_ins_check_foreign_constraint (check_ref=1, foreign=0x7f751c078228, table=0x7f751c074738, entry=0x7f751c1a03e8, thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:1757
#11 0x000056475e15d45d in row_ins_check_foreign_constraints (table=0x7f751c074738, index=0x7f751c1950f8, entry=0x7f751c1a03e8, thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:1994
#12 0x000056475e160e62 in row_ins_sec_index_entry (index=0x7f751c1950f8, entry=0x7f751c1a03e8, thr=0x7f751c19c398, dup_chk_only=false) at /data/src/10.4/storage/innobase/row/row0ins.cc:3303
#13 0x000056475e161175 in row_ins_index_entry (index=0x7f751c1950f8, entry=0x7f751c1a03e8, thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:3379
#14 0x000056475e16182f in row_ins_index_entry_step (node=0x7f751c19c0b8, thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:3545
#15 0x000056475e161c63 in row_ins (node=0x7f751c19c0b8, thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:3688
#16 0x000056475e16246c in row_ins_step (thr=0x7f751c19c398) at /data/src/10.4/storage/innobase/row/row0ins.cc:3933
#17 0x000056475e182130 in row_insert_for_mysql (mysql_rec=0x7f751c195428 "\375\001", prebuilt=0x7f751c19ba88, ins_mode=ROW_INS_NORMAL) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1460
#18 0x000056475e01e106 in ha_innobase::write_row (this=0x7f751c191928, record=0x7f751c195428 "\375\001") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8049
#19 0x000056475dcf85ec in handler::ha_write_row (this=0x7f751c191928, buf=0x7f751c195428 "\375\001") at /data/src/10.4/sql/handler.cc:6273
#20 0x000056475dabbd84 in copy_data_between_tables (thd=0x7f751c000b00, from=0x7f751c074a80, to=0x7f751c190cf0, create=..., ignore=false, order_num=0, order=0x0, copied=0x7f75699b1ad8, deleted=0x7f75699b1ae0, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f75699b28e0) at /data/src/10.4/sql/sql_table.cc:10446
#21 0x000056475dab9d29 in mysql_alter_table (thd=0x7f751c000b00, new_db=0x7f751c0051c8, new_name=0x7f751c005598, create_info=0x7f75699b34d0, table_list=0x7f751c0150b0, alter_info=0x7f75699b3410, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9875
#22 0x000056475db439fb in Sql_cmd_alter_table::execute (this=0x7f751c0158f8, thd=0x7f751c000b00) at /data/src/10.4/sql/sql_alter.cc:497
#23 0x000056475d9e0c96 in mysql_execute_command (thd=0x7f751c000b00) at /data/src/10.4/sql/sql_parse.cc:6302
#24 0x000056475d9e5bc2 in mysql_parse (thd=0x7f751c000b00, rawbuf=0x7f751c014f98 "ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a)", length=52, parser_state=0x7f75699b4600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#25 0x000056475d9d2dec in dispatch_command (command=COM_QUERY, thd=0x7f751c000b00, packet=0x7f751c00b421 "ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a)", packet_length=52, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#26 0x000056475d9d1810 in do_command (thd=0x7f751c000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#27 0x000056475db3da3e in do_handle_one_connection (connect=0x564760d19ce0) at /data/src/10.4/sql/sql_connect.cc:1402
#28 0x000056475db3d7c2 in handle_one_connection (arg=0x564760d19ce0) at /data/src/10.4/sql/sql_connect.cc:1308
#29 0x000056475dffcc90 in pfs_spawn_thread (arg=0x564760d14c80) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#30 0x00007f757234a494 in start_thread (arg=0x7f75699b5700) at pthread_create.c:333
#31 0x00007f757073093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

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