summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-04-27 16:36:03 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-04-27 16:36:03 +0300
commit73aa78ea9d48c433ddb91ef3a7a5b62391d35ac7 (patch)
tree3a4c202d1f413f1a794e08cefd13ae04f353a23c /sql/partition_info.cc
parente174fa9d791a1761fc8b2f92a6ab72f44a9dfc33 (diff)
downloadmariadb-git-73aa78ea9d48c433ddb91ef3a7a5b62391d35ac7.tar.gz
MDEV-22155 ALTER add default history partitions name clash on non-default partitions
If any of default names clashes with existing names find next large enough name gap for the requested number of partitions.
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index f4b7260f8b0..e9dbf2b49c3 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -336,7 +336,8 @@ char *partition_info::create_default_partition_names(THD *thd, uint part_no,
{
do
{
- sprintf(move_ptr, "p%u", (start_no + i));
+ if (make_partition_name(move_ptr, (start_no + i)))
+ DBUG_RETURN(NULL);
move_ptr+= MAX_PART_NAME_SIZE;
} while (++i < num_parts_arg);
}
@@ -401,17 +402,11 @@ bool partition_info::set_up_default_partitions(THD *thd, handler *file,
uint i;
char *default_name;
bool result= TRUE;
- bool alter= false;
DBUG_ENTER("partition_info::set_up_default_partitions");
if (part_type == VERSIONING_PARTITION)
{
- if (start_no > 0)
- {
- start_no--;
- alter= true;
- }
- else if (use_default_num_partitions)
+ if (start_no == 0 && use_default_num_partitions)
num_parts= 2;
use_default_num_partitions= false;
}
@@ -455,7 +450,7 @@ bool partition_info::set_up_default_partitions(THD *thd, handler *file,
default_name+=MAX_PART_NAME_SIZE;
if (part_type == VERSIONING_PARTITION)
{
- if (alter || i < num_parts - 1) {
+ if (start_no > 0 || i < num_parts - 1) {
part_elem->type= partition_element::HISTORY;
} else {
part_elem->type= partition_element::CURRENT;