[MDEV-22435] Assisted discovery of table with application period fails, server crashes Created: 2020-05-02  Updated: 2021-05-26

Status: Confirmed
Project: MariaDB Server
Component/s: Data Definition - Create Table, Storage Engine - Federated, Versioned Tables
Affects Version/s: 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
Relates
relates to MDEV-17227 Server crash in TABLE_SHARE::init_fro... Closed

 Description   

Note: same crash as in MDEV-17227, but in a very different scenario.

create table t1 (a int, s date, e date, period for se(s,e));
install soname 'ha_federatedx';
eval create table t2 engine=federated connection="mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1";

10.4 503fd211

#3  <signal handler called>
#4  0x000056204cdeafd0 in TABLE_SHARE::init_from_sql_statement_string (this=0x7f58ec459dd0, thd=0x7f58dc000af0, write=true, sql=0x7f58ec4593e0 "CREATE TABLE `t1` (\n  `a` int(11) DEFAULT NULL,\n  `s` date NOT NULL,\n  `e` date NOT NULL,\n  PERIOD FOR `se` (`s`, `e`)\n) CONNECTION='mysql://root@127.0.0.1:16000/test/t1'", sql_length=170) at /data/src/10.4/sql/table.cc:3185
#5  0x00007f58ec1ff930 in ha_federatedx::discover_assisted (hton=0x7f58dc12fee0, thd=0x7f58dc000af0, table_s=0x7f58ec459dd0, info=0x7f58ec45a9b0) at /data/src/10.4/storage/federatedx/ha_federatedx.cc:3668
#6  0x000056204cda429c in create_table_impl (thd=0x7f58dc000af0, orig_db=..., orig_table_name=..., db=..., table_name=..., path=0x7f58ec45a570 "./test/t2", options=..., create_info=0x7f58ec45a9b0, alter_info=0x7f58ec45a8f0, create_table_mode=-3, is_trans=0x7f58ec45a7ce, key_info=0x7f58ec45a550, key_count=0x7f58ec45a544, frm=0x7f58ec45a560) at /data/src/10.4/sql/sql_table.cc:5030
#7  0x000056204cda487f in mysql_create_table_no_lock (thd=0x7f58dc000af0, db=0x7f58dc013320, table_name=0x7f58dc013330, create_info=0x7f58ec45a9b0, alter_info=0x7f58ec45a8f0, is_trans=0x7f58ec45a7ce, create_table_mode=-3, table_list=0x7f58dc013308) at /data/src/10.4/sql/sql_table.cc:5157
#8  0x000056204cda4c81 in mysql_create_table (thd=0x7f58dc000af0, create_table=0x7f58dc013308, create_info=0x7f58ec45a9b0, alter_info=0x7f58ec45a8f0) at /data/src/10.4/sql/sql_table.cc:5246
#9  0x000056204cdb700c in Sql_cmd_create_table_like::execute (this=0x7f58dc0132a8, thd=0x7f58dc000af0) at /data/src/10.4/sql/sql_table.cc:11462
#10 0x000056204ccc942e in mysql_execute_command (thd=0x7f58dc000af0) at /data/src/10.4/sql/sql_parse.cc:6101
#11 0x000056204ccce8f3 in mysql_parse (thd=0x7f58dc000af0, rawbuf=0x7f58dc013198 "create table t2 engine=federated connection=\"mysql://root@127.0.0.1:16000/test/t1\"", length=82, parser_state=0x7f58ec45b570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
#12 0x000056204ccbaea3 in dispatch_command (command=COM_QUERY, thd=0x7f58dc000af0, packet=0x7f58dc136211 "create table t2 engine=federated connection=\"mysql://root@127.0.0.1:16000/test/t1\"", packet_length=82, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#13 0x000056204ccb9645 in do_command (thd=0x7f58dc000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#14 0x000056204ce410e0 in do_handle_one_connection (connect=0x56204fc86cc0) at /data/src/10.4/sql/sql_connect.cc:1412
#15 0x000056204ce40e2f in handle_one_connection (arg=0x56204fc86cc0) at /data/src/10.4/sql/sql_connect.cc:1316
#16 0x000056204d83f17f in pfs_spawn_thread (arg=0x56204fbf54f0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#17 0x00007f58f423a4a4 in start_thread (arg=0x7f58ec45c700) at pthread_create.c:456
#18 0x00007f58f236ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.4+, debug and non-debug alike.



 Comments   
Comment by Sergei Golubchik [ 2021-01-10 ]

The crash is fixed in MDEV-17227, but it still not clear why the table isn't discovered

Comment by Elena Stepanova [ 2021-05-26 ]

Now instead of the SIGSEGV crash there is an assertion on debug builds (or inability to discover the table on non-debug builds, as the comment above says):

10.4 1dea7f79 debug

