Bug #17005 Ndb partition handling for create table like is broken
Submitted: 1 Feb 2006 14:47 Modified: 14 Feb 2006 8:38
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.1.6-alpha OS:Linux (Linux 32 Bit OS)
Assigned to: Tomas Ulin CPU Architecture:Any

[1 Feb 2006 14:47] Jonathan Miller
Description:
rpl_misc_functions.test statement:  At line 25: query 'create table t2 like t1' cause slave to core. This may be due to freeing an invalid pointer.

*** glibc detected *** /home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld: free(): invalid pointer: 0x086e2d40 ***
======= Backtrace: =========
/lib/libc.so.6[0x916124]
/lib/libc.so.6(__libc_free+0x77)[0x91665f]
/home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld(_Z7lex_endP6st_lex+0x18)[0x8133458]
/home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld(_ZN3THD13end_statementEv+0x18)[0x81bfb58]
/home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld(_Z11mysql_parseP3THDPcj+0x35c)[0x81f478c]
/home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x55d)[0x81f4d8d]
/home/ndbdev/jmiller/clones/mysql-5.1-new/sql/mysqld(handle_one_connection+0x967)[0x81f6b17]
/lib/libpthread.so.0[0xa25b80]
/lib/libc.so.6(__clone+0x5e)[0x97d9ce]

Back trace from core on slave shows:
(gdb) bt
#0  0x00ff4402 in __kernel_vsyscall ()
#1  0x00a2855f in pthread_kill () from /lib/libpthread.so.0
#2  0x082ed95b in write_core (sig=29506) at stacktrace.c:220
#3  0x081d11b2 in handle_segfault (sig=6) at mysqld.cc:2190
#4  <signal handler called>
#5  0x00ff4402 in __kernel_vsyscall ()
#6  0x008db118 in raise () from /lib/libc.so.6
#7  0x008dc888 in abort () from /lib/libc.so.6
#8  0x0091022a in __libc_message () from /lib/libc.so.6
#9  0x00916124 in _int_free () from /lib/libc.so.6
#10 0x0091665f in free () from /lib/libc.so.6
#11 0x08133458 in lex_end (lex=0x21d50c) at sql_lex.cc:198
#12 0x081bfb58 in THD::end_statement (this=0x9a56a68) at sql_class.cc:1683
#13 0x081f478c in mysql_parse (thd=0x9a56a68, inBuf=0x9a634c8 "create table t2 like t1",
    length=23) at sql_parse.cc:5725
#14 0x081f4d8d in dispatch_command (command=COM_QUERY, thd=0x9a56a68, packet=Variable "packet" is not available.
)
    at sql_parse.cc:1764
#15 0x081f6b17 in handle_one_connection (arg=0x9a56a68) at sql_parse.cc:1536
#16 0x00a25b80 in start_thread () from /lib/libpthread.so.0
#17 0x0097d9ce in clone () from /lib/libc.so.6

This is a release build built with BUILD/compile-pentium-max.

Clone on my system was refreshed and rebuilt yesterday.

This does not occur if NDB is not used. 

Please contact me if more information is needed.

How to repeat:
Test break down. Create a test called rpl_ndb_1.test (or what ever you like)
Insert:
source include/master-slave.inc;

create table t1(id int, i int, r1 int, r2 int, p varchar(100));
sync_slave_with_master;
create table t2 like t1;
connection master;
DROP TABLE t1, t2;

touch ./r/rpl_ndb_1.result

./mysql-test-run --with-ndbcluster-all --ndb-extra-test  --force --mysqld=--default-storage-engine=ndb --do-test=rpl_ndb_1

Should get:
Errors are (from /home/ndbdev/jmiller/clones/mysql-5.1-new/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 5: query 'create table t2 like t1' failed: 2013: Lost connection to MySQL server during query
(the last lines may be the most important ones)
[7 Feb 2006 14:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/2245
[7 Feb 2006 14:59] Tomas Ulin
pushed to 5.1.7

for documentation.  Command was broken for ndb tables.  Non deterministic behavior, and sometimes core dumps.
[14 Feb 2006 8:38] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented bugfix in 5.1.7 changelog. Closed.