[MDEV-21428] InnoDB: Failing assertion: prebuilt->template_type == ROW_MYSQL_WHOLE_ROW upon DELETE from temporary app-versioned table via trigger Created: 2020-01-06  Updated: 2021-07-15

Status: Confirmed
Project: MariaDB Server
Component/s: Data Definition - Temporary, Storage Engine - InnoDB, Triggers, Versioned Tables
Affects Version/s: 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
Relates
relates to MDEV-21427 Application-time period table can be ... Open
relates to MDEV-26152 Assertion: prebuilt->template_type ==... Confirmed

 Description   

Note: Since I couldn't get rid of the temporary table in the scenario, it will become invalid when MDEV-21427 is fixed; but before closing it as not reproducible anymore or as a duplicate, please make sure that it's indeed just a side-effect of MDEV-21427 and doesn't have another underlying cause which will be masked by ER_PERIOD_TEMPORARY_NOT_ALLOWED.

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT, s DATE, e DATE, PERIOD FOR app(s,e)) ENGINE=InnoDB;
CREATE TEMPORARY TABLE tmp LIKE t1;
INSERT INTO tmp VALUES (1,'2001-01-01','2001-12-31');
INSERT INTO t1 VALUES (2,'2002-01-01','2002-12-31');
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SELECT a INTO @a FROM tmp LIMIT 1;
CREATE TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM tmp LIMIT 1;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--error ER_CONSTRAINT_FAILED
INSERT INTO t1 VALUES (3,'2003-01-01','2003-01-01');
INSERT INTO t1 SELECT * FROM t1;
 
# Cleanup
DROP TABLE t1;

10.4 9d036f84

2020-01-06 16:53:11 0x7f142d493700  InnoDB: Assertion failure in file /data/src/10.4/storage/innobase/row/row0mysql.cc line 1807
InnoDB: Failing assertion: prebuilt->template_type == ROW_MYSQL_WHOLE_ROW
 
