#At file:///home/mikael/mysql_clones/mysql-5.1-bugteam-bug47029/
3105 Mikael Ronstrom 2009-09-07
Fix to ensure that all subpartitions gets deleted before renaming starts, BUG#47029
modified:
mysql-test/r/partition_innodb.result
mysql-test/t/partition_innodb.test
sql/ha_partition.cc
=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result 2008-11-10 20:13:24 +0000
+++ b/mysql-test/r/partition_innodb.result 2009-09-07 08:37:54 +0000
@@ -1,4 +1,18 @@
drop table if exists t1;
+create table t1 (a int not null,
+b datetime not null,
+primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+partition p1 values less than (to_days('2009-02-01')),
+partition p2 values less than (to_days('2009-03-01')),
+partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
PARTITION BY RANGE(id) (
PARTITION p0 VALUES LESS THAN (5),
=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test 2008-11-14 22:51:17 +0000
+++ b/mysql-test/t/partition_innodb.test 2009-09-07 08:37:54 +0000
@@ -6,6 +6,23 @@ drop table if exists t1;
--enable_warnings
#
+# Bug#47029: Crash when reorganize partition with subpartition
+#
+create table t1 (a int not null,
+ b datetime not null,
+ primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+ partition p1 values less than (to_days('2009-02-01')),
+ partition p2 values less than (to_days('2009-03-01')),
+ partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
+#
# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
# with partitions
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2009-08-21 15:38:29 +0000
+++ b/sql/ha_partition.cc 2009-09-07 08:37:54 +0000
@@ -705,6 +705,7 @@ int ha_partition::rename_partitions(cons
if (m_is_sub_partitioned)
{
List_iterator<partition_element> sub_it(part_elem->subpartitions);
+ j= 0;
do
{
sub_elem= sub_it++;