Below is the list of changes that have just been committed into a local
5.1 repository of reggie. When reggie does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2016 06/01/06 12:49:00 reggie@stripped +7 -0
BUG# 15408 - Partitions: subpartition names are not unique
Fixed.
sql/sql_partition.cc
1.19 06/01/06 12:40:23 reggie@stripped +11 -13
* increased the size of MAX_PART_NAME_SIZE since we are no including partition name
* now pass in partitoin_name into create_default_partition_names
so that it can prefix it when building up subpart names
* moved call of create_default_partition_names inside outer partition
loop so that we will build up names for every partition
* instead of calling is_partitions_in_table, we are now calling the
new partition_info::has_duplicate_names to make sure all the part
and subpart names are unique
* removed the code that prefixed the part name and _ for use in explain
sql/handler.h
1.175 06/01/06 12:40:22 reggie@stripped +4 -0
added some useful methods to partition_info
sql/ha_partition.cc
1.19 06/01/06 12:40:21 reggie@stripped +6 -7
removed now unused name_add function
not calling name_add anymore to "build up" the partition name
sql/Makefile.am
1.130 06/01/06 12:40:20 reggie@stripped +1 -1
added partition_info.cc to the sources for the server
mysql-test/t/partition_mgm_err.test
1.3 06/01/06 12:40:19 reggie@stripped +9 -0
added new test for duplicate subpartition names
mysql-test/r/partition_mgm_err.result
1.3 06/01/06 12:40:17 reggie@stripped +8 -0
add results of new test for duplicate subpartition names
libmysqld/Makefile.am
1.77 06/01/06 12:40:04 reggie@stripped +2 -1
add partition_info.cc to the list of sources for the embedded server
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: reggie
# Host: linux.site
# Root: /home/reggie/work/mysql-5.1-bug15408-2
--- 1.129/sql/Makefile.am 2005-12-31 03:13:33 -06:00
+++ 1.130/sql/Makefile.am 2006-01-06 12:40:20 -06:00
@@ -98,7 +98,7 @@
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
sp_cache.cc parse_file.cc sql_trigger.cc \
sql_plugin.cc sql_binlog.cc \
- handlerton.cc
+ handlerton.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.174/sql/handler.h 2005-12-26 05:54:47 -06:00
+++ 1.175/sql/handler.h 2006-01-06 12:40:22 -06:00
@@ -677,6 +677,10 @@
subpart_field_list.empty();
}
~partition_info() {}
+
+ bool has_duplicate_names();
+private:
+ bool has_unique_name(partition_element *el_to_check);
};
--- 1.76/libmysqld/Makefile.am 2005-12-22 22:04:23 -06:00
+++ 1.77/libmysqld/Makefile.am 2006-01-06 12:40:04 -06:00
@@ -65,7 +65,8 @@
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
item_xmlfunc.cc \
- rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc
+ rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc \
+ ../sql/partition_info.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
--- 1.18/sql/ha_partition.cc 2005-12-30 22:53:54 -06:00
+++ 1.19/sql/ha_partition.cc 2006-01-06 12:40:21 -06:00
@@ -576,10 +576,10 @@
between the partition names.
*/
-static uint name_add(char *dest, const char *first_name, const char *sec_name)
-{
- return (uint) (strxmov(dest, first_name, "_", sec_name, NullS) -dest) + 1;
-}
+//static uint name_add(char *dest, const char *first_name, const char *sec_name)
+//{
+// return (uint) (strxmov(dest, first_name, "_", sec_name, NullS) -dest) + 1;
+//}
/*
@@ -658,9 +658,8 @@
for (j= 0; j < m_part_info->no_subparts; j++)
{
subpart_elem= sub_it++;
- name_buffer_ptr+= name_add(name_buffer_ptr,
- part_elem->partition_name,
- subpart_elem->partition_name);
+ name_buffer_ptr= strmov(name_buffer_ptr,
+ subpart_elem->partition_name)+1;
*engine_array= (uchar) ha_legacy_type(part_elem->engine_type);
engine_array++;
}
--- 1.18/sql/sql_partition.cc 2005-12-26 05:53:40 -06:00
+++ 1.19/sql/sql_partition.cc 2006-01-06 12:40:23 -06:00
@@ -567,9 +567,10 @@
The external routine needing this code is check_partition_info
*/
-#define MAX_PART_NAME_SIZE 8
+#define MAX_PART_NAME_SIZE 16
-static char *create_default_partition_names(uint no_parts, uint start_no,
+static char *create_default_partition_names(const char *partition_name,
+ uint no_parts, uint start_no,
bool subpart)
{
char *ptr= sql_calloc(no_parts*MAX_PART_NAME_SIZE);
@@ -581,7 +582,8 @@
do
{
if (subpart)
- my_sprintf(move_ptr, (move_ptr,"sp%u", (start_no + i)));
+ my_sprintf(move_ptr, (move_ptr,"%s_sp%u", partition_name,
+ (start_no + i)));
else
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
move_ptr+=MAX_PART_NAME_SIZE;
@@ -644,7 +646,7 @@
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
goto end;
}
- if (unlikely((!(default_name= create_default_partition_names(no_parts,
+ if (unlikely((!(default_name= create_default_partition_names(NULL, no_parts,
start_no,
FALSE)))))
goto end;
@@ -712,15 +714,15 @@
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
goto end;
}
- if (unlikely((!(default_name=
- create_default_partition_names(no_subparts, (uint)0, TRUE)))))
- goto end;
i= 0;
do
{
part_elem= part_it++;
j= 0;
- name_ptr= default_name;
+ name_ptr= create_default_partition_names(part_elem->partition_name,
+ no_subparts, (uint)0, TRUE);
+ if (!name_ptr)
+ goto end;
do
{
partition_element *subpart_elem= new partition_element();
@@ -853,7 +855,7 @@
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
goto end;
}
- if (unlikely(is_partitions_in_table(part_info, part_info)))
+ if (unlikely(part_info->has_duplicate_names()))
{
my_error(ER_SAME_NAME_PARTITION, MYF(0));
goto end;
@@ -3493,10 +3495,6 @@
{
if (parts_str->length())
parts_str->append(',');
- parts_str->append(head_pe->partition_name,
- strlen(head_pe->partition_name),
- system_charset_info);
- parts_str->append('_');
parts_str->append(pe->partition_name,
strlen(pe->partition_name),
system_charset_info);
--- 1.2/mysql-test/r/partition_mgm_err.result 2005-12-15 05:22:59 -06:00
+++ 1.3/mysql-test/r/partition_mgm_err.result 2006-01-06 12:40:17 -06:00
@@ -52,6 +52,14 @@
PARTITION BY KEY (a)
(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
ERROR HY000: All partitions must have unique names in the table
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE(a)
+SUBPARTITION BY HASH(b)
+(PARTITION x0 VALUES LESS THAN (20)
+(SUBPARTITION s0, SUBPARTITION s1),
+PARTITION x1 VALUES LESS THAN MAXVALUE
+(SUBPARTITION s0, SUBPARTITION s1));
+ERROR HY000: All partitions must have unique names in the table
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
SUBPARTITION BY KEY (a)
--- 1.2/mysql-test/t/partition_mgm_err.test 2005-12-15 05:22:59 -06:00
+++ 1.3/mysql-test/t/partition_mgm_err.test 2006-01-06 12:40:19 -06:00
@@ -78,6 +78,15 @@
PARTITION BY KEY (a)
(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE(a)
+SUBPARTITION BY HASH(b)
+(PARTITION x0 VALUES LESS THAN (20)
+ (SUBPARTITION s0, SUBPARTITION s1),
+PARTITION x1 VALUES LESS THAN MAXVALUE
+ (SUBPARTITION s0, SUBPARTITION s1));
+
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
SUBPARTITION BY KEY (a)
| Thread |
|---|
| • bk commit into 5.1 tree (reggie:1.2016) BUG#15408 | reggie | 6 Jan |