summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2018-01-12 12:54:07 +0300
committerSergei Golubchik <serg@mariadb.org>2018-01-13 01:53:12 +0100
commit93e8ee4ae102c60719b0c2cb467aec52024efd58 (patch)
tree41076bc3e76b0da7c2e74abb822edb3805c32a33 /sql/partition_info.cc
parentfbed4ca4f1fb827181074233be849665abf6091d (diff)
downloadmariadb-git-93e8ee4ae102c60719b0c2cb467aec52024efd58.tar.gz
MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc39
1 files changed, 22 insertions, 17 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 8133f15012c..65df87bee04 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -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);