Bug #39236 Truncate temporary federated table crashes server
Submitted: 4 Sep 2008 10:03
Reporter: Sveta Smirnova Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Federated storage engine Severity:S3 (Non-critical)
Version:5.0 bzr OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D1 (Critical)

[4 Sep 2008 10:03] Sveta Smirnova
If trying to truncate temporary federated table server crashes.

How to repeat:
-- source include/not_embedded.inc
source include/federated.inc;

connection slave;
DROP TABLE IF EXISTS federated.bug_13118_table;

CREATE TABLE federated.bug_13118_table (
  `foo` integer,
  `bar` integer

connection master;
DROP TABLE IF EXISTS federated.t1;

--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TEMPORARY TABLE federated.t1 (
    `foo` integer,
    `bar` integer

truncate table federated.t1;

Suggested fix:
Process truncate correctly like for not temporary federated table or send error to user instead of crashing.
[4 Sep 2008 10:07] Sveta Smirnova

#0  0x002ce402 in __kernel_vsyscall ()
#1  0x0046264f in pthread_kill () from /lib/libpthread.so.0
#2  0x083b6ab2 in write_core (sig=11) at stacktrace.c:254
#3  0x08226897 in handle_segfault (sig=11) at mysqld.cc:2376
#4  <signal handler called>
#5  0x083ef726 in ha_federated::info (this=0xa161dd8, flag=66) at ha_federated.cc:2624
#6  0x082d31c0 in mysql_truncate (thd=0xa137990, table_list=0xa138f40, dont_send_ok=false) at sql_delete.cc:906
#7  0x08247dd0 in mysql_execute_command (thd=0xa137990) at sql_parse.cc:3705
#8  0x0824d2ad in mysql_parse (thd=0xa137990, inBuf=0xa138ea8 "truncate table federated.t1", length=27, found_semicolon=0xb744c250) at sql_parse.cc:6185
#9  0x0824ddcd in dispatch_command (command=COM_QUERY, thd=0xa137990, packet=0xa141a09 "truncate table federated.t1", packet_length=28) at sql_parse.cc:1874
#10 0x0824f2f5 in do_command (thd=0xa137990) at sql_parse.cc:1580
#11 0x0824f7d6 in handle_one_connection (arg=0xa137990) at sql_parse.cc:1186
#12 0x0045fbd4 in start_thread () from /lib/libpthread.so.0
#13 0x003b74fe in clone () from /lib/libc.so.6