# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2006/08/08 08:52:51-04:00 mikael@dator5.(none)
# BUG#21143: mysqld hangs when using wrong number of subpartitions
# Rewrote if-statement a bit shorter
# Added check for subpartitions in REORGANIZE partitions to be of
same number as
# in base table.
#
# mysql-test/r/partition_mgm.result
# 2006/08/08 08:52:48-04:00 mikael@dator5.(none) +10 -0
# New test case
#
# mysql-test/t/partition_mgm.test
# 2006/08/08 08:52:48-04:00 mikael@dator5.(none) +17 -0
# New test case
#
# sql/ha_partition.cc
# 2006/08/08 08:52:48-04:00 mikael@dator5.(none) +2 -4
# Fixed stuff I should done long ago (monty comments)
#
# sql/sql_partition.cc
# 2006/08/08 08:52:48-04:00 mikael@dator5.(none) +9 -7
# Rewrote if-statement a bit shorter
# Added check for subpartitions in REORGANIZE partitions to be of
same number as
# in base table.
#
diff -Nru a/mysql-test/r/partition_mgm.result
b/mysql-test/r/partition_mgm.result
--- a/mysql-test/r/partition_mgm.result 2006-08-08 08:56:11 -04:00
+++ b/mysql-test/r/partition_mgm.result 2006-08-08 08:56:11 -04:00
@@ -1,4 +1,14 @@
DROP TABLE IF EXISTS t1;
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (10) (subpartition sp00, subpartition
sp01),
+partition p1 values less than (20) (subpartition sp10, subpartition
sp11));
+alter table t1 reorganize partition p0 into
+(partition p0 values less than (10) (subpartition sp00,
+subpartition sp01, subpartition sp02));
+ERROR HY000: Wrong number of subpartitions defined, mismatch with
previous setting
+drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
diff -Nru a/mysql-test/t/partition_mgm.test
b/mysql-test/t/partition_mgm.test
--- a/mysql-test/t/partition_mgm.test 2006-08-08 08:56:11 -04:00
+++ b/mysql-test/t/partition_mgm.test 2006-08-08 08:56:11 -04:00
@@ -2,6 +2,23 @@
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
+
+#
+# Bug 21143: mysqld hang when error in number of subparts in
+# REORGANIZE command
+#
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (10) (subpartition sp00, subpartition
sp01),
+ partition p1 values less than (20) (subpartition sp10, subpartition
sp11));
+
+-- error ER_PARTITION_WRONG_NO_SUBPART_ERROR
+alter table t1 reorganize partition p0 into
+(partition p0 values less than (10) (subpartition sp00,
+subpartition sp01, subpartition sp02));
+drop table t1;
+
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
diff -Nru a/sql/ha_partition.cc b/sql/ha_partition.cc
--- a/sql/ha_partition.cc 2006-08-08 08:56:11 -04:00
+++ b/sql/ha_partition.cc 2006-08-08 08:56:11 -04:00
@@ -5145,13 +5145,12 @@
DBUG_ENTER("ha_partition::print_error");
/* Should probably look for my own errors first */
- /* monty: needs to be called for the last used partition ! */
DBUG_PRINT("enter", ("error: %d", error));
if (error == HA_ERR_NO_PARTITION_FOUND)
m_part_info->print_no_partition_found(table);
else
- m_file[0]->print_error(error, errflag);
+ m_file[m_last_part]->print_error(error, errflag);
DBUG_VOID_RETURN;
}
@@ -5161,8 +5160,7 @@
DBUG_ENTER("ha_partition::get_error_message");
/* Should probably look for my own errors first */
- /* monty: needs to be called for the last used partition ! */
- DBUG_RETURN(m_file[0]->get_error_message(error, buf));
+ DBUG_RETURN(m_file[m_last_part]->get_error_message(error, buf));
}
diff -Nru a/sql/sql_partition.cc b/sql/sql_partition.cc
--- a/sql/sql_partition.cc 2006-08-08 08:56:11 -04:00
+++ b/sql/sql_partition.cc 2006-08-08 08:56:11 -04:00
@@ -3471,14 +3471,9 @@
}
table->part_info= part_info;
table->file->set_part_info(part_info);
- if (part_info->default_engine_type == NULL)
- {
+ if (!part_info->default_engine_type)
part_info->default_engine_type= default_db_type;
- }
- else
- {
- DBUG_ASSERT(part_info->default_engine_type == default_db_type);
- }
+ DBUG_ASSERT(part_info->default_engine_type == default_db_type);
part_info->item_free_list= thd->free_list;
{
@@ -4390,6 +4385,13 @@
(no_parts_new != no_parts_reorged))
{
my_error(ER_REORG_HASH_ONLY_ON_SAME_NO, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+ if (tab_part_info->is_sub_partitioned() &&
+ alt_part_info->no_subparts &&
+ alt_part_info->no_subparts != tab_part_info->no_subparts)
+ {
+ my_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
check_total_partitions= tab_part_info->no_parts + no_parts_new;
Mikael Ronstrom, Senior Software Architect
MySQL AB, www.mysql.com
Jumpstart your cluster:
http://www.mysql.com/consulting/packaged/cluster.html
My blog:
http://mikaelronstrom.blogspot.com
| Thread |
|---|
| • bk commit - 5.1 tree (mikael:1.2265) BUG#21143 | Mikael Ronström | 8 Aug |