[MDEV-9949] Connect Engine: long SRCDEF leads to broken table Created: 2016-04-19  Updated: 2020-05-12  Resolved: 2016-05-05

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.1.13, 10.0, 10.1, 10.2
Fix Version/s: 10.1.14

Type: Bug Priority: Major
Reporter: Sergey Antonyuk Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux


Attachments: File mdev9949.sql    
Sprint: 10.1.14

 Description   

I've found a problem with connect engine using SRCDEF notation when creating a table. The problem is a broken table created when SRCDEF parameter contains an sql query more than 32 kb long. For example, sql query with long list of ids in "where x IN ( ... )" conditional statement.

The following error appears on create table: "Engine CONNECT failed to discover table `db`.`connect_1` with 'CREATE TABLE whatever .... skip

The table can't be dropped due to the error: "Incorrect information in file './db/connect_1.frm'".

The desired behaviour is to get the ability to use long queries in SRCDEF parameter with the length limited by some configuration parameter.



 Comments   
Comment by Elena Stepanova [ 2016-04-20 ]

I suppose it will still be limited by the size of .frm file, but it should be more than 32K.

Comment by Elena Stepanova [ 2016-04-20 ]

As an additional note – after the problem happens, an attempt to DROP the problematic table causes assertion failure on a debug build:

Stack trace from 10.0 commit f8adeccd78bff80725a95b73447e34a5f4528179

mysqld: /src/10.0/sql/sql_error.cc:378: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `! is_set()' failed.
160420 16:17:22 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fb4783531d2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000648210 in Diagnostics_area::set_ok_status (this=0x7fb45ffb7368, affected_rows=0, last_insert_id=0, message=0x0) at /src/10.0/sql/sql_error.cc:378
#9  0x000000000060522a in my_ok (thd=0x7fb45ffb26b0, affected_rows=0, id=0, message=0x0) at /src/10.0/sql/sql_class.h:3813
#10 0x0000000000713030 in mysql_rm_table (thd=0x7fb45ffb26b0, tables=0x7fb44dc22168, if_exists=1 '\001', drop_temporary=0 '\000') at /src/10.0/sql/sql_table.cc:2111
#11 0x000000000066fbb8 in mysql_execute_command (thd=0x7fb45ffb26b0) at /src/10.0/sql/sql_parse.cc:3695
#12 0x0000000000677479 in mysql_parse (thd=0x7fb45ffb26b0, rawbuf=0x7fb44dc22088 "drop table if exists tcon", length=25, parser_state=0x7fb47a3e66a0) at /src/10.0/sql/sql_parse.cc:6565
#13 0x0000000000669f45 in dispatch_command (command=COM_QUERY, thd=0x7fb45ffb26b0, packet=0x7fb44dd26a71 "drop table if exists tcon", packet_length=25) at /src/10.0/sql/sql_parse.cc:1308
#14 0x0000000000669212 in do_command (thd=0x7fb45ffb26b0) at /src/10.0/sql/sql_parse.cc:998
#15 0x00000000007878a7 in do_handle_one_connection (thd_arg=0x7fb45ffb26b0) at /src/10.0/sql/sql_connect.cc:1377
#16 0x0000000000787619 in handle_one_connection (arg=0x7fb45ffb26b0) at /src/10.0/sql/sql_connect.cc:1292
#17 0x00007fb47a0760a4 in start_thread () from /lib64/libpthread.so.0

For the convenience, I've attached the SQL file which helps to reproduce the initial problem. The second attempt to run it causes the assertion failure as above.

Comment by Olivier Bertrand [ 2016-04-20 ]

Thanks Elena for the attached SQL file.
Using it I had the same problems. However, debugging the discovery program I found no error in CONNECT. What happens is that after constructing the SQL create table statement and calling table_s->init_from_sql_statement_string an error occured, apparently when executing init_from_binary_frm_image.
Besides, when adding the column definition in the CREATE TABLE statement the same error occurs before any CONNECT code is called and the table is not created.
Therefore, this does not seem to be a CONNECT bug but a problem of MariaDB not able to handle long CREATE TABLE statements. Indeed, CREATE TABLE statements are probably never so long for other engines!

By the way, I also experienced the assertion failure at:

2016-04-20 17:05:07 3224 [ERROR] mysqld.exe: Incorrect information in file: '.\test\tcon.frm'
Assertion failed: ! is_set(), file sql_error.cc, line 378
R6010
- abort() has been called

Once more I denounce that infamous ASSERT that should definitely be removed from MariaDB.

Generated at Thu Feb 08 07:38:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.