Bug #39893 Crash if select on a partitioned table, when partitioning is disabled
Submitted: 6 Oct 2008 22:22 Modified: 15 Sep 2009 9:50
Reporter: Mattias Jonsson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any

[6 Oct 2008 22:22] Mattias Jonsson
Description:
When using a binary where partitioning support is compiled in, it will crash if one uses a partitioned table, when partitioning is disabled.

Currently the workaround is to do ALTER TABLE t1 REMOVE PARTITIONING before restarting it without partitioning support.

How to repeat:
use a build with partitioning support
./mtr --start-and-exit
CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 2;
(shut down the server)
./mtr --start-dirty --skip-partition
SELECT * FROM t1;

Suggested fix:
When opening the frm-file, verify that the plugin/engine/partitioning is supported before doing partitioning related calls.
[7 Oct 2008 3:47] Valeriy Kravchuk
Verified just as described with 5.1.30 from bzr. Stack trace is:

(my_print_stacktrace+0x29)[0x86a4678]
(handle_segfault+0x253)[0x828512f]
[0xffffe420]
(_Z21open_table_from_shareP3THDP14st_table_sharePKcjjjP8st_tableb+0x7bb)[0x82ee7d5]
[0x82df9f1]
(_Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootPbj+0xf8d)[0x82dd7e5]
(_Z11open_tablesP3THDPP10TABLE_LISTPjj+0x351)[0x82e0b4d]
(_Z28open_and_lock_tables_derivedP3THDP10TABLE_LISTb+0x8d)[0x82e15fd]
(_Z20open_and_lock_tablesP3THDP10TABLE_LIST+0x20)[0x82a2c76]
[0x829c853]
(_Z21mysql_execute_commandP3THD+0x6dd)[0x8294ec3]
(_Z11mysql_parseP3THDPKcjPS2_+0x1d5)[0x829e9d7]
(_Z16dispatch_command19enum_server_commandP3THDPcj+0x9c9)[0x8292f97]
(_Z10do_commandP3THD+0x254)[0x8292340]
(handle_one_connection+0x123)[0x8290a47]
...
[14 Oct 2008 22:41] Omer Barnir
setting tag to CHECKED
[8 Jan 2009 14:17] 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/62697

2756 Mattias Jonsson	2009-01-08
      Bug#39893: Crash if select on a partitioned table, when partitioning is disabled
      
      Problem was that it tried to run partitioning function calls when
      opening a partitioned table, when it was explicitly disabled.
      
      Solution is to check if the partitioning plugin is ready to use before
      using any partitioning specific calls.
[2 Sep 2009 16:41] Bugs System
Pushed into 5.1.39 (revid:joro@sun.com-20090902154533-8actmfcsjfqovgsb) (version source revid:mattias.jonsson@sun.com-20090812094608-nrazvdcjxq6nev9f) (merge vers: 5.1.38) (pib:11)
[3 Sep 2009 12:33] Jon Stephens
Documented in the 5.1.39 changelog as follows:

      Attempting to access a partitioned table when partitioning support 
      was disabled in a MySQL server binary compiled with partitioning 
      support caused the server to crash.

Set status as NDI, waiting for push to 5.4 tree.
[14 Sep 2009 16:02] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[15 Sep 2009 9:50] Jon Stephens
Bugfix also documented in the 5.4.4 changelog. 

Closed.
[1 Oct 2009 5:58] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[2 Oct 2009 0:13] Paul DuBois
Moved 5.4 changelog entry from 5.4.4 to 5.4.3.
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)