mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
This commit is contained in:
parent
fbed4ca4f1
commit
93e8ee4ae1
5 changed files with 41 additions and 24 deletions
|
@ -407,6 +407,14 @@ Warning 4112 Versioned table `test`.`t1`: partition `p2` is full, add more HISTO
|
|||
delete from t1 where x = 2;
|
||||
Warnings:
|
||||
Warning 4112 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
|
||||
# MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
|
||||
create or replace table t1 (x int) with system versioning
|
||||
partition by system_time (partition p1 history, partition pn current);
|
||||
lock table t1 write;
|
||||
alter table t1 add partition (partition p1 history);
|
||||
ERROR HY000: Duplicate partition name p1
|
||||
insert into t1 values (1);
|
||||
unlock tables;
|
||||
# Test cleanup
|
||||
drop database test;
|
||||
create database test;
|
||||
|
|
|
@ -351,6 +351,15 @@ alter table t1 partition by system_time limit 1 (
|
|||
delete from t1 where x = 1;
|
||||
delete from t1 where x = 2;
|
||||
|
||||
--echo # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
|
||||
create or replace table t1 (x int) with system versioning
|
||||
partition by system_time (partition p1 history, partition pn current);
|
||||
lock table t1 write;
|
||||
--error ER_SAME_NAME_PARTITION
|
||||
alter table t1 add partition (partition p1 history);
|
||||
insert into t1 values (1);
|
||||
unlock tables;
|
||||
|
||||
--echo # Test cleanup
|
||||
drop database test;
|
||||
create database test;
|
||||
|
|
|
@ -1940,7 +1940,7 @@ static void warn_if_dir_in_part_elem(THD *thd, partition_element *part_elem)
|
|||
|
||||
bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
handler *file, HA_CREATE_INFO *info,
|
||||
bool add_or_reorg_part)
|
||||
partition_info *add_or_reorg_part)
|
||||
{
|
||||
handlerton *table_engine= default_engine_type;
|
||||
uint i, tot_partitions;
|
||||
|
@ -2174,6 +2174,24 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (hist_parts > 1)
|
||||
{
|
||||
if (unlikely(vers_info->limit == 0 && vers_info->interval == 0))
|
||||
{
|
||||
push_warning_printf(thd,
|
||||
Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_VERS_PARAMETERS,
|
||||
ER_THD(thd, WARN_VERS_PARAMETERS),
|
||||
"no rotation condition for multiple HISTORY partitions.");
|
||||
}
|
||||
}
|
||||
if (unlikely(now_parts > 1))
|
||||
{
|
||||
my_error(ER_VERS_WRONG_PARTS, MYF(0), info->alias);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
DBUG_ASSERT(table_engine != partition_hton &&
|
||||
default_engine_type == table_engine);
|
||||
if (eng_type)
|
||||
|
@ -2188,6 +2206,9 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
|||
|
||||
if (add_or_reorg_part)
|
||||
{
|
||||
if (unlikely(part_type == VERSIONING_PARTITION &&
|
||||
vers_setup_expression(thd, add_or_reorg_part->partitions.elements)))
|
||||
goto end;
|
||||
if (unlikely(((part_type == RANGE_PARTITION || part_type == VERSIONING_PARTITION) &&
|
||||
check_range_constants(thd)) ||
|
||||
(part_type == LIST_PARTITION &&
|
||||
|
@ -2195,22 +2216,6 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (hist_parts > 1)
|
||||
{
|
||||
if (vers_info->limit == 0 && vers_info->interval == 0)
|
||||
{
|
||||
push_warning_printf(thd,
|
||||
Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_VERS_PARAMETERS,
|
||||
ER_THD(thd, WARN_VERS_PARAMETERS),
|
||||
"no rotation condition for multiple HISTORY partitions.");
|
||||
}
|
||||
}
|
||||
if (now_parts > 1)
|
||||
{
|
||||
my_error(ER_VERS_WRONG_PARTS, MYF(0), info->alias);
|
||||
goto end;
|
||||
}
|
||||
result= FALSE;
|
||||
end:
|
||||
DBUG_RETURN(result);
|
||||
|
|
|
@ -348,7 +348,7 @@ public:
|
|||
bool check_list_constants(THD *thd);
|
||||
bool check_partition_info(THD *thd, handlerton **eng_type,
|
||||
handler *file, HA_CREATE_INFO *info,
|
||||
bool check_partition_function);
|
||||
partition_info *add_or_reorg_part= NULL);
|
||||
void print_no_partition_found(TABLE *table, myf errflag);
|
||||
void print_debug(const char *str, uint*);
|
||||
Item* get_column_item(Item *item, Field *field);
|
||||
|
|
|
@ -5436,13 +5436,8 @@ the generated partition syntax in a correct manner.
|
|||
tab_part_info->use_default_num_subpartitions= FALSE;
|
||||
}
|
||||
|
||||
if (alter_info->flags & Alter_info::ALTER_ADD_PARTITION &&
|
||||
tab_part_info->part_type == VERSIONING_PARTITION &&
|
||||
tab_part_info->vers_setup_expression(thd, alt_part_info->partitions.elements))
|
||||
goto err;
|
||||
|
||||
if (tab_part_info->check_partition_info(thd, (handlerton**)NULL,
|
||||
table->file, 0, TRUE))
|
||||
table->file, 0, alt_part_info))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue