[MDEV-21576] Assertion `table->vers_start != table->vers_end' or other ones failed in row_insert_for_mysql Created: 2020-01-27  Updated: 2023-10-06

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Versioned Tables, Virtual Columns
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: trx-versioning

Issue Links:
Relates
relates to MDEV-16226 TRX_ID-based System Versioning refact... Stalled

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 ( 
    pk INT AUTO_INCREMENT,
    a INT,
    b BINARY(100),
    c INT AS (a) VIRTUAL,
    d BINARY(100) AS (b) VIRTUAL,
    e INT,
    f INT,
    row_start BIGINT UNSIGNED AS ROW START,
    row_end BIGINT UNSIGNED AS ROW END,
    PRIMARY KEY(pk),
    KEY(b(64)),
    PERIOD FOR SYSTEM_TIME(row_start,row_end)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
INSERT INTO t1 () VALUES (),();
 
SET STATEMENT system_versioning_alter_history=KEEP FOR ALTER TABLE t1 DROP f;
INSERT INTO t1 () VALUES ();
 
# Cleanup
DROP TABLE t1;

10.4 8a931e4d

mysqld: /data/src/10.4/storage/innobase/row/row0mysql.cc:1423: dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t): Assertion `table->vers_start != table->vers_end' failed.
200127 14:06:44 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f8d3ec9bf12 in __GI___assert_fail (assertion=0x559e904d0ae0 "table->vers_start != table->vers_end", file=0x559e904cfef8 "/data/src/10.4/storage/innobase/row/row0mysql.cc", line=1423, function=0x559e904d4120 <row_insert_for_mysql(unsigned char const*, row_prebuilt_t*, ins_mode_t)::__PRETTY_FUNCTION__> "dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t)") at assert.c:101
#8  0x0000559e8fc9301f in row_insert_for_mysql (mysql_rec=0x7f8cf01a15b0 "\377\003", prebuilt=0x7f8cf0189e18, ins_mode=ROW_INS_VERSIONED) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1423
#9  0x0000559e8faed768 in ha_innobase::write_row (this=0x7f8cf019dfd8, record=0x7f8cf01a15b0 "\377\003") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8035
#10 0x0000559e8f8b0fc4 in handler::ha_write_row (this=0x7f8cf019dfd8, buf=0x7f8cf01a15b0 "\377\003") at /data/src/10.4/sql/handler.cc:6675
#11 0x0000559e8f4f6c3c in write_record (thd=0x7f8cf0000af0, table=0x7f8cf01a7110, info=0x7f8d3806b490) at /data/src/10.4/sql/sql_insert.cc:2056
#12 0x0000559e8f4f3ba7 in mysql_insert (thd=0x7f8cf0000af0, table_list=0x7f8cf0013280, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:1078
#13 0x0000559e8f5420d3 in mysql_execute_command (thd=0x7f8cf0000af0) at /data/src/10.4/sql/sql_parse.cc:4529
#14 0x0000559e8f54e85d in mysql_parse (thd=0x7f8cf0000af0, rawbuf=0x7f8cf0013198 "INSERT INTO t1 () VALUES ()", length=27, parser_state=0x7f8d3806c160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
#15 0x0000559e8f539a2a in dispatch_command (command=COM_QUERY, thd=0x7f8cf0000af0, packet=0x7f8cf01376f1 "INSERT INTO t1 () VALUES ()", packet_length=27, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#16 0x0000559e8f5380b7 in do_command (thd=0x7f8cf0000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#17 0x0000559e8f6c10df in do_handle_one_connection (connect=0x559e9239bf60) at /data/src/10.4/sql/sql_connect.cc:1412
#18 0x0000559e8f6c0e2e in handle_one_connection (arg=0x559e9239bf60) at /data/src/10.4/sql/sql_connect.cc:1316
#19 0x0000559e900c93cd in pfs_spawn_thread (arg=0x559e923a4070) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#20 0x00007f8d40c244a4 in start_thread (arg=0x7f8d3806d700) at pthread_create.c:456
#21 0x00007f8d3ed58d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.4-10.5.
Not reproducible on 10.3.
No obvious effect on a non-debug build.



 Comments   
