[MDEV-22916] Assertion `share->tmp_table == NO_TMP_TABLE' failed in get_schema_tables_record Created: 2020-06-16  Updated: 2024-01-15

Status: Confirmed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.11, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-33244 Slave: Assertion `marked_for_write_or... Open

 Description   

--source include/master-slave.inc
 
--connection master
CREATE TEMPORARY TABLE t1 (i int);
CREATE  TABLE t2 SELECT  * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
 
--sync_slave_with_master
 
--connection master
drop table t1,t2;
 
--source include/rpl_end.inc

10.3 b633b6a9d8278a3e0d9baaf8

 
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f141ebe1535 in __GI_abort () at abort.c:79
#6  0x00007f141ebe140f in __assert_fail_base (fmt=0x7f141ed43ee0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556b2c1af0d8 "share->tmp_table == NO_TMP_TABLE", file=0x556b2c1ada2d "/10.3/sql/sql_show.cc", line=5422, function=<optimized out>) at assert.c:92
#7  0x00007f141ebef102 in __GI___assert_fail (assertion=0x556b2c1af0d8 "share->tmp_table == NO_TMP_TABLE", file=0x556b2c1ada2d "/10.3/sql/sql_show.cc", line=5422, function=0x556b2c1b1c40 <get_schema_tables_record(THD*, TABLE_LIST*, TABLE*, bool, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*)::__PRETTY_FUNCTION__> "int get_schema_tables_record(THD*, TABLE_LIST*, TABLE*, bool, const LEX_CSTRING*, const LEX_CSTRING*)") at assert.c:101
#8  0x0000556b2b5aa0bf in get_schema_tables_record (thd=0x7f13b4001910, tables=0x7f13b407dc18, table=0x7f13b402acf8, res=false, db_name=0x7f13b4044ce8, table_name=0x7f13b4044640) at /10.3/sql/sql_show.cc:5422
#9  0x0000556b2b5a7909 in fill_schema_table_by_open (thd=0x7f13b4001910, mem_root=0x7f14101f0eb0, is_show_fields_or_keys=false, table=0x7f13b402acf8, schema_table=0x556b2c9d9880 <schema_tables+1984>, orig_db_name=0x7f13b4044ce8, orig_table_name=0x7f13b4044640, open_tables_state_backup=0x7f14101f0f00, can_deadlock=true) at /10.3/sql/sql_show.cc:4657
#10 0x0000556b2b5a927c in get_all_tables (thd=0x7f13b4001910, tables=0x7f13b400e3b0, cond=0x7f13b400ebd0) at /10.3/sql/sql_show.cc:5260
#11 0x0000556b2b5ba4da in get_schema_tables_result (join=0x7f13b4010ae8, executed_place=PROCESSED_BY_JOIN_EXEC) at /10.3/sql/sql_show.cc:8872
#12 0x0000556b2b54f5b3 in JOIN::exec_inner (this=0x7f13b4010ae8) at /10.3/sql/sql_select.cc:4079
#13 0x0000556b2b54ebc8 in JOIN::exec (this=0x7f13b4010ae8) at /10.3/sql/sql_select.cc:3910
#14 0x0000556b2b54fed5 in mysql_select (thd=0x7f13b4001910, tables=0x7f13b400e3b0, wild_num=1, fields=..., conds=0x7f13b400ebd0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2953054976, result=0x7f13b40109f0, unit=0x7f13b40057d8, select_lex=0x7f13b4005f60) at /10.3/sql/sql_select.cc:4315
#15 0x0000556b2b541646 in handle_select (thd=0x7f13b4001910, lex=0x7f13b4005718, result=0x7f13b40109f0, setup_tables_done_option=0) at /10.3/sql/sql_select.cc:370
#16 0x0000556b2b5ec7b1 in Sql_cmd_create_table_like::execute (this=0x7f13b400dbc0, thd=0x7f13b4001910) at /10.3/sql/sql_table.cc:11227
#17 0x0000556b2b507e7b in mysql_execute_command (thd=0x7f13b4001910) at /10.3/sql/sql_parse.cc:6030
#18 0x0000556b2b50d5e6 in mysql_parse (thd=0x7f13b4001910, rawbuf=0x7f13b402aafb "CREATE  TABLE t2 SELECT  * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'", length=81, parser_state=0x7f14101f2430, is_com_multi=false, is_next_command=false) at /10.3/sql/sql_parse.cc:7818
#19 0x0000556b2b95a6c2 in Query_log_event::do_apply_event (this=0x7f13b4022cb0, rgi=0x7f13b4000ce0, query_arg=0x7f13b402aafb "CREATE  TABLE t2 SELECT  * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'", q_len_arg=81) at /10.3/sql/log_event.cc:5703
#20 0x0000556b2b959577 in Query_log_event::do_apply_event (this=0x7f13b4022cb0, rgi=0x7f13b4000ce0) at /10.3/sql/log_event.cc:5381
#21 0x0000556b2b4168ab in Log_event::apply_event (this=0x7f13b4022cb0, rgi=0x7f13b4000ce0) at /10.3/sql/log_event.h:1482
#22 0x0000556b2b409a47 in apply_event_and_update_pos_apply (ev=0x7f13b4022cb0, thd=0x7f13b4001910, rgi=0x7f13b4000ce0, reason=0) at /10.3/sql/slave.cc:3914
#23 0x0000556b2b40a05c in apply_event_and_update_pos (ev=0x7f13b4022cb0, thd=0x7f13b4001910, rgi=0x7f13b4000ce0) at /10.3/sql/slave.cc:4082
#24 0x0000556b2b40a901 in exec_relay_log_event (thd=0x7f13b4001910, rli=0x556b2eea4cc8, serial_rgi=0x7f13b4000ce0) at /10.3/sql/slave.cc:4378
#25 0x0000556b2b40e1fa in handle_slave_sql (arg=0x556b2eea3000) at /10.3/sql/slave.cc:5551
#26 0x0000556b2c00ad21 in pfs_spawn_thread (arg=0x556b2edef590) at /10.3/storage/perfschema/pfs.cc:1869
#27 0x00007f141f334fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#28 0x00007f141ecb84cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

