diff options
-rw-r--r-- | libmysqld/Makefile.am | 2 | ||||
-rw-r--r-- | mysql-test/r/partition_mgm_err.result | 1 | ||||
-rw-r--r-- | mysql-test/t/partition_mgm_err.test | 1 | ||||
-rw-r--r-- | sql/Makefile.am | 6 | ||||
-rw-r--r-- | sql/partition_element.h | 2 | ||||
-rw-r--r-- | sql/partition_info.cc (renamed from sql/partition_info.cpp) | 54 | ||||
-rw-r--r-- | sql/partition_info.h | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 8 | ||||
-rw-r--r-- | sql/sql_partition.h | 2 | ||||
-rw-r--r-- | win/cmakefiles/sql | 2 |
10 files changed, 37 insertions, 43 deletions
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 7b9e7431beb..be9947ca2dd 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -67,7 +67,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ event_executor.cc event.cc event_timed.cc \ rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc \ sql_tablespace.cc \ - rpl_injector.cc my_user.c partition_info.cpp + rpl_injector.cc my_user.c partition_info.cc libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \ diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result index efa346f7a72..7d4af16580c 100644 --- a/mysql-test/r/partition_mgm_err.result +++ b/mysql-test/r/partition_mgm_err.result @@ -142,6 +142,7 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; CREATE TABLE t1 (a INT) PARTITION BY HASH(a); ALTER TABLE t1 ADD PARTITION PARTITIONS 4; +DROP TABLE t1; CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1) ( PARTITION p1 VALUES IN (0) (SUBPARTITION p1b), PARTITION p2 VALUES IN (2) (SUBPARTITION p1b) diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test index 1310e79ab17..ea48d4dce88 100644 --- a/mysql-test/t/partition_mgm_err.test +++ b/mysql-test/t/partition_mgm_err.test @@ -216,6 +216,7 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT) PARTITION BY HASH(a); ALTER TABLE t1 ADD PARTITION PARTITIONS 4; +DROP TABLE t1; # #BUG 15408: Partitions: subpartition names are not unique diff --git a/sql/Makefile.am b/sql/Makefile.am index ceddf6cf2a2..b0824110792 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -65,8 +65,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \ parse_file.h sql_view.h sql_trigger.h \ sql_array.h sql_cursor.h event.h event_priv.h \ - sql_plugin.h authors.h sql_partition.h partition_info.h \ - partition_element.h + sql_plugin.h authors.h sql_partition.h \ + partition_info.h partition_element.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -102,7 +102,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ sp_cache.cc parse_file.cc sql_trigger.cc \ event_executor.cc event.cc event_timed.cc \ sql_plugin.cc sql_binlog.cc \ - handlerton.cc sql_tablespace.cc partition_info.cpp + handlerton.cc sql_tablespace.cc partition_info.cc EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \ ha_innodb.h ha_berkeley.h ha_archive.h \ ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \ diff --git a/sql/partition_element.h b/sql/partition_element.h index 06007076405..bdc0f870e74 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000,200666666 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/partition_info.cpp b/sql/partition_info.cc index 18c80d01b1b..5d30dba5fbd 100644 --- a/sql/partition_info.cpp +++ b/sql/partition_info.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,23 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - This file was introduced as a container for general functionality related - to partitioning introduced in MySQL version 5.1. It contains functionality - used by all handlers that support partitioning, which in the first version - is the partitioning handler itself and the NDB handler. - - The first version was written by Mikael Ronstrom. - - This version supports RANGE partitioning, LIST partitioning, HASH - partitioning and composite partitioning (hereafter called subpartitioning) - where each RANGE/LIST partitioning is HASH partitioned. The hash function - can either be supplied by the user or by only a list of fields (also - called KEY partitioning, where the MySQL server will use an internal - hash function. - There are quite a few defaults that can be used as well. -*/ - /* Some general useful functions */ #include "mysql_priv.h" @@ -164,6 +147,7 @@ end: DBUG_RETURN(result); } + /* Set up all the default subpartitions not set-up by the user in the SQL statement. Also perform a number of checks that the default partitioning @@ -235,6 +219,7 @@ end: DBUG_RETURN(result); } + /* Support routine for check_partition_info @@ -272,6 +257,7 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, DBUG_RETURN(FALSE); } + /* A support function to check if a partition element's name is unique @@ -283,6 +269,7 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, TRUE Has unique name FALSE Doesn't */ + bool partition_info::has_unique_name(partition_element *element) { DBUG_ENTER("partition_info::has_unique_name"); @@ -297,14 +284,16 @@ bool partition_info::has_unique_name(partition_element *element) name_to_check)) && el != element) DBUG_RETURN(FALSE); - if (el->subpartitions.is_empty()) continue; - List_iterator<partition_element> subparts_it(el->subpartitions); - partition_element *sub_el; - while (sub_el= (subparts_it++)) + if (!el->subpartitions.is_empty()) { - if (!(my_strcasecmp(system_charset_info, sub_el->partition_name, - name_to_check)) && sub_el != element) - DBUG_RETURN(FALSE); + partition_element *sub_el; + List_iterator<partition_element> subparts_it(el->subpartitions); + while (sub_el= (subparts_it++)) + { + if (!(my_strcasecmp(system_charset_info, sub_el->partition_name, + name_to_check)) && sub_el != element) + DBUG_RETURN(FALSE); + } } } DBUG_RETURN(TRUE); @@ -326,6 +315,7 @@ bool partition_info::has_unique_name(partition_element *element) Checks that the list of names in the partitions doesn't contain any duplicated names. */ + char *partition_info::has_unique_names() { DBUG_ENTER("partition_info::has_unique_names"); @@ -338,13 +328,15 @@ char *partition_info::has_unique_names() if (! has_unique_name(el)) DBUG_RETURN(el->partition_name); - if (el->subpartitions.is_empty()) continue; - List_iterator<partition_element> subparts_it(el->subpartitions); - partition_element *subel; - while (subel= (subparts_it++)) + if (!el->subpartitions.is_empty()) { - if (! has_unique_name(subel)) - DBUG_RETURN(subel->partition_name); + List_iterator<partition_element> subparts_it(el->subpartitions); + partition_element *subel; + while (subel= (subparts_it++)) + { + if (! has_unique_name(subel)) + DBUG_RETURN(subel->partition_name); + } } } DBUG_RETURN(NULL); diff --git a/sql/partition_info.h b/sql/partition_info.h index 94bafbac7a9..13a33415648 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000,2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 1d68deff9b4..7f4518c2b85 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* - This file was introduced as a container for general functionality related + This file is a container for general functionality related to partitioning introduced in MySQL version 5.1. It contains functionality - used by all handlers that support partitioning, which in the first version - is the partitioning handler itself and the NDB handler. + used by all handlers that support partitioning, such as + the partitioning handler itself and the NDB handler. The first version was written by Mikael Ronstrom. @@ -26,7 +26,7 @@ partitioning and composite partitioning (hereafter called subpartitioning) where each RANGE/LIST partitioning is HASH partitioned. The hash function can either be supplied by the user or by only a list of fields (also - called KEY partitioning, where the MySQL server will use an internal + called KEY partitioning), where the MySQL server will use an internal hash function. There are quite a few defaults that can be used as well. */ diff --git a/sql/sql_partition.h b/sql/sql_partition.h index 785af742a3a..3cb7d9c2d0f 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/win/cmakefiles/sql b/win/cmakefiles/sql index c7d36cc1583..a74fd4e79ca 100644 --- a/win/cmakefiles/sql +++ b/win/cmakefiles/sql @@ -40,7 +40,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover. sql_state.c sql_string.cc sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc sql_update.cc sql_view.cc sql_yacc.h sql_yacc.cc strfunc.cc table.cc thr_malloc.cc time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc rpl_tblmap.cc sql_binlog.cc event_executor.cc - event_timed.cc sql_tablespace.cc event.cc ../sql-common/my_user.c partition_info.cpp + event_timed.cc sql_tablespace.cc event.cc ../sql-common/my_user.c partition_info.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h ${PROJECT_SOURCE_DIR}/include/mysqld_error.h |