[MDEV-29698] Server crash or assertion failure upon CREATE OR REPLACE with a MERGE table Created: 2022-10-04  Updated: 2023-05-18  Resolved: 2023-01-25

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table
Affects Version/s: 10.11
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: regression

Issue Links:
Blocks
is blocked by MDEV-29697 Assertion failure in Diagnostics_area... Closed
Duplicate
is duplicated by MDEV-29781 Server crashes in ha_myisammrg::add_c... Closed
Problem/Incident
is caused by MDEV-25292 Atomic CREATE OR REPLACE TABLE Stalled
Relates
relates to MDEV-29697 Assertion failure in Diagnostics_area... Closed
relates to MDEV-29781 Server crashes in ha_myisammrg::add_c... Closed

 Description   

There was a problem with the same scenario before MDEV-25292, see MDEV-29697. But it was a different one, a debug assertion failure in diagnostics area, of which we have many.
In 10.11, it became a specific assertion failure or a non-debug server crash. Due to the latter, technically it is a regression. Still, if the analysis reveals that the underlying cause is the same as in MDEV-29697, please feel free to unset the "Blocker" status and remove the regression label.

CREATE TABLE t (a INT) ENGINE=MyISAM;
CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
--error ER_UPDATE_TABLE_USED
CREATE OR REPLACE TABLE t LIKE tm;
 
# Cleanup
DROP TABLE IF EXISTS tm, t;

10.11 ba875e93 debug

