#At file:///Users/mattiasj/clones/bzrroot/b40389-51-bugteam/
2690 Mattias Jonsson 2008-12-02
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
The non documented command 'ALTER PARTITION t REORGANIZE PARTITION'
(without any partitions!) which only make sense for nativly
partitioned engines, such as NDB, crashes the server if there was
no change of number of partitions.
The problem was wrong usage of fast_end_partition function,
which led to usage of a non initialized variable.
modified:
mysql-test/r/partition_mgm.result
mysql-test/t/partition_mgm.test
sql/partition_info.cc
sql/sql_partition.cc
per-file messages:
mysql-test/r/partition_mgm.result
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
Updated test result.
mysql-test/t/partition_mgm.test
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
Added new test case.
sql/partition_info.cc
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
Added DBUG_ASSERT to easier catch similar problems.
sql/sql_partition.cc
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
fast_end_partitions is called later in mysql_alter_table if
variable fast_alter_partition is set.
=== modified file 'mysql-test/r/partition_mgm.result'
--- a/mysql-test/r/partition_mgm.result 2007-11-13 10:12:53 +0000
+++ b/mysql-test/r/partition_mgm.result 2008-12-02 10:18:01 +0000
@@ -1,4 +1,11 @@
DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE MYISAM
+PARTITION BY HASH (a)
+PARTITIONS 1;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+ALTER TABLE t1 REORGANIZE PARTITION;
+DROP TABLE t1;
create table t1 (a int)
partition by range (a)
subpartition by key (a)
=== modified file 'mysql-test/t/partition_mgm.test'
--- a/mysql-test/t/partition_mgm.test 2007-11-13 10:12:53 +0000
+++ b/mysql-test/t/partition_mgm.test 2008-12-02 10:18:01 +0000
@@ -4,6 +4,17 @@ DROP TABLE IF EXISTS t1;
--enable_warnings
#
+# Bug 40389: REORGANIZE PARTITION crashes when only using one partition
+#
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE MYISAM
+PARTITION BY HASH (a)
+PARTITIONS 1;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+ALTER TABLE t1 REORGANIZE PARTITION;
+DROP TABLE t1;
+
+#
# Bug 21143: mysqld hang when error in number of subparts in
# REORGANIZE command
#
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2008-10-07 22:14:58 +0000
+++ b/sql/partition_info.cc 2008-12-02 10:18:01 +0000
@@ -867,6 +867,7 @@ bool partition_info::check_partition_inf
if (part_type != HASH_PARTITION || !list_of_part_fields)
{
+ DBUG_ASSERT(part_expr);
err= part_expr->walk(&Item::check_partition_func_processor, 0,
NULL);
if (!err && is_sub_partitioned() && !list_of_subpart_fields)
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2008-10-29 20:30:04 +0000
+++ b/sql/sql_partition.cc 2008-12-02 10:18:01 +0000
@@ -4228,9 +4228,8 @@ uint prep_alter_part_table(THD *thd, TAB
after the change as before. Thus we can reply ok immediately
without any changes at all.
*/
- DBUG_RETURN(fast_end_partition(thd, ULL(0), ULL(0),
- table, NULL,
- TRUE, NULL, FALSE));
+ *fast_alter_partition= TRUE;
+ DBUG_RETURN(FALSE);
}
else if (new_part_no > curr_part_no)
{
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (mattias.jonsson:2690) Bug#40389 | Mattias Jonsson | 2 Dec |