[MDEV-17951] Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed in close_thread_tables on slave Created: 2018-12-09  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Replication, Views
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

perl ./mtr --view-protocol rpl.rpl_parallel_no_log_slave_updates

10.0 4886d14827c

181209 19:00:32 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000001' position 880; GTID position '0-1-3'
mysqld: /data/src/10.0/sql/sql_base.cc:893: void close_thread_tables(THD*): Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
181209 19:00:32 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f948d06aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00000000005e9e86 in close_thread_tables (thd=0x7f9476c16070) at /data/src/10.0/sql/sql_base.cc:892
#9  0x00000000006555c5 in mysql_execute_command (thd=0x7f9476c16070) at /data/src/10.0/sql/sql_parse.cc:5175
#10 0x00000000006589d0 in mysql_parse (thd=0x7f9476c16070, rawbuf=0x7f94788c9e88 "CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest_tmp_v` AS SELECT * FROM t3 WHERE a >= 30 ORDER BY a", length=153, parser_state=0x7f9486647a00) at /data/src/10.0/sql/sql_parse.cc:6637
#11 0x000000000092a116 in Query_log_event::do_apply_event (this=0x7f94788c9cb0, rgi=0x7f9478816800, query_arg=0x7f94788c9e88 "CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest_tmp_v` AS SELECT * FROM t3 WHERE a >= 30 ORDER BY a", q_len_arg=153) at /data/src/10.0/sql/log_event.cc:4435
#12 0x0000000000929127 in Query_log_event::do_apply_event (this=0x7f94788c9cb0, rgi=0x7f9478816800) at /data/src/10.0/sql/log_event.cc:4096
#13 0x00000000005c1d4c in Log_event::apply_event (this=0x7f94788c9cb0, rgi=0x7f9478816800) at /data/src/10.0/sql/log_event.h:1360
#14 0x00000000005b8444 in apply_event_and_update_pos (ev=0x7f94788c9cb0, thd=0x7f9476c16070, rgi=0x7f9478816800, rpt=0x7f94788aacf0) at /data/src/10.0/sql/slave.cc:3310
#15 0x00000000007c7a3e in rpt_handle_event (qev=0x7f947889e270, rpt=0x7f94788aacf0) at /data/src/10.0/sql/rpl_parallel.cc:52
#16 0x00000000007ca285 in handle_rpl_parallel_thread (arg=0x7f94788aacf0) at /data/src/10.0/sql/rpl_parallel.cc:1202
#17 0x0000000000acdb54 in pfs_spawn_thread (arg=0x7f9478861270) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#18 0x00007f948eb53494 in start_thread (arg=0x7f9486648700) at pthread_create.c:333
#19 0x00007f948d12793f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Alice Sherepa [ 2020-07-08 ]

I am getting identical assertion on 10.5 1ae008d272ad3f424fd334 with rqg

/git/10.5/sql/sql_base.cc:800: int close_thread_tables(THD*): Assertion `thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
200708 13:35:19 [ERROR] mysqld got signal 6 ;
 
Server version: 10.5.5-MariaDB-debug-log
 
linux/raise.c:51(__GI_raise)[0x7f6971622f47]
stdlib/abort.c:81(__GI_abort)[0x7f69716248b1]
assert/assert.c:89(__assert_fail_base)[0x7f697161442a]
??:0(__assert_fail)[0x7f69716144a2]
sql/sql_base.cc:802(close_thread_tables(THD*))[0x555dc0ca8f8d]
sql/sql_parse.cc:6021(mysql_execute_command(THD*))[0x555dc0e58ea2]
sql/sql_parse.cc:7993(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x555dc0e65e47]
sql/log_event_server.cc:1906(Query_log_event::do_apply_event(rpl_group_info*, char const*, unsigned int))[0x555dc197d1f1]
sql/log_event_server.cc:1579(Query_log_event::do_apply_event(rpl_group_info*))[0x555dc197a40b]
sql/log_event.h:1496(Log_event::apply_event(rpl_group_info*))[0x555dc0be5657]
sql/slave.cc:4003(apply_event_and_update_pos_apply(Log_event*, THD*, rpl_group_info*, int))[0x555dc0bc751f]
sql/slave.cc:4190(apply_event_and_update_pos_for_parallel(Log_event*, THD*, rpl_group_info*))[0x555dc0bc829f]
sql/rpl_parallel.cc:61(rpt_handle_event(rpl_parallel_thread::queued_event*, rpl_parallel_thread*))[0x555dc13a0547]
sql/rpl_parallel.cc:1343(handle_rpl_parallel_thread)[0x555dc13a7c95]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x555dc1f2c531]
nptl/pthread_create.c:463(start_thread)[0x7f697251f6db]
x86_64/clone.S:97(clone)[0x7f6971705a3f]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x6140000a24e0): CREATE VIEW `v1` AS SELECT * FROM t3 WHERE a >= 30 ORDER BY a

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