mariadbd: /data/src/10.11/sql/sql_table.cc:4409: bool HA_CREATE_INFO::finalize_atomic_replace(THD*, TABLE_LIST*): Assertion `is_atomic_replace()' failed.
221004 13:51:29 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc4d67d3662 in __GI___assert_fail (assertion=0x55ecc713eae0 "is_atomic_replace()", file=0x55ecc713b160 "/data/src/10.11/sql/sql_table.cc", line=4409, function=0x55ecc713eb20 "bool HA_CREATE_INFO::finalize_atomic_replace(THD*, TABLE_LIST*)") at assert.c:101
#8  0x000055ecc5376322 in HA_CREATE_INFO::finalize_atomic_replace (this=0x7fc4cd4cab80, thd=0x62b00007e218, orig_table=0x6290000e6370) at /data/src/10.11/sql/sql_table.cc:4409
#9  0x000055ecc5380ebd in mysql_create_like_table (thd=0x62b00007e218, table=0x6290000e6370, src_table=0x6290000e6ac0, create_info=0x7fc4cd4cc810) at /data/src/10.11/sql/sql_table.cc:6004
#10 0x000055ecc53b39ba in Sql_cmd_create_table_like::execute (this=0x6290000e62e8, thd=0x62b00007e218) at /data/src/10.11/sql/sql_table.cc:12775
#11 0x000055ecc50bfec4 in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/10.11/sql/sql_parse.cc:5997
#12 0x000055ecc50cd2c0 in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "CREATE OR REPLACE TABLE t LIKE tm", length=33, parser_state=0x7fc4cd4cdab0) at /data/src/10.11/sql/sql_parse.cc:8037
#13 0x000055ecc50a3922 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000253219 "CREATE OR REPLACE TABLE t LIKE tm", packet_length=33, blocking=true) at /data/src/10.11/sql/sql_parse.cc:1894
#14 0x000055ecc50a06fa in do_command (thd=0x62b00007e218, blocking=true) at /data/src/10.11/sql/sql_parse.cc:1407
#15 0x000055ecc5547292 in do_handle_one_connection (connect=0x608000002538, put_in_cache=true) at /data/src/10.11/sql/sql_connect.cc:1416
#16 0x000055ecc5546c28 in handle_one_connection (arg=0x6080000024b8) at /data/src/10.11/sql/sql_connect.cc:1318
#17 0x000055ecc6120f94 in pfs_spawn_thread (arg=0x617000004d98) at /data/src/10.11/storage/perfschema/pfs.cc:2201
#18 0x00007fc4d6cafea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x00007fc4d689eaef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.11 ba875e93 non-debug

#3  <signal handler called>
#4  0x0000557d413e5542 in check_mysql50_prefix (name=name@entry=0x0) at /data/src/10.11/sql/sql_table.cc:438
#5  0x0000557d413e558b in check_n_cut_mysql50_prefix (from=0x0, to=0x7f07442d8e20 "o_PP_j", to_length=512) at /data/src/10.11/sql/sql_table.cc:459
#6  0x0000557d413e55dd in tablename_to_filename (from=0x0, to=0x7f07442d8e20 "o_PP_j", to_length=512) at /data/src/10.11/sql/sql_table.cc:492
#7  0x0000557d413e591d in build_table_filename (buff=buff@entry=0x7f07442d9500 "", bufflen=bufflen@entry=511, db=<optimized out>, table_name=0x0, ext=ext@entry=0x557d41c91d89 ".TRG", flags=1) at /data/src/10.11/sql/sql_table.cc:563
#8  0x0000557d4140267d in Table_triggers_list::check_n_load (thd=0x7f0728000c58, db=0x7f07442dc848, table_name=0x7f07442dc858, table=0x7f07442db810, names_only=true, flags=<optimized out>) at /data/src/10.11/sql/sql_trigger.cc:1539
#9  0x0000557d414035bf in Table_triggers_list::prepare_for_rename (thd=thd@entry=0x7f0728000c58, param=param@entry=0x7f07442db810, db=db@entry=0x7f07442dc848, old_alias=old_alias@entry=0x7f07442dbca0, old_table=old_table@entry=0x7f07442dc858, new_db=new_db@entry=0x7f07442dbc70, new_table=0x7f07442dbcb0) at /data/src/10.11/sql/sql_trigger.cc:2296
#10 0x0000557d413671c0 in rename_table_and_triggers (thd=thd@entry=0x7f0728000c58, param=param@entry=0x7f07442dbca0, ddl_log_state=ddl_log_state@entry=0x0, ren_table=ren_table@entry=0x7f07442dc848, new_db=new_db@entry=0x7f07442dbc70, skip_error=skip_error@entry=false, force_if_exists=0x7f07442dbc6f) at /data/src/10.11/sql/sql_rename.cc:367
#11 0x0000557d413ee8d1 in HA_CREATE_INFO::finalize_atomic_replace (this=this@entry=0x7f07442dc610, thd=thd@entry=0x7f0728000c58, orig_table=orig_table@entry=0x7f0728010c20) at /data/src/10.11/sql/sql_table.cc:4481
#12 0x0000557d413fe20d in mysql_create_like_table (create_info=0x7f07442dc280, src_table=0x7f0728011348, table=<optimized out>, thd=0x7f0728000c58) at /data/src/10.11/sql/sql_table.cc:6004
#13 Sql_cmd_create_table_like::execute (this=<optimized out>, thd=0x7f0728000c58) at /data/src/10.11/sql/sql_table.cc:12775
#14 0x0000557d413407a0 in mysql_execute_command (thd=0x7f0728000c58, is_called_from_prepared_stmt=<optimized out>) at /data/src/10.11/sql/sql_parse.cc:5997
#15 0x0000557d413419c7 in mysql_parse (thd=0x7f0728000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/src/10.11/sql/sql_parse.cc:8037
#16 0x0000557d413442bd in dispatch_command (command=COM_QUERY, thd=0x7f0728000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/src/10.11/sql/sql_class.h:243
#17 0x0000557d41345f98 in do_command (thd=0x7f0728000c58, blocking=blocking@entry=true) at /data/src/10.11/sql/sql_parse.cc:1407
#18 0x0000557d41463f0f in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /data/src/10.11/sql/sql_connect.cc:1416
#19 0x0000557d4146425d in handle_one_connection (arg=arg@entry=0x557d4486c598) at /data/src/10.11/sql/sql_connect.cc:1318
#20 0x0000557d417d4452 in pfs_spawn_thread (arg=0x557d44825438) at /data/src/10.11/storage/perfschema/pfs.cc:2201
#21 0x00007f0748e6dea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#22 0x00007f0748a74aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Aleksey Midenkov [ 2022-10-04 ]

Please review bb-10.11-midenok

Comment by Oleksandr Byelkin [ 2022-10-07 ]

OK to push

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