Bug #46357 Crash in partition_info::print_no_partition_found on TRUNCATE PARTITION
Submitted: 23 Jul 2009 14:09 Modified: 23 Jul 2009 15:58
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.4 OS:Any
Assigned to: Mikael Ronström CPU Architecture:Any

[23 Jul 2009 14:09] Philip Stoev
Description:
When executing a non-concurrent workload containing ALTER TABLE TRUNCATE PARTITION, mysqld crashed as follows:

# 16:51:56 #2  0x000000000066a44e in handle_segfault (sig=11) at mysqld.cc:2718
# 16:51:56 #3  <signal handler called>
# 16:51:56 #4  0x00000000008892cd in partition_info::print_no_partition_found (this=0x316d790, table=0x45e09c8) at partition_info.cc:1111
# 16:51:56 #5  0x00000000007d167a in ha_partition::print_error (this=0x4969800, error=160, errflag=0) at ha_partition.cc:6129
# 16:51:56 #6  0x00000000007468e5 in mysql_delete (thd=0x7f6838caeb78, table_list=0x2fca578, conds=0x0, order=0x0, limit=18446744073709551615, options=0,
# 16:51:56     reset_auto_increment=true) at sql_delete.cc:160
# 16:51:56 #7  0x0000000000747767 in mysql_truncate_by_delete (thd=0x7f6838caeb78, table_list=0x2fca578) at sql_delete.cc:1050
# 16:51:56 #8  0x0000000000747e08 in mysql_truncate (thd=0x7f6838caeb78, table_list=0x2fca578, dont_send_ok=false) at sql_delete.cc:1220
# 16:51:56 #9  0x000000000067f357 in mysql_execute_command (thd=0x7f6838caeb78) at sql_parse.cc:3327
# 16:51:56 #10 0x0000000000684978 in mysql_parse (thd=0x7f6838caeb78, inBuf=0x2fca240 "/*!50100 ALTER TABLE o TRUNCATE PARTITION p3 */", length=47,
# 16:51:56     found_semicolon=0x7f6835572f10) at sql_parse.cc:5942
# 16:51:56 #11 0x0000000000685593 in dispatch_command (command=COM_QUERY, thd=0x7f6838caeb78, packet=0x7f6838cb94d9 "/*!50100 ALTER TABLE o TRUNCATE PARTITION p3 */",
# 16:51:56     packet_length=47) at sql_parse.cc:1061
# 16:51:56 #12 0x0000000000686a99 in do_command (thd=0x7f6838caeb78) at sql_parse.cc:743
# 16:51:56 #13 0x0000000000673b97 in handle_one_connection (arg=0x7f6838caeb78) at sql_connect.cc:1158
# 16:51:56 #14 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
# 16:51:56 #15 0x000000315a4e627d in clone () from /lib64/libc.so.6

How to repeat:
A simplifed test case will be provided shortly.
[23 Jul 2009 15:07] Philip Stoev
The only thing required is to attempt to TRUNCATE a non-existing partition:

CREATE TABLE IF NOT EXISTS t1 ( `int_key` INTEGER NOT NULL, KEY (`int_key`) )PARTITION BY KEY(`int_key`) PARTITIONS 1;
ALTER TABLE t1 TRUNCATE PARTITION p2;
[23 Jul 2009 15:58] Mikael Ronström
Fixed by bug fix for bug#46354