Bug #46086 crash when dropping a partitioned table and the original engine is disabled
Submitted: 9 Jul 2009 13:56 Modified: 14 Oct 2010 12:55
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.37, 5.1.40,5.4.4,6.0 OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any
Tags: crash, delete, partition

[9 Jul 2009 13:56] Shane Bester
Description:
5.1.37-debug stack trace:

mysqld.exe!ha_partition::create_handlers()[ha_partition.cc:2180]
mysqld.exe!ha_partition::get_from_handler_file()[ha_partition.cc:2348]
mysqld.exe!ha_partition::del_ren_cre_table()[ha_partition.cc:1804]
mysqld.exe!ha_partition::delete_table()[ha_partition.cc:429]
mysqld.exe!handler::ha_delete_table()[handler.cc:3314]
mysqld.exe!ha_delete_table()[handler.cc:1957]
mysqld.exe!mysql_rm_table_part2()[sql_table.cc:1955]
mysqld.exe!mysql_rm_table()[sql_table.cc:1749]
mysqld.exe!mysql_execute_command()[sql_parse.cc:3354]
mysqld.exe!mysql_parse()[sql_parse.cc:5933]
mysqld.exe!dispatch_command()[sql_parse.cc:1213]
mysqld.exe!do_command()[sql_parse.cc:854]
mysqld.exe!handle_one_connection()[sql_connect.cc:1127]
mysqld.exe!pthread_start()[my_winthread.c:85]
mysqld.exe!_callthreadstart()[thread.c:293]
mysqld.exe!_threadstart()[thread.c:277]
kernel32.dll!FlsSetValue()

I tested with innodb and blackhole engines disabled, both had the problem.
This bug is similar in nature to bug #39893 but crash is at different location.

How to repeat:
start server with innodb enabled:

drop table if exists `t1`;
create table `t1` (`id` int primary key) engine=innodb 
partition by key () partitions 1;

shutdown server, and start with --skip-innodb:

drop table if exists `t1`; #crashes
[9 Jul 2009 14:28] MySQL Verification Team
Thank you for the bug report. Verified as described:

c:\dbs>c:\dbs\6.0\bin\mysqld --defaults-file=c:\dbs\6.0\my.ini --standalone --console
090709 11:27:17 [Note] Plugin 'InnoDB' disabled by command line option
090709 11:27:18 [Note] Event Scheduler: Loaded 0 events
090709 11:27:18 [Note] c:\dbs\6.0\bin\mysqld: ready for connections.
Version: '6.0.12-alpha-Win X64-log'  socket: ''  port: 3600  Source distribution
090709 11:27:44 - mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338193 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x6bfa180
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
000000014021B12E    mysqld.exe!ha_partition::create_handlers()[ha_partition.cc:2198]
000000014021B41E    mysqld.exe!ha_partition::get_from_handler_file()[ha_partition.cc:2364]
00000001402221A7    mysqld.exe!ha_partition::del_ren_cre_table()[ha_partition.cc:1820]
0000000140222874    mysqld.exe!ha_partition::delete_table()[ha_partition.cc:430]
00000001400CDAA7    mysqld.exe!ha_delete_table()[handler.cc:1943]

<cut>
[8 Jul 2010 12:38] 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/113123

3469 Mattias Jonsson	2010-07-08
      Bug#46086: crash when dropping a partitioned table
                 and the original engine is disabled
      
      Missing check that engine is available.
     @ mysql-test/include/not_blackhole.inc
        new include file
     @ mysql-test/r/partition_not_blackhole.result
        new result file
     @ mysql-test/std_data/parts/t1_blackhole.frm
        blackhole partitioned table .frm file:
        create table `t1` (`id` int primary key) engine=blackhole
        partition by key () partitions 1;
     @ mysql-test/std_data/parts/t1_blackhole.par
        .par file matching blackhole partitioned .frm
     @ mysql-test/t/partition_not_blackhole-master.opt
        new master-opt to disable blackhole if compiled in.
     @ mysql-test/t/partition_not_blackhole.test
        New test
     @ sql/ha_partition.cc
        Added check that engine is available.
[19 Aug 2010 8:29] Mattias Jonsson
pushed into mysql-5.1-bugteam and mysql-5.5-merge
[20 Aug 2010 14:26] Jon Stephens
Documented in the 5.1.51 and 5.5.6 changelogs as follows:

        When the storage engine used to create a partitioned table was
        disabled, attempting to drop the table caused the server to
        crash.

Set NM, waiting for additional merge.
[25 Aug 2010 10:23] Bugs System
Pushed into mysql-5.5 5.5.6-m3 (revid:alik@ibmvm-20100825102234-a3q8x0l7voa13ts3) (version source revid:alik@ibmvm-20100825102234-a3q8x0l7voa13ts3) (merge vers: 5.5.6-m3) (pib:20)
[26 Aug 2010 10:25] Jon Stephens
Already documented in 5.5; set back to NM, waiting for merge to trunk.
[1 Sep 2010 13:13] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100901130501-4g2k86dub29auj8y) (version source revid:alik@sun.com-20100901130012-9bmmvzcnnw6n5rw6) (merge vers: 5.6.1-m4) (pib:21)
[1 Sep 2010 13:15] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100901130614-pgop3m80rmutewxn) (version source revid:alik@sun.com-20100901130033-8k19cjn6n2blm3py) (pib:21)
[1 Sep 2010 13:45] Jon Stephens
Also documented in the 5.6.1 changelog. Closed.
[28 Sep 2010 8:47] Bugs System
Pushed into mysql-5.1 5.1.52 (revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (version source revid:sunanda.menon@sun.com-20100928083322-wangbv97uobu7g66) (merge vers: 5.1.52) (pib:21)
[14 Oct 2010 8:27] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (merge vers: 5.1.51-ndb-7.0.20) (pib:21)
[14 Oct 2010 8:42] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (merge vers: 5.1.51-ndb-6.3.39) (pib:21)
[14 Oct 2010 8:57] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (merge vers: 5.1.51-ndb-6.2.19) (pib:21)
[14 Oct 2010 12:55] Jon Stephens
Already documented in 5.1.51; no new changelog entries required. Setting back to Closed.