From c6ac9185bc24f774c8c0730162f54dc6f056e432 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 18 Dec 2006 14:39:23 +0400 Subject: [PATCH] bug #24502 (reorganize partition closes connection) when REORGANIZE creates new partition, no_subparts for that partition isn't set right (call handler::set_partitions_defaults always returns 1) Normally the number of subpartitions should be inherited from the table. mysql-test/r/partition.result: result fixed mysql-test/t/partition.test: testcase sql/sql_partition.cc: no_subparts is set for newly created partitions --- mysql-test/r/partition.result | 10 ++++++++++ mysql-test/t/partition.test | 16 ++++++++++++++++ sql/sql_partition.cc | 1 + 3 files changed, 27 insertions(+) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 5a8f5a3137d..55ba8380665 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1128,4 +1128,14 @@ a 18446744073709551613 18446744073709551614 drop table t1; +CREATE TABLE t1 ( +num int(11) NOT NULL, cs int(11) NOT NULL) +PARTITION BY RANGE (num) SUBPARTITION BY HASH ( +cs) SUBPARTITIONS 2 (PARTITION p_X VALUES LESS THAN MAXVALUE); +ALTER TABLE t1 +REORGANIZE PARTITION p_X INTO ( +PARTITION p_100 VALUES LESS THAN (100), +PARTITION p_X VALUES LESS THAN MAXVALUE +); +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 8cb5e76d85b..02c7ca0b05c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1354,4 +1354,20 @@ delete from t1 where a = 18446744073709551615; select * from t1; drop table t1; +# +# Bug 24502 reorganize partition closes connection +# +CREATE TABLE t1 ( + num int(11) NOT NULL, cs int(11) NOT NULL) +PARTITION BY RANGE (num) SUBPARTITION BY HASH ( +cs) SUBPARTITIONS 2 (PARTITION p_X VALUES LESS THAN MAXVALUE); + +ALTER TABLE t1 +REORGANIZE PARTITION p_X INTO ( + PARTITION p_100 VALUES LESS THAN (100), + PARTITION p_X VALUES LESS THAN MAXVALUE + ); + +drop table t1; + --echo End of 5.1 tests diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index dcc35293b84..a433417d2b0 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4739,6 +4739,7 @@ state of p1. } alt_part_info->part_type= tab_part_info->part_type; alt_part_info->subpart_type= tab_part_info->subpart_type; + alt_part_info->no_subparts= tab_part_info->no_subparts; DBUG_ASSERT(!alt_part_info->use_default_partitions); if (alt_part_info->set_up_defaults_for_partitioning(table->file, ULL(0),