Bug #19830 REORGANIZE PARTITION causes crash on 5.1.9
Submitted: 15 May 2006 19:33 Modified: 27 May 2006 18:39
Reporter: Robin Schumacher Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.9/5.1BK OS:Linux (Fedora core 4)
Assigned to: Mikael Ronström CPU Architecture:Any

[15 May 2006 19:33] Robin Schumacher
Description:
Attempt to reorganize an existing MyISAM partitioned table to split partitions causes crash.

How to repeat:
CREATE TABLE `t1` (
  `c1` int(11) DEFAULT NULL,
  `c2` varchar(30) DEFAULT NULL,
  `c3` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

*** fill with 8 million rows ***

mysql> alter table t1
    -> partition by range (year(c3))
    -> (PARTITION p5 VALUES LESS THAN (2000), PARTITION p10 VALUES LESS THAN (2010));

mysql> alter table t1
    -> reorganize partition p5 into
    -> (PARTITION p1 VALUES LESS THAN (1996),
    ->  PARTITION p2 VALUES LESS THAN (1997),
    ->  PARTITION p3 VALUES LESS THAN (1998),
    ->  PARTITION p4 VALUES LESS THAN (1999),
    ->  PARTITION p5 VALUES LESS THAN (2000));

Crash...
[15 May 2006 19:51] Miguel Solorzano
Thank you for the bug report.

miguel@hegel:~/dbs/5.1> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.1.11-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE `t1` (
    ->   `c1` int(11) DEFAULT NULL,
    ->   `c2` varchar(30) DEFAULT NULL,
    ->   `c3` date DEFAULT NULL
    -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.01 sec)

mysql> alter table t1
    -> partition by range (year(c3))
    -> (PARTITION p5 VALUES LESS THAN (2000), PARTITION p10 VALUES LESS THAN
    -> (2010));
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table t1
    -> reorganize partition p5 into
    -> (PARTITION p1 VALUES LESS THAN (1996),
    -> PARTITION p2 VALUES LESS THAN (1997),
    -> PARTITION p3 VALUES LESS THAN (1998),
    -> PARTITION p4 VALUES LESS THAN (1999),
    -> PARTITION p5 VALUES LESS THAN (2000));

[New Thread 1101630384 (LWP 5671)]
060515 16:46:49 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.11-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1118682032 (LWP 5698)]
[Thread 1118682032 (zombie) exited]
[New Thread 1118682032 (LWP 5700)]
[Thread 1118682032 (zombie) exited]
[New Thread 1118682032 (LWP 5702)]
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1118682032 (LWP 5702)]
0x083419e2 in ha_partition::prepare_for_delete (this=0x93196d8) at ha_partition.cc:4795
4795          if ((tmp= (*file)->extra(HA_EXTRA_PREPARE_FOR_DELETE)))
(gdb)
[27 May 2006 18:39] Mikael Ronström
The patch developed for BUG#19122 solves this one as well