no visible effect on a non-debug build



 Comments   
Comment by Roel Van de Paar [ 2023-09-28 ]

I also ran into this bug:

--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
--source include/have_partition.inc
CREATE TEMPORARY TABLE t (a INT,INDEX (a));
CREATE TABLE t (c INT,c2 CHAR(5)) PARTITION BY RANGE (c) (PARTITION p0 VALUES LESS THAN (1),PARTITION p1 VALUES LESS THAN (20),PARTITION p2 VALUES LESS THAN (30),PARTITION p3 VALUES LESS THAN MAXVALUE);
INSERT INTO t SELECT table_rows FROM information_schema.tables;
--source include/rpl_end.inc

10.6.16 076df87b4c1dc5123d66600b82201050c45aa9d9

mariadbd: /test/10.6_dbg/sql/sql_show.cc:5559: int get_schema_tables_record(THD*, TABLE_LIST*, TABLE*, bool, const LEX_CSTRING*, const LEX_CSTRING*): Assertion `share->tmp_table == NO_TMP_TABLE' failed.

10.6.16 076df87b4c1dc5123d66600b82201050c45aa9d9

Core was generated by `/test/MD270923-mariadb-10.6.16-linux-x86_64-dbg/bin/mariadbd --defaults-group-s'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23111893988928)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x1505283b3640 (LWP 1711426))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23111893988928) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23111893988928) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23111893988928, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x000015052ea42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x000015052ea287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x000015052ea2871b in __assert_fail_base (fmt=0x15052ebdd150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55875b3a2e98 "share->tmp_table == NO_TMP_TABLE", file=0x55875b3a27b0 "/test/10.6_dbg/sql/sql_show.cc", line=5559, function=<optimized out>) at ./assert/assert.c:92
#6  0x000015052ea39e96 in __GI___assert_fail (assertion=0x55875b3a2e98 "share->tmp_table == NO_TMP_TABLE", file=0x55875b3a27b0 "/test/10.6_dbg/sql/sql_show.cc", line=5559, function=0x55875b3a2ec0 "int get_schema_tables_record(THD*, TABLE_LIST*, TABLE*, bool, const LEX_CSTRING*, const LEX_CSTRING*)") at ./assert/assert.c:101
#7  0x000055875a85964b in get_schema_tables_record (thd=0x1504e4001aa8, tables=0x1504e40712f0, table=0x1504e403ad30, res=false, db_name=<optimized out>, table_name=<optimized out>) at /test/10.6_dbg/sql/sql_show.cc:5559
#8  0x000055875a842b42 in fill_schema_table_by_open (thd=thd@entry=0x1504e4001aa8, mem_root=mem_root@entry=0x1505283b01f0, is_show_fields_or_keys=is_show_fields_or_keys@entry=false, table=table@entry=0x1504e403ad30, schema_table=schema_table@entry=0x55875bc1d440 <schema_tables+2176>, orig_db_name=orig_db_name@entry=0x1504e406d8c0, orig_table_name=0x1504e406d908, open_tables_state_backup=0x1505283b0230, can_deadlock=false) at /test/10.6_dbg/sql/sql_show.cc:4712
#9  0x000055875a863c8e in get_all_tables (thd=0x1504e4001aa8, tables=0x1504e4010678, cond=<optimized out>) at /test/10.6_dbg/sql/sql_show.cc:5367
#10 0x000055875a86519e in get_schema_tables_result (join=join@entry=0x1504e4012250, executed_place=executed_place@entry=PROCESSED_BY_JOIN_EXEC) at /test/10.6_dbg/sql/sql_show.cc:8912
#11 0x000055875a83bda9 in JOIN::exec_inner (this=this@entry=0x1504e4012250) at /test/10.6_dbg/sql/sql_select.cc:4791
#12 0x000055875a83c8bc in JOIN::exec (this=this@entry=0x1504e4012250) at /test/10.6_dbg/sql/sql_select.cc:4612
#13 0x000055875a83a794 in mysql_select (thd=thd@entry=0x1504e4001aa8, tables=0x1504e4010678, fields=@0x1504e40102f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1504e4010618, last = 0x1504e4010618, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202816219904, result=0x1504e4012190, unit=0x1504e4005e50, select_lex=0x1504e4010038) at /test/10.6_dbg/sql/sql_select.cc:5091
#14 0x000055875a83af8e in handle_select (thd=thd@entry=0x1504e4001aa8, lex=lex@entry=0x1504e4005d88, result=result@entry=0x1504e4012190, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.6_dbg/sql/sql_select.cc:559
#15 0x000055875a7c1d83 in mysql_execute_command (thd=thd@entry=0x1504e4001aa8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:4731
#16 0x000055875a7c7164 in mysql_parse (thd=0x1504e4001aa8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1505283b21c0) at /test/10.6_dbg/sql/sql_parse.cc:8050
#17 0x000055875abe29f2 in Query_log_event::do_apply_event (this=0x1504e402d4a8, rgi=0x1504e4000cf0, query_arg=0x1504e403cfa3 "INSERT INTO t SELECT table_rows FROM information_schema.tables", q_len_arg=<optimized out>) at /test/10.6_dbg/sql/sql_class.h:241
#18 0x000055875abe3348 in Query_log_event::do_apply_event (this=<optimized out>, rgi=<optimized out>) at /test/10.6_dbg/sql/log_event_server.cc:1605
#19 0x000055875a6ea3f4 in Log_event::apply_event (rgi=0x1504e4000cf0, this=0x1504e402d4a8) at /test/10.6_dbg/sql/log_event.h:1499
#20 apply_event_and_update_pos_apply (ev=ev@entry=0x1504e402d4a8, thd=thd@entry=0x1504e4001aa8, rgi=rgi@entry=0x1504e4000cf0, reason=reason@entry=0) at /test/10.6_dbg/sql/slave.cc:3894
#21 0x000055875a6f4413 in apply_event_and_update_pos (ev=ev@entry=0x1504e402d4a8, thd=thd@entry=0x1504e4001aa8, rgi=rgi@entry=0x1504e4000cf0) at /test/10.6_dbg/sql/slave.cc:4066
#22 0x000055875a6f6890 in exec_relay_log_event (serial_rgi=0x1504e4000cf0, rli=0x55875e0edbd0, thd=0x1504e4001aa8) at /test/10.6_dbg/sql/slave.cc:4427
#23 handle_slave_sql (arg=arg@entry=0x55875e0ebc70) at /test/10.6_dbg/sql/slave.cc:5630
#24 0x000055875ad5608c in pfs_spawn_thread (arg=0x1504ec209a08) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#25 0x000015052ea94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#26 0x000015052eb26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Comment by Roel Van de Paar [ 2024-01-15 ]

This bug is seen from 10.4 (or 10.3) to 11.1, after that we see MDEV-33244 instead.

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