[MDEV-20666] Assertion failures prebuilt->sql_stat_start ... in row_search / index_read upon concurrent INSERT and CREATE .. SELECT Created: 2019-09-25  Updated: 2023-11-28

Status: Stalled
Project: MariaDB Server
Component/s: Data Definition - Create Table, Data Manipulation - Insert, Storage Engine - InnoDB
Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Duplicate
duplicates MDEV-14846 InnoDB: assertion on trx->state becau... Closed
duplicates MDEV-15013 [Draft] Assertion `prebuilt->sql_stat... Closed
Relates
relates to MDEV-21987 Assertion failure in file lock0lock.c... Confirmed
relates to MDEV-23101 SIGSEGV in lock_rec_unlock() when Gal... Closed
relates to MDEV-14846 InnoDB: assertion on trx->state becau... Closed
relates to MDEV-23939 Crash with mariadb 10.4: storage/inno... Closed
relates to MDEV-29120 Assertion `prebuilt->sql_stat_start |... Confirmed

 Description   

Note: The assertion failures described here look similar (although not identical) to those in MDEV-14846. However, in MDEV-14846, thiru's analysis revealed that the problem was due to the server ignoring HA_ERR_LOCK_DEADLOCK. In this case, however, there is no deadlock, so it might be a different problem. If it turns out to be the same after all, feel free to close, but please make sure that the fix is verified with all provided test cases, including this one.

Note: The test case is non-deterministic, run with --repeat=N. It fails fairly quickly for me at the moment, usually within 10 attempts on 10.2-10.4 and within 20 attempts on 5.5-10.1, but it can vary on different machines and builds. Also I recommend running with --mem, the problem is repeatable both in shm and on disk, but multiple repetitions of the test run much faster in memory.

--source include/have_innodb.inc
 
--connect (con1,localhost,root,,test)
CREATE  TABLE t1 (id INT, KEY(id)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL);
--send
INSERT INTO t1 SELECT * FROM t1;
--connection default
CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2;
 
# Cleanup
--connection con1
--reap
--disconnect con1
--connection default
DROP TABLE IF EXISTS t2, t1;

10.4 a39c4b5f

