[MDEV-14824] Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view Created: 2017-12-30  Updated: 2018-08-31  Resolved: 2018-01-11

Status: Closed
Project: MariaDB Server
Component/s: Sequences, Storage Engine - InnoDB
Affects Version/s: 10.3.0
Fix Version/s: 10.3.4

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

Issue Links:
PartOf
is part of MDEV-10139 Support for SEQUENCE objects Closed
Problem/Incident
is caused by MDEV-10139 Support for SEQUENCE objects Closed

 Description   

--source include/have_innodb.inc
 
CREATE OR REPLACE TEMPORARY SEQUENCE seq ENGINE=InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
 
# Cleanup
COMMIT;
DROP SEQUENCE seq;

10.3 1761e382088

mysqld: /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350: int innobase_start_trx_and_assign_read_view(handlerton*, THD*): Assertion `!trx_is_started(trx)' failed.
171231  0:39:53 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fb562b05ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055c61fef9917 in innobase_start_trx_and_assign_read_view (hton=0x55c623615350, thd=0x7fb508000b00) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350
#9  0x000055c61fbd36bc in snapshot_handlerton (thd=0x7fb508000b00, plugin=0x7fb508035970, arg=0x7fb55c11247e) at /data/src/10.3/sql/handler.cc:2346
#10 0x000055c61f91c52b in plugin_foreach_with_mask (thd=0x7fb508000b00, func=0x55c61fbd3663 <snapshot_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=8, arg=0x7fb55c11247e) at /data/src/10.3/sql/sql_plugin.cc:2429
#11 0x000055c61fbd3729 in ha_start_consistent_snapshot (thd=0x7fb508000b00) at /data/src/10.3/sql/handler.cc:2365
#12 0x000055c61fa67931 in trans_begin (thd=0x7fb508000b00, flags=1) at /data/src/10.3/sql/transaction.cc:277
#13 0x000055c61f907eaf in mysql_execute_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:5737
#14 0x000055c61f90e53a in mysql_parse (thd=0x7fb508000b00, rawbuf=0x7fb508014b58 "START TRANSACTION WITH CONSISTENT SNAPSHOT", length=42, parser_state=0x7fb55c113610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7966
#15 0x000055c61f8fbeaf in dispatch_command (command=COM_QUERY, thd=0x7fb508000b00, packet=0x7fb50800b061 "START TRANSACTION WITH CONSISTENT SNAPSHOT", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1824
#16 0x000055c61f8fa8e3 in do_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:1369
#17 0x000055c61fa5435a in do_handle_one_connection (connect=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1420
#18 0x000055c61fa540e7 in handle_one_connection (arg=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1326
#19 0x000055c61fee11e6 in pfs_spawn_thread (arg=0x55c623b672a0) at /data/src/10.3/storage/perfschema/pfs.cc:1863
#20 0x00007fb5647dc494 in start_thread (arg=0x7fb55c114700) at pthread_create.c:333
#21 0x00007fb562bc293f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Marko Mäkelä [ 2018-01-11 ]

The CREATE SEQUENCE starts two transactions. The first one is an internal one, inside row_table_add_foreign_constraints() executed inside ha_innobase::create().

The problem is the second transaction that CREATE SEQUENCE is creating, for inserting the initial value, in row_insert_for_mysql(). Because the table should internally skip any transactional processing, that transaction should not have been started in the first place. Because this transaction will not be committed, the assertion in START TRANSACTION WITH CONSISTENT SNAPSHOT will fail. I think that in all other places, InnoDB does the questionable trx_start_if_not_started_xa_low().

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