From 6538f19f9a73c1102f4ca240bda6aa58799aba6b Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 2 Dec 2008 11:18:01 +0100 Subject: 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. 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. --- sql/sql_partition.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sql/sql_partition.cc') diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index da80a2125e9..6fb803ce4ff 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4228,9 +4228,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, 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) { -- cgit v1.2.1