mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
BUG #15408 - Partitions: subpartition names are not unique
libmysqld/Makefile.am: changed name to partition_info.cc mysql-test/r/partition_mgm_err.result: added drop table for previous test mysql-test/t/partition_mgm_err.test: added drop table for previous test sql/Makefile.am: reformatted a bit changed name of partition_info.cpp to partition_info.cc sql/partition_element.h: updated copyright date sql/partition_info.cc: minor corrections as a result of review sql/partition_info.h: updated copyright date sql/sql_partition.cc: updated file comment and fixed some spacing sql/sql_partition.h: updated copyright date win/cmakefiles/sql: changed name to partition_info.cc
This commit is contained in:
parent
cf5cb1e960
commit
b2cf86f1bd
10 changed files with 37 additions and 43 deletions
|
@ -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 \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue