summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-09-07 10:37:54 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-09-07 10:37:54 +0200
commitdd407c5228df80a7ef6086c412940084e7498627 (patch)
tree0dd15ac79104c65a242a9f9c551d7a048c91c031
parent9d82084d20b172c68fc84f2f1d0bc3a7b2ee2c2e (diff)
downloadmariadb-git-dd407c5228df80a7ef6086c412940084e7498627.tar.gz
Fix to ensure that all subpartitions gets deleted before renaming starts, BUG#47029
-rw-r--r--mysql-test/r/partition_innodb.result14
-rw-r--r--mysql-test/t/partition_innodb.test17
-rw-r--r--sql/ha_partition.cc1
3 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index ad4d08e89ff..9c5675c0c75 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -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),
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 2abbceffbb0..b29ce289811 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -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
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index ac8c46ec4e3..2e303744c1a 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -705,6 +705,7 @@ int ha_partition::rename_partitions(const char *path)
if (m_is_sub_partitioned)
{
List_iterator<partition_element> sub_it(part_elem->subpartitions);
+ j= 0;
do
{
sub_elem= sub_it++;