From 1e12f9462b4cbdbafe3ed48a446076979fab38bf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 May 2006 07:37:03 -0400 Subject: [PATCH 1/5] BUG#19304: Merge handler allowed in partitioned tables mysql-test/r/partition.result: New test case mysql-test/t/partition.test: New test case sql/partition_info.cc: Check for not merge handler in partitioned table sql/share/errmsg.txt: New error message --- mysql-test/r/partition.result | 4 ++++ mysql-test/t/partition.test | 8 ++++++++ sql/partition_info.cc | 15 ++++++++------- sql/share/errmsg.txt | 3 +++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 0da071374ea..707c5981b2d 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -886,4 +886,8 @@ s1 2 3 drop table t1; +create table t1 (a int) +partition by key (a) +(partition p0 engine = MERGE); +ERROR HY000: MyISAM Merge handler cannot be used in partitioned tables End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 272cdc27af6..1bf4ba9613c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1009,4 +1009,12 @@ select auto_increment from information_schema.tables where table_name='t1'; select * from t1; drop table t1; +# +# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables +# +--error ER_PARTITION_MERGE_ERROR +create table t1 (a int) +partition by key (a) +(partition p0 engine = MERGE); + --echo End of 5.1 tests diff --git a/sql/partition_info.cc b/sql/partition_info.cc index dfc5dd2989b..83d2a436be3 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -431,18 +431,22 @@ char *partition_info::has_unique_names() bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) { uint i= 0; - bool result= FALSE; DBUG_ENTER("partition_info::check_engine_mix"); do { if (engine_array[i] != engine_array[0]) { - result= TRUE; - break; + my_error(ER_MIX_HANDLER_ERROR, MYF(0)); + DBUG_RETURN(TRUE); } } while (++i < no_parts); - DBUG_RETURN(result); + if (!strcmp(engine_array[0]->name,"MRG_MYISAM")) + { + my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } + DBUG_RETURN(FALSE); } @@ -756,10 +760,7 @@ bool partition_info::check_partition_info(handlerton **eng_type, } while (++i < no_parts); } if (unlikely(partition_info::check_engine_mix(engine_array, part_count))) - { - my_error(ER_MIX_HANDLER_ERROR, MYF(0)); goto end; - } if (eng_type) *eng_type= (handlerton*)engine_array[0]; diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 01e66b35c0f..a601300ed5c 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5840,3 +5840,6 @@ ER_NULL_IN_VALUES_LESS_THAN ER_WRONG_PARTITION_NAME eng "Incorrect partition name" swe "Felaktigt partitionsnamn" +ER_PARTITION_MERGE_ERROR + eng "MyISAM Merge handler cannot be used in partitioned tables" + swe "MyISAM Merge kan inte anändas i en partitionerad tabell" From 0f5df8e1612c97ebdb7959fde62c91a51f796868 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 May 2006 07:39:35 -0400 Subject: [PATCH 2/5] BUG#17455: Wrong results from Repair/Optimize .. table for partitioned tables mysql-test/r/partition.result: New test case mysql-test/t/partition.test: New test case sql/ha_partition.cc: Fixed error handling --- mysql-test/r/partition.result | 10 ++++++++++ mysql-test/t/partition.test | 13 +++++++++++++ sql/ha_partition.cc | 6 ++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 0da071374ea..fbcd688798f 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -886,4 +886,14 @@ s1 2 3 drop table t1; +create table t1 (a int) +engine=MEMORY +partition by key (a); +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note The storage engine for the table doesn't support optimize +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 272cdc27af6..6461f24ffd2 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1009,4 +1009,17 @@ select auto_increment from information_schema.tables where table_name='t1'; select * from t1; drop table t1; +# +# Bug 17455 Partitions: Wrong message and error when using Repair/Optimize +# table on partitioned table +# +create table t1 (a int) +engine=MEMORY +partition by key (a); + +REPAIR TABLE t1; +OPTIMIZE TABLE t1; + +drop table t1; + --echo End of 5.1 tests diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index b1a5a447b6f..abe79fb131d 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1108,8 +1108,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, part)); if ((error= handle_opt_part(thd, check_opt, m_file[part], flag))) { - my_error(ER_GET_ERRNO, MYF(0), error); - DBUG_RETURN(TRUE); + DBUG_RETURN(error); } } while (++j < no_subparts); } @@ -1118,8 +1117,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, DBUG_PRINT("info", ("Optimize partition %u", i)); if ((error= handle_opt_part(thd, check_opt, m_file[i], flag))) { - my_error(ER_GET_ERRNO, MYF(0), error); - DBUG_RETURN(TRUE); + DBUG_RETURN(error); } } } From 301c7e0721a7ae1d53fce24706a933d3e5a01e10 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 May 2006 13:35:52 -0400 Subject: [PATCH 3/5] BUG#19304: Merge handler not part of partitioned tables Review fix sql/partition_info.cc: Review fix --- sql/partition_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 83d2a436be3..50a3409ef26 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -441,7 +441,7 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) DBUG_RETURN(TRUE); } } while (++i < no_parts); - if (!strcmp(engine_array[0]->name,"MRG_MYISAM")) + if (ha_legacy_type(engine_array[0]) == DB_TYPE_MRG_MYISAM) { my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); DBUG_RETURN(TRUE); From b6553aacc2f78158a5896aa0d111ec82b9bcc409 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 May 2006 13:57:21 -0400 Subject: [PATCH 4/5] manual merge --- mysql-test/t/partition.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index f7ce146c109..f697005d6bd 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1064,4 +1064,18 @@ ALTER TABLE t1 DISABLE KEYS; ALTER TABLE t1 ENABLE KEYS; DROP TABLE t1; +# +# Bug 17455 Partitions: Wrong message and error when using Repair/Optimize +# table on partitioned table +# +create table t1 (a int) +engine=MEMORY +partition by key (a); + +REPAIR TABLE t1; +OPTIMIZE TABLE t1; + +drop table t1; +>>>>>>> + --echo End of 5.1 tests From 6b8eccfbdc889f95e377dbd61dad6da657bb2f75 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 May 2006 15:01:03 -0400 Subject: [PATCH 5/5] review fix --- sql/partition_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 0635c80296f..0924a8adf6e 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -442,7 +442,7 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) DBUG_RETURN(TRUE); } } while (++i < no_parts); - if (ha_legacy_type(engine_array[0]) == DB_TYPE_MRG_MYISAM) + if (engine_array[0] == &myisammrg_hton) { my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); DBUG_RETURN(TRUE);