mysqld: /data/src/10.4/storage/innobase/row/row0sel.cc:4485: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)' failed.
190925 14:51:43 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f62c8a80f12 in __GI___assert_fail (assertion=0x55bc3186ab10 "prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)", file=0x55bc31869828 "/data/src/10.4/storage/innobase/row/row0sel.cc", line=4485, function=0x55bc3186dd40 <row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:101
#8  0x000055bc31084b8b in row_search_mvcc (buf=0x7f6270081a40 "\377", mode=PAGE_CUR_GE, prebuilt=0x7f62701a6ed8, match_mode=0, direction=0) at /data/src/10.4/storage/innobase/row/row0sel.cc:4485
#9  0x000055bc30e9c870 in ha_innobase::index_read (this=0x7f627000ac08, buf=0x7f6270081a40 "\377", key_ptr=0x7f62701ab2f8 "", key_len=5, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:9306
#10 0x000055bc30c61fdc in handler::index_read_map (this=0x7f627000ac08, buf=0x7f6270081a40 "\377", key=0x7f62701ab2f8 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.4/sql/handler.h:3599
#11 0x000055bc30c522ec in handler::ha_index_read_map (this=0x7f627000ac08, buf=0x7f6270081a40 "\377", key=0x7f62701ab2f8 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.4/sql/handler.cc:2883
#12 0x000055bc30c5abee in handler::read_range_first (this=0x7f627000ac08, start_key=0x7f62bde2cd10, end_key=0x7f62bde2cd30, eq_range_arg=false, sorted=true) at /data/src/10.4/sql/handler.cc:5831
#13 0x000055bc30de36c8 in QUICK_RANGE_SELECT::get_next_prefix (this=0x7f627014f780, prefix_length=5, group_key_parts=1, cur_prefix=0x0) at /data/src/10.4/sql/opt_range.cc:12253
#14 0x000055bc30dea52f in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7f6270143600) at /data/src/10.4/sql/opt_range.cc:15087
#15 0x000055bc30de9d65 in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7f6270143600) at /data/src/10.4/sql/opt_range.cc:14829
#16 0x000055bc30df6819 in rr_quick (info=0x7f6270017c88) at /data/src/10.4/sql/records.cc:361
#17 0x000055bc30840287 in READ_RECORD::read_record (this=0x7f6270017c88) at /data/src/10.4/sql/records.h:69
#18 0x000055bc309719d7 in join_init_read_record (tab=0x7f6270017bc0) at /data/src/10.4/sql/sql_select.cc:21129
#19 0x000055bc3096f5ba in sub_select (join=0x7f62700155a8, join_tab=0x7f6270017bc0, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20185
#20 0x000055bc3096eaab in do_select (join=0x7f62700155a8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19726
#21 0x000055bc30943c17 in JOIN::exec_inner (this=0x7f62700155a8) at /data/src/10.4/sql/sql_select.cc:4386
#22 0x000055bc30942d54 in JOIN::exec (this=0x7f62700155a8) at /data/src/10.4/sql/sql_select.cc:4168
#23 0x000055bc30944469 in mysql_select (thd=0x7f6270000b00, tables=0x7f6270014050, wild_num=0, fields=..., conds=0x7f6270014960, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184065, result=0x7f62700154b0, unit=0x7f6270004a30, select_lex=0x7f6270013a88) at /data/src/10.4/sql/sql_select.cc:4600
#24 0x000055bc309343ec in handle_select (thd=0x7f6270000b00, lex=0x7f6270004968, result=0x7f62700154b0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
#25 0x000055bc309e65cb in Sql_cmd_create_table_like::execute (this=0x7f6270013370, thd=0x7f6270000b00) at /data/src/10.4/sql/sql_table.cc:11384
#26 0x000055bc308f997b in mysql_execute_command (thd=0x7f6270000b00) at /data/src/10.4/sql/sql_parse.cc:6094
#27 0x000055bc308ff04f in mysql_parse (thd=0x7f6270000b00, rawbuf=0x7f6270013280 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", length=67, parser_state=0x7f62bde2e170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7912
#28 0x000055bc308ea2e2 in dispatch_command (command=COM_QUERY, thd=0x7f6270000b00, packet=0x7f627019dc51 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
#29 0x000055bc308e896f in do_command (thd=0x7f6270000b00) at /data/src/10.4/sql/sql_parse.cc:1359
#30 0x000055bc30a6fdef in do_handle_one_connection (connect=0x55bc34cb57c0) at /data/src/10.4/sql/sql_connect.cc:1412
#31 0x000055bc30a6fb3e in handle_one_connection (arg=0x55bc34cb57c0) at /data/src/10.4/sql/sql_connect.cc:1316
#32 0x000055bc3146f2ed in pfs_spawn_thread (arg=0x55bc34c34120) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#33 0x00007f62ca5f54a4 in start_thread (arg=0x7f62bde2f700) at pthread_create.c:456
#34 0x00007f62c8b3dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.3 b6bb64e5 (same as on 10.4)

mysqld: /data/src/10.3/storage/innobase/row/row0sel.cc:4503: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)' failed.
190925 14:53:00 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f5331d03f12 in __GI___assert_fail (assertion=0x56272ec30860 "prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)", file=0x56272ec2f550 "/data/src/10.3/storage/innobase/row/row0sel.cc", line=4503, function=0x56272ec33c80 <row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:101
#8  0x000056272e4b2dc3 in row_search_mvcc (buf=0x7f52e0006af0 "\377", mode=PAGE_CUR_GE, prebuilt=0x7f52e0160698, match_mode=0, direction=0) at /data/src/10.3/storage/innobase/row/row0sel.cc:4503
#9  0x000056272e2d9d1e in ha_innobase::index_read (this=0x7f52e015fee8, buf=0x7f52e0006af0 "\377", key_ptr=0x7f52e0181d78 "", key_len=5, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9316
#10 0x000056272e0bbe08 in handler::index_read_map (this=0x7f52e015fee8, buf=0x7f52e0006af0 "\377", key=0x7f52e0181d78 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.3/sql/handler.h:3474
#11 0x000056272e0adace in handler::ha_index_read_map (this=0x7f52e015fee8, buf=0x7f52e0006af0 "\377", key=0x7f52e0181d78 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.3/sql/handler.cc:2897
#12 0x000056272e0b61fe in handler::read_range_first (this=0x7f52e015fee8, start_key=0x7f532c1014e0, end_key=0x7f532c101500, eq_range_arg=false, sorted=true) at /data/src/10.3/sql/handler.cc:5816
#13 0x000056272e22cf96 in QUICK_RANGE_SELECT::get_next_prefix (this=0x7f52e00a7750, prefix_length=5, group_key_parts=1, cur_prefix=0x0) at /data/src/10.3/sql/opt_range.cc:11595
#14 0x000056272e2338c3 in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7f52e00a7600) at /data/src/10.3/sql/opt_range.cc:14325
#15 0x000056272e2330eb in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7f52e00a7600) at /data/src/10.3/sql/opt_range.cc:14067
#16 0x000056272e23e9f7 in rr_quick (info=0x7f52e0016558) at /data/src/10.3/sql/records.cc:361
#17 0x000056272dcf1897 in READ_RECORD::read_record (this=0x7f52e0016558) at /data/src/10.3/sql/records.h:69
#18 0x000056272de0bb28 in join_init_read_record (tab=0x7f52e0016490) at /data/src/10.3/sql/sql_select.cc:20463
#19 0x000056272de096e5 in sub_select (join=0x7f52e0013f50, join_tab=0x7f52e0016490, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19524
#20 0x000056272de08bd1 in do_select (join=0x7f52e0013f50, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19067
#21 0x000056272dddfad9 in JOIN::exec_inner (this=0x7f52e0013f50) at /data/src/10.3/sql/sql_select.cc:4040
#22 0x000056272dddeeac in JOIN::exec (this=0x7f52e0013f50) at /data/src/10.3/sql/sql_select.cc:3834
#23 0x000056272dde01bd in mysql_select (thd=0x7f52e0000b00, tables=0x7f52e0013268, wild_num=0, fields=..., conds=0x7f52e0013b18, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184065, result=0x7f52e0013e58, unit=0x7f52e00049d0, select_lex=0x7f52e0005150) at /data/src/10.3/sql/sql_select.cc:4239
#24 0x000056272ddd1c44 in handle_select (thd=0x7f52e0000b00, lex=0x7f52e0004908, result=0x7f52e0013e58, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#25 0x000056272de7c1d1 in Sql_cmd_create_table_like::execute (this=0x7f52e0012a90, thd=0x7f52e0000b00) at /data/src/10.3/sql/sql_table.cc:11150
#26 0x000056272dd9854a in mysql_execute_command (thd=0x7f52e0000b00) at /data/src/10.3/sql/sql_parse.cc:6023
#27 0x000056272dd9dcbd in mysql_parse (thd=0x7f52e0000b00, rawbuf=0x7f52e0012960 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", length=67, parser_state=0x7f532c1025e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7829
#28 0x000056272dd8a8f7 in dispatch_command (command=COM_QUERY, thd=0x7f52e0000b00, packet=0x7f52e0008c71 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1855
#29 0x000056272dd8923f in do_command (thd=0x7f52e0000b00) at /data/src/10.3/sql/sql_parse.cc:1400
#30 0x000056272deffba4 in do_handle_one_connection (connect=0x5627312a8310) at /data/src/10.3/sql/sql_connect.cc:1403
#31 0x000056272deff906 in handle_one_connection (arg=0x5627312a8310) at /data/src/10.3/sql/sql_connect.cc:1308
#32 0x000056272e8aa528 in pfs_spawn_thread (arg=0x5627311ed9b0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#33 0x00007f53338784a4 in start_thread (arg=0x7f532c103700) at pthread_create.c:456
#34 0x00007f5331dc0d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.2 102bc7be

mysqld: /data/src/10.2/storage/innobase/row/row0sel.cc:4579: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE' failed.
190925 14:54:06 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f32a5d5df12 in __GI___assert_fail (assertion=0x557d615d4da8 "prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE", file=0x557d615d3a68 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=4579, function=0x557d615d8260 <row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:101
#8  0x0000557d60fad66d in row_search_mvcc (buf=0x7f324c0e56f0 "\377", mode=PAGE_CUR_GE, prebuilt=0x7f324c0c1fc8, match_mode=0, direction=0) at /data/src/10.2/storage/innobase/row/row0sel.cc:4579
#9  0x0000557d60e3db13 in ha_innobase::index_read (this=0x7f324c09a418, buf=0x7f324c0e56f0 "\377", key_ptr=0x7f324c0bd678 "", key_len=5, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9471
#10 0x0000557d60c39c4e in handler::index_read_map (this=0x7f324c09a418, buf=0x7f324c0e56f0 "\377", key=0x7f324c0bd678 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.2/sql/handler.h:3136
#11 0x0000557d60c2fe2b in handler::ha_index_read_map (this=0x7f324c09a418, buf=0x7f324c0e56f0 "\377", key=0x7f324c0bd678 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.2/sql/handler.cc:2711
#12 0x0000557d60c36a64 in handler::read_range_first (this=0x7f324c09a418, start_key=0x7f32a03a8ea0, end_key=0x7f32a03a8ec0, eq_range_arg=false, sorted=true) at /data/src/10.2/sql/handler.cc:5458
#13 0x0000557d60d88e19 in QUICK_RANGE_SELECT::get_next_prefix (this=0x7f324c1870a0, prefix_length=5, group_key_parts=1, cur_prefix=0x0) at /data/src/10.2/sql/opt_range.cc:11570
#14 0x0000557d60d8f20d in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7f324c00add0) at /data/src/10.2/sql/opt_range.cc:14299
#15 0x0000557d60d8eb07 in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7f324c00add0) at /data/src/10.2/sql/opt_range.cc:14041
#16 0x0000557d60d99a04 in rr_quick (info=0x7f324c015fd8) at /data/src/10.2/sql/records.cc:365
#17 0x0000557d60a1d690 in join_init_read_record (tab=0x7f324c015f10) at /data/src/10.2/sql/sql_select.cc:19780
#18 0x0000557d60a1b42e in sub_select (join=0x7f324c013b08, join_tab=0x7f324c015f10, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18851
#19 0x0000557d60a1aa17 in do_select (join=0x7f324c013b08, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18398
#20 0x0000557d609f440b in JOIN::exec_inner (this=0x7f324c013b08) at /data/src/10.2/sql/sql_select.cc:3623
#21 0x0000557d609f38c6 in JOIN::exec (this=0x7f324c013b08) at /data/src/10.2/sql/sql_select.cc:3418
#22 0x0000557d609f4a7c in mysql_select (thd=0x7f324c000b00, tables=0x7f324c012e70, wild_num=0, fields=..., conds=0x7f324c0136d8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184065, result=0x7f324c013a18, unit=0x7f324c004700, select_lex=0x7f324c004e40) at /data/src/10.2/sql/sql_select.cc:3818
#23 0x0000557d609e8ce8 in handle_select (thd=0x7f324c000b00, lex=0x7f324c004638, result=0x7f324c013a18, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
#24 0x0000557d60a86ef2 in Sql_cmd_create_table::execute (this=0x7f324c0126e0, thd=0x7f324c000b00) at /data/src/10.2/sql/sql_table.cc:10851
#25 0x0000557d609b2c6a in mysql_execute_command (thd=0x7f324c000b00) at /data/src/10.2/sql/sql_parse.cc:5972
#26 0x0000557d609b7d64 in mysql_parse (thd=0x7f324c000b00, rawbuf=0x7f324c0125b0 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", length=67, parser_state=0x7f32a03aa200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7759
#27 0x0000557d609a606d in dispatch_command (command=COM_QUERY, thd=0x7f324c000b00, packet=0x7f324c096371 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1831
#28 0x0000557d609a49c1 in do_command (thd=0x7f324c000b00) at /data/src/10.2/sql/sql_parse.cc:1384
#29 0x0000557d60af9c19 in do_handle_one_connection (connect=0x557d6354aff0) at /data/src/10.2/sql/sql_connect.cc:1336
#30 0x0000557d60af9984 in handle_one_connection (arg=0x557d6354aff0) at /data/src/10.2/sql/sql_connect.cc:1241
#31 0x0000557d6132a7fa in pfs_spawn_thread (arg=0x557d6356e2a0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#32 0x00007f32a78d24a4 in start_thread (arg=0x7f32a03ab700) at pthread_create.c:456
#33 0x00007f32a5e1ad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.1 5f118b26

2019-09-25 14:55:01 7f52feec8700  InnoDB: Assertion failure in thread 139994440959744 in file row0sel.cc line 4191
InnoDB: Failing assertion: prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
190925 14:55:01 [ERROR] mysqld got signal 6 ;
 
#5  0x00007f52fd4b742a in __GI_abort () at abort.c:89
#6  0x00005576bfb8b2ad in row_search_for_mysql (buf=0x7f52f16e8b88 "\377", mode=2, prebuilt=0x7f52e7881878, match_mode=0, direction=0) at /data/src/10.1/storage/xtradb/row/row0sel.cc:4191
#7  0x00005576bfa4b69a in ha_innobase::index_read (this=0x7f52e78ae088, buf=0x7f52f16e8b88 "\377", key_ptr=0x7f52e79cb148 "", key_len=5, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.1/storage/xtradb/handler/ha_innodb.cc:9980
#8  0x00005576bf710ec6 in handler::index_read_map (this=0x7f52e78ae088, buf=0x7f52f16e8b88 "\377", key=0x7f52e79cb148 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.1/sql/handler.h:3080
#9  0x00005576bf7079dd in handler::ha_index_read_map (this=0x7f52e78ae088, buf=0x7f52f16e8b88 "\377", key=0x7f52e79cb148 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/10.1/sql/handler.cc:2690
#10 0x00005576bf70de30 in handler::read_range_first (this=0x7f52e78ae088, start_key=0x7f52feec5eb0, end_key=0x7f52feec5ed0, eq_range_arg=false, sorted=true) at /data/src/10.1/sql/handler.cc:5388
#11 0x00005576bf8363db in QUICK_RANGE_SELECT::get_next_prefix (this=0x7f52e79c4280, prefix_length=5, group_key_parts=1, cur_prefix=0x0) at /data/src/10.1/sql/opt_range.cc:11349
#12 0x00005576bf83c5a1 in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7f52e79c4140) at /data/src/10.1/sql/opt_range.cc:14071
#13 0x00005576bf83beef in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7f52e79c4140) at /data/src/10.1/sql/opt_range.cc:13813
#14 0x00005576bf846173 in rr_quick (info=0x7f52e79168b0) at /data/src/10.1/sql/records.cc:350
#15 0x00005576bf52a5d0 in join_init_read_record (tab=0x7f52e79167f0) at /data/src/10.1/sql/sql_select.cc:19504
#16 0x00005576bf52847c in sub_select (join=0x7f52e7914590, join_tab=0x7f52e79167f0, end_of_records=false) at /data/src/10.1/sql/sql_select.cc:18587
#17 0x00005576bf527d33 in do_select (join=0x7f52e7914590, fields=0x7f52e7914990, table=0x0, procedure=0x0) at /data/src/10.1/sql/sql_select.cc:18245
#18 0x00005576bf50182a in JOIN::exec_inner (this=0x7f52e7914590) at /data/src/10.1/sql/sql_select.cc:3277
#19 0x00005576bf4feabd in JOIN::exec (this=0x7f52e7914590) at /data/src/10.1/sql/sql_select.cc:2564
#20 0x00005576bf50204b in mysql_select (thd=0x7f52f16f0070, rref_pointer_array=0x7f52f16f4570, tables=0x7f52e7913920, wild_num=0, fields=..., conds=0x7f52e7914160, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184065, result=0x7f52e79144b0, unit=0x7f52f16f3bc0, select_lex=0x7f52f16f42c8) at /data/src/10.1/sql/sql_select.cc:3501
#21 0x00005576bf4f7722 in handle_select (thd=0x7f52f16f0070, lex=0x7f52f16f3af8, result=0x7f52e79144b0, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:377
#22 0x00005576bf58b4a4 in Sql_cmd_create_table::execute (this=0x7f52e79131b8, thd=0x7f52f16f0070) at /data/src/10.1/sql/sql_table.cc:10366
#23 0x00005576bf4c59c9 in mysql_execute_command (thd=0x7f52f16f0070) at /data/src/10.1/sql/sql_parse.cc:5442
#24 0x00005576bf4ca59f in mysql_parse (thd=0x7f52f16f0070, rawbuf=0x7f52e7913088 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", length=67, parser_state=0x7f52feec71e0) at /data/src/10.1/sql/sql_parse.cc:7209
#25 0x00005576bf4b9751 in dispatch_command (command=COM_QUERY, thd=0x7f52f16f0070, packet=0x7f52f6677071 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", packet_length=67) at /data/src/10.1/sql/sql_parse.cc:1499
#26 0x00005576bf4b850f in do_command (thd=0x7f52f16f0070) at /data/src/10.1/sql/sql_parse.cc:1131
#27 0x00005576bf5f57e3 in do_handle_one_connection (thd_arg=0x7f52f16f0070) at /data/src/10.1/sql/sql_connect.cc:1331
#28 0x00005576bf5f5514 in handle_one_connection (arg=0x7f52f16f0070) at /data/src/10.1/sql/sql_connect.cc:1242
#29 0x00005576bfa2a966 in pfs_spawn_thread (arg=0x7f52f1647670) at /data/src/10.1/storage/perfschema/pfs.cc:1861
#30 0x00007f52feb554a4 in start_thread (arg=0x7f52feec8700) at pthread_create.c:456
#31 0x00007f52fd56bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

5.5 67b0faa2

190925 14:56:31  InnoDB: Assertion failure in thread 140617657390848 in file row0sel.c line 3802
InnoDB: Failing assertion: prebuilt->sql_stat_start || trx->conc_state == 1
 
#5  0x00007fe417de642a in __GI_abort () at abort.c:89
#6  0x00007fe4130fbf12 in row_search_for_mysql (buf=0x7fe409456a78 "\377", mode=2, prebuilt=0x7fe4094a5278, match_mode=0, direction=0) at /data/src/5.5/storage/innobase/row/row0sel.c:3802
#7  0x00007fe4130a67db in ha_innodb::index_read (this=0x7fe409557078, buf=0x7fe409456a78 "\377", key_ptr=0x7fe4096600b0 "", key_len=5, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/5.5/storage/innobase/handler/ha_innodb.cc:6072
#8  0x00007fe4130b1a48 in handler::index_read_map (this=0x7fe409557078, buf=0x7fe409456a78 "\377", key=0x7fe4096600b0 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/5.5/sql/handler.h:2129
#9  0x00005557507e4262 in handler::ha_index_read_map (this=0x7fe409557078, buf=0x7fe409456a78 "\377", key=0x7fe4096600b0 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at /data/src/5.5/sql/sql_class.h:4246
#10 0x0000555750a066c9 in handler::read_range_first (this=0x7fe409557078, start_key=0x7fe4198478f0, end_key=0x7fe419847910, eq_range_arg=false, sorted=true) at /data/src/5.5/sql/handler.cc:4638
#11 0x0000555750b11f33 in QUICK_RANGE_SELECT::get_next_prefix (this=0x7fe409422340, prefix_length=5, group_key_parts=1, cur_prefix=0x0) at /data/src/5.5/sql/opt_range.cc:11310
#12 0x0000555750b17ac2 in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7fe409422200) at /data/src/5.5/sql/opt_range.cc:13969
#13 0x0000555750b17432 in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7fe409422200) at /data/src/5.5/sql/opt_range.cc:13711
#14 0x0000555750b20aa3 in rr_quick (info=0x7fe4097690f8) at /data/src/5.5/sql/records.cc:347
#15 0x00005557508a790c in join_init_read_record (tab=0x7fe409769048) at /data/src/5.5/sql/sql_select.cc:18083
#16 0x00005557508a57bb in sub_select (join=0x7fe409553518, join_tab=0x7fe409769048, end_of_records=false) at /data/src/5.5/sql/sql_select.cc:17183
#17 0x00005557508a507c in do_select (join=0x7fe409553518, fields=0x7fe4095538f8, table=0x0, procedure=0x0) at /data/src/5.5/sql/sql_select.cc:16848
#18 0x0000555750882471 in JOIN::exec (this=0x7fe409553518) at /data/src/5.5/sql/sql_select.cc:2914
#19 0x0000555750882c47 in mysql_select (thd=0x7fe41278f060, rref_pointer_array=0x7fe412792d10, tables=0x7fe4095528e8, wild_num=0, fields=..., conds=0x7fe409553128, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184065, result=0x7fe409553440, unit=0x7fe412792388, select_lex=0x7fe412792a70) at /data/src/5.5/sql/sql_select.cc:3135
#20 0x0000555750879214 in handle_select (thd=0x7fe41278f060, lex=0x7fe4127922d8, result=0x7fe409553440, setup_tables_done_option=0) at /data/src/5.5/sql/sql_select.cc:312
#21 0x000055575084b73f in mysql_execute_command (thd=0x7fe41278f060) at /data/src/5.5/sql/sql_parse.cc:2610
#22 0x00005557508545ef in mysql_parse (thd=0x7fe41278f060, rawbuf=0x7fe409552078 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", length=67, parser_state=0x7fe419848620) at /data/src/5.5/sql/sql_parse.cc:5929
#23 0x0000555750847eab in dispatch_command (command=COM_QUERY, thd=0x7fe41278f060, packet=0x7fe4115bb061 "CREATE TABLE t2 SELECT DISTINCT id FROM t1 WHERE id BETWEEN 1 AND 2", packet_length=67) at /data/src/5.5/sql/sql_parse.cc:1067
#24 0x00005557508470bb in do_command (thd=0x7fe41278f060) at /data/src/5.5/sql/sql_parse.cc:793
#25 0x000055575094d311 in do_handle_one_connection (thd_arg=0x7fe41278f060) at /data/src/5.5/sql/sql_connect.cc:1268
#26 0x000055575094d080 in handle_one_connection (arg=0x7fe41278f060) at /data/src/5.5/sql/sql_connect.cc:1184
#27 0x0000555750cd1d0e in pfs_spawn_thread (arg=0x7fe4127b1a80) at /data/src/5.5/storage/perfschema/pfs.cc:1015
#28 0x00007fe4194844a4 in start_thread (arg=0x7fe419849700) at pthread_create.c:456
#29 0x00007fe417e9ad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

No obvious problem on a non-debug build.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2019-09-30 ]

Even this issue also related to MDEV-14846. Function row_search_mvcc() returns DB_DEADLOCK.
But server doesn't handle the error promptly. In this case, the function is QUICK_GROUP_MIN_MAX_SELECT::reset() does return 0 no matter what result value is.

Comment by Alice Sherepa [ 2019-12-05 ]

10.4 aab6cefe8dc132ec6a16e6af5c6

#3  <signal handler called>
#4  0x00007fbaf2e90428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007fbaf2e9202a in __GI_abort () at abort.c:89
#6  0x00007fbaf2e88bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5616905a1fc8 "prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)", file=file@entry=0x5616905a0cd8 "/10.4/storage/innobase/row/row0sel.cc", line=line@entry=4485, function=function@entry=0x5616905a5240 <row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:92
#7  0x00007fbaf2e88c82 in __GI___assert_fail (assertion=0x5616905a1fc8 "prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)", file=0x5616905a0cd8 "/10.4/storage/innobase/row/row0sel.cc", line=4485, function=0x5616905a5240 <row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:101
#8  0x000056168fecc793 in row_search_mvcc (buf=0x7fba841effa0 "\177\377\267\b", mode=PAGE_CUR_G, prebuilt=0x7fba841f1cd8, match_mode=0, direction=1) at /10.4/storage/innobase/row/row0sel.cc:4485
#9  0x000056168fce208a in ha_innobase::general_fetch (this=0x7fba841f03f8, buf=0x7fba841effa0 "\177\377\267\b", direction=1, match_mode=0) at /10.4/storage/innobase/handler/ha_innodb.cc:9572
#10 0x000056168fce25cf in ha_innobase::rnd_next (this=0x7fba841f03f8, buf=0x7fba841effa0 "\177\377\267\b") at /10.4/storage/innobase/handler/ha_innodb.cc:9781
#11 0x000056168f94daf4 in handler::ha_rnd_next (this=0x7fba841f03f8, buf=0x7fba841effa0 "\177\377\267\b") at /10.4/sql/handler.cc:2826
#12 0x000056168faf7c14 in rr_sequential (info=0x7fbadc843d00) at /10.4/sql/records.cc:477
#13 0x000056168f5359bd in READ_RECORD::read_record (this=0x7fbadc843d00) at /10.4/sql/records.h:69
#14 0x000056168fb15fd3 in mysql_delete (thd=0x7fba6c000af0, table_list=0x7fba6c012768, conds=0x7fba6c017400, order_list=0x7fba6c0054b0, limit=18446744073709551615, options=0, result=0x0) at /10.4/sql/sql_delete.cc:725
#15 0x000056168f5ea7c9 in mysql_execute_command (thd=0x7fba6c000af0) at /10.4/sql/sql_parse.cc:4728
#16 0x000056168f5f6049 in mysql_parse (thd=0x7fba6c000af0, rawbuf=0x7fba6c011d28 "DELETE FROM `view_CC` WHERE `col_datetime_nokey` < ALL (SELECT `col_datetime_key` FROM `CC` WHERE `col_datetime_nokey` IN ( 4, '2008-03-22 18:55:53.037942', NULL, REPEAT(72, 'iron'), NULL ) OR ((`col_"..., length=1215, parser_state=0x7fbadc845030, is_com_multi=false, is_next_command=false) at /10.4/sql/sql_parse.cc:7901
#17 0x000056168f5e11f6 in dispatch_command (command=COM_QUERY, thd=0x7fba6c000af0, packet=0x7fba6c008261 "DELETE FROM `view_CC` WHERE `col_datetime_nokey` < ALL (SELECT `col_datetime_key` FROM `CC` WHERE `col_datetime_nokey` IN ( 4, '2008-03-22 18:55:53.037942', NULL, REPEAT(72, 'iron'), NULL ) OR ((`col_"..., packet_length=1216, is_com_multi=false, is_next_command=false) at /10.4/sql/sql_parse.cc:1842
#18 0x000056168f5df857 in do_command (thd=0x7fba6c000af0) at /10.4/sql/sql_parse.cc:1360
#19 0x000056168f769621 in do_handle_one_connection (connect=0x561693fc4ad0) at /10.4/sql/sql_connect.cc:1412
#20 0x000056168f76934a in handle_one_connection (arg=0x561693fc4ad0) at /10.4/sql/sql_connect.cc:1316
#21 0x00007fbaf437f6ba in start_thread (arg=0x7fbadc846700) at pthread_create.c:333
#22 0x00007fbaf2f6241d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Comment by Alice Sherepa [ 2020-06-09 ]

I couldn't reproduce the bug on 10.5 76cb2f9dd677d91df (tried repeat=100), but it is still on 10.1-10.4
But on 10.5 exists assertion after multi-update (probably MDEV-15013 had it also initially)

10.5 76cb2f9dd677d91df9

mysqld: /10.5/storage/innobase/row/row0sel.cc:4482: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)' failed.
200609 11:35:59 [ERROR] mysqld got signal 6 ;
 
