1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

bug #15521 (Cannot reorganise a partition with a new name equal to the old name)

This commit is contained in:
holyfoot@deer.(none)
2005-12-15 15:24:35 +04:00
parent ae66c0b6d1
commit 55e7f4503e
7 changed files with 128 additions and 3 deletions

View File

@ -189,6 +189,61 @@ bool is_partitions_in_table(partition_info *new_part_info,
}
/*
Check that the reorganized table will not have duplicate partitions.
SYNOPSIS
check_reorganise_list()
new_part_info New partition info
old_part_info Old partition info
list_part_names The list of partition names that will go away and can be reused in the
new table.
RETURN VALUES
TRUE Inacceptable name conflict detected.
FALSE New names are OK.
DESCRIPTION
Can handle that the 'new_part_info' and 'old_part_info' the same
in which case it checks that the list of names in the partitions
doesn't contain any duplicated names.
*/
bool check_reorganise_list(partition_info *new_part_info,
partition_info *old_part_info,
List<char> list_part_names)
{
uint new_count, old_count;
uint no_new_parts= new_part_info->partitions.elements;
uint no_old_parts= old_part_info->partitions.elements;
List_iterator<partition_element> new_parts_it(new_part_info->partitions);
bool same_part_info= (new_part_info == old_part_info);
DBUG_ENTER("check_reorganise_list");
new_count= 0;
do
{
List_iterator<partition_element> old_parts_it(old_part_info->partitions);
char *new_name= (new_parts_it++)->partition_name;
new_count++;
old_count= 0;
do
{
char *old_name= (old_parts_it++)->partition_name;
old_count++;
if (same_part_info && old_count == new_count)
break;
if (!(my_strcasecmp(system_charset_info, old_name, new_name)))
{
if (!is_partition_in_list(old_name, list_part_names))
DBUG_RETURN(TRUE);
}
} while (old_count < no_old_parts);
} while (new_count < no_new_parts);
DBUG_RETURN(FALSE);
}
/*
A useful routine used by update_row for partition handlers to calculate
the partition ids of the old and the new record.