#6  0x00005618bc9efdd4 in ut_dbg_assertion_failed (expr=0x5618bd14a2d8 "prebuilt->template_type == ROW_MYSQL_WHOLE_ROW", file=0x5618bd1494b8 "/data/src/10.4/storage/innobase/row/row0mysql.cc", line=1807) at /data/src/10.4/storage/innobase/ut/ut0dbg.cc:60
#7  0x00005618bc90dcd5 in row_update_for_mysql (prebuilt=0x7f13d81b1948) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1807
#8  0x00005618bc76aea2 in ha_innobase::delete_row (this=0x7f13d81afd68, record=0x7f13d8077a80 "\377") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8972
#9  0x00005618bc52c68e in handler::ha_delete_row (this=0x7f13d81afd68, buf=0x7f13d8077a80 "\377") at /data/src/10.4/sql/handler.cc:6783
#10 0x00005618bc6e6ce7 in TABLE::delete_row (this=0x7f13d81aef00) at /data/src/10.4/sql/sql_delete.cc:289
#11 0x00005618bc6e3aa0 in mysql_delete (thd=0x7f13d8000af0, table_list=0x7f13d81a9b00, conds=0x0, order_list=0x7f13d81ab998, limit=1, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:804
#12 0x00005618bc1beb52 in mysql_execute_command (thd=0x7f13d8000af0) at /data/src/10.4/sql/sql_parse.cc:4728
#13 0x00005618bc0ccb30 in sp_instr_stmt::exec_core (this=0x7f13d81aa258, thd=0x7f13d8000af0, nextp=0x7f142d4904e4) at /data/src/10.4/sql/sp_head.cc:3668
#14 0x00005618bc0cbf05 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f13d81aa2a0, thd=0x7f13d8000af0, nextp=0x7f142d4904e4, open_tables=false, instr=0x7f13d81aa258) at /data/src/10.4/sql/sp_head.cc:3400
#15 0x00005618bc0cc6f4 in sp_instr_stmt::execute (this=0x7f13d81aa258, thd=0x7f13d8000af0, nextp=0x7f142d4904e4) at /data/src/10.4/sql/sp_head.cc:3574
#16 0x00005618bc0c5ded in sp_head::execute (this=0x7f13d81a8da8, thd=0x7f13d8000af0, merge_da_on_success=false) at /data/src/10.4/sql/sp_head.cc:1346
#17 0x00005618bc0c7383 in sp_head::execute_trigger (this=0x7f13d81a8da8, thd=0x7f13d8000af0, db_name=0x7f13d800b1a8, table_name=0x7f13d800b1b8, grant_info=0x7f13d8074c88) at /data/src/10.4/sql/sp_head.cc:1818
#18 0x00005618bc2bccc4 in Table_triggers_list::process_triggers (this=0x7f13d80724a8, thd=0x7f13d8000af0, event=TRG_EVENT_INSERT, time_type=TRG_ACTION_AFTER, old_row_is_record1=true) at /data/src/10.4/sql/sql_trigger.cc:2214
#19 0x00005618bc172856 in write_record (thd=0x7f13d8000af0, table=0x7f13d806fe60, info=0x7f13d80170d0) at /data/src/10.4/sql/sql_insert.cc:2073
#20 0x00005618bc1780cd in select_insert::send_data (this=0x7f13d8017088, values=...) at /data/src/10.4/sql/sql_insert.cc:3967
#21 0x00005618bc23e145 in end_send (join=0x7f13d8017138, join_tab=0x7f13d8018e88, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:21444
#22 0x00005618bc23b7d7 in evaluate_join_record (join=0x7f13d8017138, join_tab=0x7f13d8018ae0, error=0) at /data/src/10.4/sql/sql_select.cc:20475
#23 0x00005618bc251f4c in AGGR_OP::end_send (this=0x7f13d8019110) at /data/src/10.4/sql/sql_select.cc:28544
#24 0x00005618bc23ab26 in sub_select_postjoin_aggr (join=0x7f13d8017138, join_tab=0x7f13d8018ae0, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:19969
#25 0x00005618bc23ae89 in sub_select (join=0x7f13d8017138, join_tab=0x7f13d8018738, end_of_records=true) at /data/src/10.4/sql/sql_select.cc:20204
#26 0x00005618bc23a5b2 in do_select (join=0x7f13d8017138, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19795
#27 0x00005618bc20f72f in JOIN::exec_inner (this=0x7f13d8017138) at /data/src/10.4/sql/sql_select.cc:4452
#28 0x00005618bc20e86c in JOIN::exec (this=0x7f13d8017138) at /data/src/10.4/sql/sql_select.cc:4234
#29 0x00005618bc20ff81 in mysql_select (thd=0x7f13d8000af0, tables=0x7f13d8013f08, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925888, result=0x7f13d8017088, unit=0x7f13d8004a18, select_lex=0x7f13d8013948) at /data/src/10.4/sql/sql_select.cc:4666
#30 0x00005618bc1ffb32 in handle_select (thd=0x7f13d8000af0, lex=0x7f13d8004958, result=0x7f13d8017088, setup_tables_done_option=1073741824) at /data/src/10.4/sql/sql_select.cc:420
#31 0x00005618bc1be56a in mysql_execute_command (thd=0x7f13d8000af0) at /data/src/10.4/sql/sql_parse.cc:4643
#32 0x00005618bc1ca3b7 in mysql_parse (thd=0x7f13d8000af0, rawbuf=0x7f13d8013198 "INSERT INTO t1 SELECT * FROM t1", length=31, parser_state=0x7f142d492160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
#33 0x00005618bc1b555c in dispatch_command (command=COM_QUERY, thd=0x7f13d8000af0, packet=0x7f13d8137281 "INSERT INTO t1 SELECT * FROM t1", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#34 0x00005618bc1b3be9 in do_command (thd=0x7f13d8000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#35 0x00005618bc33cb5f in do_handle_one_connection (connect=0x5618bf3ed8e0) at /data/src/10.4/sql/sql_connect.cc:1412
#36 0x00005618bc33c8ae in handle_one_connection (arg=0x5618bf3ed8e0) at /data/src/10.4/sql/sql_connect.cc:1316
#37 0x00005618bcd42035 in pfs_spawn_thread (arg=0x5618bf359fb0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#38 0x00007f143604a4a4 in start_thread (arg=0x7f142d493700) at pthread_create.c:456
#39 0x00007f143417ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible with 10.4 and 10.5.
Both debug and non-debug builds are affected.
Both debug


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