Comment by Elena Stepanova [ 2020-01-27 ]

Another assertion, similar test case (probably can be simplified further):

--source include/have_innodb.inc
 
CREATE TABLE t1 ( 
    pk INT AUTO_INCREMENT,
    a TIME,
    b BINARY(100),
    c YEAR AS (f) VIRTUAL,
    d DATE,
    e INT,
    f YEAR,
    g TIME AS (a) VIRTUAL,
    h BINARY(100) AS (b) VIRTUAL,
    i INTEGER,
    j INTEGER,
    row_start BIGINT UNSIGNED AS ROW START,
    row_end BIGINT UNSIGNED AS ROW END,
    PRIMARY KEY(pk),
    KEY (b(64)),
    PERIOD FOR SYSTEM_TIME(row_start,row_end)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
INSERT INTO t1 () VALUES (),();
 
SET STATEMENT system_versioning_alter_history=KEEP FOR ALTER TABLE t1 DROP j;
INSERT INTO t1 () VALUES ();
 
# Cleanup
DROP TABLE t1;

mysqld: /data/src/10.4/storage/innobase/row/row0mysql.cc:1426: dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t): Assertion `t' failed.
200127 14:44:23 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f93a0f26f12 in __GI___assert_fail (assertion=0x5560b362cb05 "t", file=0x5560b362bef8 "/data/src/10.4/storage/innobase/row/row0mysql.cc", line=1426, function=0x5560b3630120 <row_insert_for_mysql(unsigned char const*, row_prebuilt_t*, ins_mode_t)::__PRETTY_FUNCTION__> "dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t)") at assert.c:101
#8  0x00005560b2def0bf in row_insert_for_mysql (mysql_rec=0x7f934814ccc0 "\377\377\003", prebuilt=0x7f934818dc88, ins_mode=ROW_INS_VERSIONED) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1426
#9  0x00005560b2c49768 in ha_innobase::write_row (this=0x7f934800a5b8, record=0x7f934814ccc0 "\377\377\003") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8035
#10 0x00005560b2a0cfc4 in handler::ha_write_row (this=0x7f934800a5b8, buf=0x7f934814ccc0 "\377\377\003") at /data/src/10.4/sql/handler.cc:6675
#11 0x00005560b2652c3c in write_record (thd=0x7f9348000af0, table=0x7f934814be50, info=0x7f939c09d490) at /data/src/10.4/sql/sql_insert.cc:2056
#12 0x00005560b264fba7 in mysql_insert (thd=0x7f9348000af0, table_list=0x7f9348013280, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:1078
#13 0x00005560b269e0d3 in mysql_execute_command (thd=0x7f9348000af0) at /data/src/10.4/sql/sql_parse.cc:4529
#14 0x00005560b26aa85d in mysql_parse (thd=0x7f9348000af0, rawbuf=0x7f9348013198 "INSERT INTO t1 () VALUES ()", length=27, parser_state=0x7f939c09e160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
#15 0x00005560b2695a2a in dispatch_command (command=COM_QUERY, thd=0x7f9348000af0, packet=0x7f9348137521 "INSERT INTO t1 () VALUES ()", packet_length=27, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#16 0x00005560b26940b7 in do_command (thd=0x7f9348000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#17 0x00005560b281d0df in do_handle_one_connection (connect=0x5560b4fec8e0) at /data/src/10.4/sql/sql_connect.cc:1412
#18 0x00005560b281ce2e in handle_one_connection (arg=0x5560b4fec8e0) at /data/src/10.4/sql/sql_connect.cc:1316
#19 0x00005560b32253cd in pfs_spawn_thread (arg=0x5560b4f58fb0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#20 0x00007f93a2eaf4a4 in start_thread (arg=0x7f939c09f700) at pthread_create.c:456
#21 0x00007f93a0fe3d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Same notes about versions apply.

Comment by Elena Stepanova [ 2020-01-27 ]

Another assertion, similar test case

--source include/have_innodb.inc
 
CREATE TABLE t1 ( 
    pk INT AUTO_INCREMENT,
    a TIME,
    b BINARY(100),
    c YEAR AS (d) VIRTUAL,
    d YEAR,
    e TIME(1) AS (a) VIRTUAL,
    f BINARY(100) AS (b) VIRTUAL,
    g INTEGER,
    h INTEGER,
    row_start BIGINT UNSIGNED AS ROW START,
    row_end BIGINT UNSIGNED AS ROW END,
    i INTEGER,
    PRIMARY KEY(pk),
    KEY (b(64)),
    PERIOD FOR SYSTEM_TIME(row_start,row_end)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;
 
INSERT INTO t1 () VALUES (),();
SET STATEMENT system_versioning_alter_history=KEEP FOR ALTER TABLE t1 DROP h;
INSERT INTO t1 () VALUES ();
 
# Cleanup
DROP TABLE t1;

mysqld: /data/src/10.4/storage/innobase/row/row0mysql.cc:1427: dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t): Assertion `t->mysql_col_len == 8' failed.
200127 15:20:14 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f49959bbf12 in __GI___assert_fail (assertion=0x558229c7eb07 "t->mysql_col_len == 8", file=0x558229c7def8 "/data/src/10.4/storage/innobase/row/row0mysql.cc", line=1427, function=0x558229c82120 <row_insert_for_mysql(unsigned char const*, row_prebuilt_t*, ins_mode_t)::__PRETTY_FUNCTION__> "dberr_t row_insert_for_mysql(const byte*, row_prebuilt_t*, ins_mode_t)") at assert.c:101
#8  0x000055822944113d in row_insert_for_mysql (mysql_rec=0x7f49441897e0 "\377\377\003", prebuilt=0x7f494419ec58, ins_mode=ROW_INS_VERSIONED) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1427
#9  0x000055822929b768 in ha_innobase::write_row (this=0x7f49441aca98, record=0x7f49441897e0 "\377\377\003") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8035
#10 0x000055822905efc4 in handler::ha_write_row (this=0x7f49441aca98, buf=0x7f49441897e0 "\377\377\003") at /data/src/10.4/sql/handler.cc:6675
#11 0x0000558228ca4c3c in write_record (thd=0x7f4944000af0, table=0x7f49441abc30, info=0x7f498ad66490) at /data/src/10.4/sql/sql_insert.cc:2056
#12 0x0000558228ca1ba7 in mysql_insert (thd=0x7f4944000af0, table_list=0x7f4944013280, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:1078
#13 0x0000558228cf00d3 in mysql_execute_command (thd=0x7f4944000af0) at /data/src/10.4/sql/sql_parse.cc:4529
#14 0x0000558228cfc85d in mysql_parse (thd=0x7f4944000af0, rawbuf=0x7f4944013198 "INSERT INTO t1 () VALUES ()", length=27, parser_state=0x7f498ad67160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
#15 0x0000558228ce7a2a in dispatch_command (command=COM_QUERY, thd=0x7f4944000af0, packet=0x7f4944137281 "INSERT INTO t1 () VALUES ()", packet_length=27, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#16 0x0000558228ce60b7 in do_command (thd=0x7f4944000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#17 0x0000558228e6f0df in do_handle_one_connection (connect=0x55822be13580) at /data/src/10.4/sql/sql_connect.cc:1412
#18 0x0000558228e6ee2e in handle_one_connection (arg=0x55822be13580) at /data/src/10.4/sql/sql_connect.cc:1316
#19 0x00005582298773cd in pfs_spawn_thread (arg=0x55822bd7fc50) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#20 0x00007f49979444a4 in start_thread (arg=0x7f498ad68700) at pthread_create.c:456
#21 0x00007f4995a78d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Same notes about versions apply.

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