mysqld: /data/src/10.4/sql/unireg.cc:60: uchar* extra2_write_len(uchar*, size_t): Assertion `len' failed.
210526 19:58:13 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f07b29f6f36 in __GI___assert_fail (assertion=0x559a9953b06e "len", file=0x559a9953b072 "/data/src/10.4/sql/unireg.cc", line=60, function=0x559a9953b090 "uchar* extra2_write_len(uchar*, size_t)") at assert.c:101
#8  0x0000559a989531a3 in extra2_write_len (pos=0x7f079c18efc7 "", len=0) at /data/src/10.4/sql/unireg.cc:60
#9  0x0000559a98953283 in extra2_write_str (pos=0x7f079c18efc7 "", str=...) at /data/src/10.4/sql/unireg.cc:78
#10 0x0000559a989542ad in build_frm_image (thd=0x7f079c000d90, table=..., create_info=0x7f07ac8758e8, create_fields=..., keys=0, key_info=0x7f079c016b98, db_file=0x7f079c0164b8) at /data/src/10.4/sql/unireg.cc:375
#11 0x0000559a988e9ab1 in mysql_create_frm_image (thd=0x7f079c000d90, db=..., table_name=..., create_info=0x7f07ac8758e8, alter_info=0x7f07ac875d58, create_table_mode=0, key_info=0x7f07ac874328, key_count=0x7f07ac874324, frm=0x7f07ac874370) at /data/src/10.4/sql/sql_table.cc:4896
#12 0x0000559a98932958 in TABLE_SHARE::init_from_sql_statement_string (this=0x7f07ac876d90, thd=0x7f079c000d90, write=true, sql=0x7f07ac876390 "CREATE TABLE `t1` (\n  `a` int(11) DEFAULT NULL,\n  `s` date NOT NULL,\n  `e` date NOT NULL,\n  PERIOD FOR `se` (`s`, `e`)\n) CONNECTION='mysql://root@127.0.0.1:16000/test/t1'", sql_length=170) at /data/src/10.4/sql/table.cc:3187
#13 0x00007f07ac819e84 in ha_federatedx::discover_assisted (hton=0x7f079c187800, thd=0x7f079c000d90, table_s=0x7f07ac876d90, info=0x7f07ac877970) at /data/src/10.4/storage/federatedx/ha_federatedx.cc:3685
#14 0x0000559a988ea474 in create_table_impl (thd=0x7f079c000d90, orig_db=..., orig_table_name=..., db=..., table_name=..., path=0x7f07ac877530 "./test/t2", options=..., create_info=0x7f07ac877970, alter_info=0x7f07ac8778b0, create_table_mode=-3, is_trans=0x7f07ac87778e, key_info=0x7f07ac877510, key_count=0x7f07ac877504, frm=0x7f07ac877520) at /data/src/10.4/sql/sql_table.cc:5112
#15 0x0000559a988eaa51 in mysql_create_table_no_lock (thd=0x7f079c000d90, db=0x7f079c014928, table_name=0x7f079c014938, create_info=0x7f07ac877970, alter_info=0x7f07ac8778b0, is_trans=0x7f07ac87778e, create_table_mode=-3, table_list=0x7f079c014910) at /data/src/10.4/sql/sql_table.cc:5236
#16 0x0000559a988eae75 in mysql_create_table (thd=0x7f079c000d90, create_table=0x7f079c014910, create_info=0x7f07ac877970, alter_info=0x7f07ac8778b0) at /data/src/10.4/sql/sql_table.cc:5331
#17 0x0000559a988fda5e in Sql_cmd_create_table_like::execute (this=0x7f079c0148b0, thd=0x7f079c000d90) at /data/src/10.4/sql/sql_table.cc:11590
#18 0x0000559a988091fe in mysql_execute_command (thd=0x7f079c000d90) at /data/src/10.4/sql/sql_parse.cc:6189
#19 0x0000559a9880e5eb in mysql_parse (thd=0x7f079c000d90, rawbuf=0x7f079c0147a8 "create table t2 engine=federated connection=\"mysql://root@127.0.0.1:16000/test/t1\"", length=82, parser_state=0x7f07ac8784d0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7992
#20 0x0000559a987fa92b in dispatch_command (command=COM_QUERY, thd=0x7f079c000d90, packet=0x7f079c00ac01 "create table t2 engine=federated connection=\"mysql://root@127.0.0.1:16000/test/t1\"", packet_length=82, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
#21 0x0000559a987f9191 in do_command (thd=0x7f079c000d90) at /data/src/10.4/sql/sql_parse.cc:1373
#22 0x0000559a9898a218 in do_handle_one_connection (connect=0x559a9cae0f20) at /data/src/10.4/sql/sql_connect.cc:1412
#23 0x0000559a98989f61 in handle_one_connection (arg=0x559a9cae0f20) at /data/src/10.4/sql/sql_connect.cc:1316
#24 0x0000559a993b7bb2 in pfs_spawn_thread (arg=0x559a9cab9d20) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#25 0x00007f07b2f0e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#26 0x00007f07b2ae2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.4 1dea7f79 non-debug

mysqltest: At line 3: query 'create table t2 engine=federated connection="mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1"' failed: 1939: Engine FEDERATED failed to discover table `test`.`t2` with 'CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `s` date NOT NULL,
  `e` date NOT NULL,
  PERIOD FOR `se` (`s`, `e`)
) CONNECTION='mysql://root@127.0.0.1:16000/test/t1''

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