linux/raise.c:51(__GI_raise)[0x7f1da923c7bb]
stdlib/abort.c:81(__GI_abort)[0x7f1da9227535]
intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f1da922740f]
??:0(__assert_fail)[0x7f1da9235102]
row/row0sel.cc:4487(row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long))[0x55f8517dffc6]
handler/ha_innodb.cc:9225(ha_innobase::general_fetch(unsigned char*, unsigned int, unsigned int))[0x55f850d01a4e]
handler/ha_innodb.cc:9294(ha_innobase::index_next(unsigned char*))[0x55f85066f5bf]
sql/handler.cc:3096(handler::ha_index_next(unsigned char*))[0x55f850375e44]
sql/sql_select.cc:21653(join_read_next(READ_RECORD*))[0x55f850667d15]
sql/records.h:79(READ_RECORD::read_record())[0x55f8506690fd]
sql/sql_select.cc:20648(sub_select(JOIN*, st_join_table*, bool))[0x55f850667a8c]
sql/sql_select.cc:20852(evaluate_join_record(JOIN*, st_join_table*, int))[0x55f8506690fd]
sql/sql_select.cc:20629(sub_select(JOIN*, st_join_table*, bool))[0x55f8506680fd]
sql/sql_select.cc:20668(sub_select(JOIN*, st_join_table*, bool))[0x55f850665b1a]
sql/sql_select.cc:20163(do_select(JOIN*, Procedure*))[0x55f8505f3d26]
sql/sql_select.cc:4475(JOIN::exec_inner())[0x55f8505f1378]
sql/sql_select.cc:4257(JOIN::exec())[0x55f8505f528d]
sql/sql_select.cc:4682(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55f85081cc44]
sql/sql_update.cc:1923(mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**))[0x55f85052c4b1]
sql/sql_parse.cc:4477(mysql_execute_command(THD*))[0x55f850544aae]
sql/sql_parse.cc:7992(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55f85051ba70]
sql/sql_parse.cc:1877(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55f850518388]
sql/sql_parse.cc:1355(do_command(THD*))[0x55f85093b2e3]
sql/sql_connect.cc:1411(do_handle_one_connection(CONNECT*, bool))[0x55f85093ac40]
sql/sql_connect.cc:1315(handle_one_connection)[0x55f8515e341e]
nptl/pthread_create.c:487(start_thread)[0x7f1da9cf7fa3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f1da92fe4cf]

Comment by Alice Sherepa [ 2020-08-03 ]

mysqld: /10.5/storage/innobase/row/row0sel.cc:4482: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE || (prebuilt->table->no_rollback() && trx->state == TRX_STATE_NOT_STARTED)' failed.
200803  9:17:50 [ERROR] mysqld got signal 6 ;
 
linux/raise.c:51(__GI_raise)[0x7f92fd990535]
stdlib/abort.c:81(__GI_abort)[0x7f92fd99040f]
row/row0sel.cc:4487(row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long))[0x562a8cb60c02]
handler/ha_innodb.cc:8911(ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function))[0x562a8cb61f2b]
handler/ha_innodb.cc:9413(ha_innobase::rnd_pos(unsigned char*, unsigned char*))[0x562a8c702456]
sql/handler.cc:3092(handler::ha_rnd_pos(unsigned char*, unsigned char*))[0x562a8c714ac8]
sql/handler.h:3930(handler::rnd_pos_by_record(unsigned char*))[0x562a8c5cb892]
sql/sql_class.h:6986(handler::ha_rnd_pos_by_record(unsigned char*))[0x562a8c5c6961]
sql/rpl_gtid.cc:939(rpl_slave_state::gtid_delete_pending(THD*, rpl_slave_state::list_element**))[0x562a8c28efac]
sql/slave.cc:564(handle_slave_background)[0x562a8ca7e71f]
nptl/pthread_create.c:487(start_thread)[0x7f92fe45efa3]
x86_64/clone.S:97(clone)[0x7f92fda674cf]

might be a variation - I will not invest time in it now - I'd rather check if it is fixed after the patch

Comment by Elena Stepanova [ 2021-07-04 ]

The test case below (also non-deterministic one, run with --repeat=N) causes the same assertions as in the description for 10.2 and 10.3-10.4, on 10.5 the assertion is the same as on 10.3-10.4, and on 10.6 it's different again:

--source include/have_innodb.inc
 
CREATE TABLE t (f BIT, KEY(f)) ENGINE=InnoDB;
 
--connect (con1,localhost,root,,test)
START TRANSACTION;
INSERT INTO t VALUES (1),(0),(1),(0),(1),(0),(1),(0),(1),(0),(1),(0),(1);
--send
 INSERT INTO t VALUES (0);
 
--connection default
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;
--send
  SELECT DISTINCT f FROM t;
 
--connection con1
--reap
INSERT INTO t VALUES (1);
 
# Cleanup
COMMIT;
--disconnect con1
--connection default
--reap
COMMIT;
DROP TABLE t;

10.6 789a2a36

mariadbd: /data/src/10.6/storage/innobase/row/row0sel.cc:4614: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || prebuilt->table->no_rollback()' failed.
210705  1:50:12 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f3a2c27df36 in __GI___assert_fail (assertion=0x55b02c171d48 "prebuilt->sql_stat_start || prebuilt->table->no_rollback()", file=0x55b02c16fc60 "/data/src/10.6/storage/innobase/row/row0sel.cc", line=4614, function=0x55b02c171c00 "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at assert.c:101
#8  0x000055b02ba178da in row_search_mvcc (buf=0x7f39f401e3a8 "\377", mode=PAGE_CUR_G, prebuilt=0x7f39f401f068, match_mode=0, direction=0) at /data/src/10.6/storage/innobase/row/row0sel.cc:4614
#9  0x000055b02b81b974 in ha_innobase::index_read (this=0x7f39f401e810, buf=0x7f39f401e3a8 "\377", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/10.6/storage/innobase/handler/ha_innodb.cc:8972
#10 0x000055b02b81c99c in ha_innobase::index_first (this=0x7f39f401e810, buf=0x7f39f401e3a8 "\377") at /data/src/10.6/storage/innobase/handler/ha_innodb.cc:9333
#11 0x000055b02b3a9601 in handler::ha_index_first (this=0x7f39f401e810, buf=0x7f39f401e3a8 "\377") at /data/src/10.6/sql/handler.cc:3533
#12 0x000055b02b566143 in QUICK_GROUP_MIN_MAX_SELECT::next_prefix (this=0x7f39f0214e40) at /data/src/10.6/sql/opt_range.cc:15582
#13 0x000055b02b5658b1 in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7f39f0214e40) at /data/src/10.6/sql/opt_range.cc:15314
#14 0x000055b02b573355 in rr_quick (info=0x7f39f0018118) at /data/src/10.6/sql/records.cc:403
#15 0x000055b02af4addb in READ_RECORD::read_record (this=0x7f39f0018118) at /data/src/10.6/sql/records.h:81
#16 0x000055b02b08fc6e in join_init_read_record (tab=0x7f39f0018050) at /data/src/10.6/sql/sql_select.cc:21988
#17 0x000055b02b08d6dc in sub_select (join=0x7f39f0016c10, join_tab=0x7f39f0018050, end_of_records=false) at /data/src/10.6/sql/sql_select.cc:21010
#18 0x000055b02b08cc4a in do_select (join=0x7f39f0016c10, procedure=0x0) at /data/src/10.6/sql/sql_select.cc:20560
#19 0x000055b02b060277 in JOIN::exec_inner (this=0x7f39f0016c10) at /data/src/10.6/sql/sql_select.cc:4726
#20 0x000055b02b05f2ed in JOIN::exec (this=0x7f39f0016c10) at /data/src/10.6/sql/sql_select.cc:4504
#21 0x000055b02b060c27 in mysql_select (thd=0x7f39f0000db8, tables=0x7f39f0015c30, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2148797185, result=0x7f39f0016be8, unit=0x7f39f0005130, select_lex=0x7f39f0015650) at /data/src/10.6/sql/sql_select.cc:4982
#22 0x000055b02b04fed3 in handle_select (thd=0x7f39f0000db8, lex=0x7f39f0005068, result=0x7f39f0016be8, setup_tables_done_option=0) at /data/src/10.6/sql/sql_select.cc:544
#23 0x000055b02b010c36 in execute_sqlcom_select (thd=0x7f39f0000db8, all_tables=0x7f39f0015c30) at /data/src/10.6/sql/sql_parse.cc:6252
#24 0x000055b02b007ee1 in mysql_execute_command (thd=0x7f39f0000db8, is_called_from_prepared_stmt=false) at /data/src/10.6/sql/sql_parse.cc:3947
#25 0x000055b02b015a85 in mysql_parse (thd=0x7f39f0000db8, rawbuf=0x7f39f00155c0 "SELECT DISTINCT f FROM t", length=24, parser_state=0x7f3a254c5480) at /data/src/10.6/sql/sql_parse.cc:8026
#26 0x000055b02b001eed in dispatch_command (command=COM_QUERY, thd=0x7f39f0000db8, packet=0x7f39f000b879 "", packet_length=24, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1896
#27 0x000055b02b000889 in do_command (thd=0x7f39f0000db8, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1404
#28 0x000055b02b1bdd9b in do_handle_one_connection (connect=0x55b02e401e78, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1410
#29 0x000055b02b1bdaf7 in handle_one_connection (arg=0x55b02e4018e8) at /data/src/10.6/sql/sql_connect.cc:1312
#30 0x000055b02b72dc1b in pfs_spawn_thread (arg=0x55b02e4019c8) at /data/src/10.6/storage/perfschema/pfs.cc:2201
#31 0x00007f3a2c796609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#32 0x00007f3a2c369293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Comment by Alice Sherepa [ 2021-10-27 ]

Also if there is no change of transaction isolation level, but creating temporary table:

--source include/have_innodb.inc
 
CREATE TABLE t (f BIT, KEY(f)) ENGINE=InnoDB;
 
--connect (con1,localhost,root,,test)
START TRANSACTION;
INSERT INTO t VALUES (1),(0),(1),(0),(1),(0),(1),(0),(1),(0),(1),(0),(1);
--send
 INSERT INTO t VALUES (0);
 
--connection default
 
--send create temporary table tmp as SELECT DISTINCT f FROM t;
 
--connection con1
--reap
INSERT INTO t VALUES (1);
 
# Cleanup
COMMIT;
--disconnect con1
--connection default
--reap
COMMIT;
DROP TABLE t;

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