summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-05-11 11:25:33 +0200
committerSergei Golubchik <serg@mariadb.org>2022-05-11 11:25:33 +0200
commitfd132be117e44318de04973e8bc825651b220792 (patch)
treea78222eeae060b5a605633a9f603e5e7528f12c3 /sql/ha_partition.cc
parent7b05fc5cdd6058e91a26836ace54f45f37fa88b5 (diff)
parenta917be3e7f07fc803fb04aba7173081550dcc7db (diff)
downloadmariadb-git-fd132be117e44318de04973e8bc825651b220792.tar.gz
Merge branch '10.6' into 10.7
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 8af85ca3d4a..9cefd695c56 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2019, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB
+ Copyright (c) 2009, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -4172,6 +4172,8 @@ int ha_partition::external_lock(THD *thd, int lock_type)
if (lock_type == F_UNLCK)
{
bitmap_clear_all(used_partitions);
+ if (m_lock_type == F_WRLCK && m_part_info->vers_require_hist_part(thd))
+ m_part_info->vers_check_limit(thd);
}
else
{
@@ -4192,13 +4194,7 @@ int ha_partition::external_lock(THD *thd, int lock_type)
{
if (m_part_info->part_expr)
m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- if (m_part_info->part_type == VERSIONING_PARTITION &&
- /* TODO: MDEV-20345 exclude more inapproriate commands like INSERT
- These commands may be excluded because working history partition is needed
- only for versioned DML. */
- thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
- (error= m_part_info->vers_set_hist_part(thd)))
+ if ((error= m_part_info->vers_set_hist_part(thd)))
goto err_handler;
}
DBUG_RETURN(0);
@@ -4344,11 +4340,7 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
{
if (m_part_info->part_expr)
m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- if (m_part_info->part_type == VERSIONING_PARTITION &&
- // TODO: MDEV-20345 (see above)
- thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT)
- error= m_part_info->vers_set_hist_part(thd);
+ error= m_part_info->vers_set_hist_part(thd);
}
DBUG_RETURN(error);
}
@@ -10586,7 +10578,16 @@ bool ha_partition::commit_inplace_alter_table(TABLE *altered_table,
Loop over all other partitions as to follow the protocol!
*/
uint i;
- DBUG_ASSERT(0);
+ /*
+ InnoDB does not set ha_alter_info->group_commit_ctx to NULL in the
+ case if autoincrement attribute is necessary to reset for all
+ partitions for INNOBASE_INPLACE_IGNORE handler flags. It does not
+ affect durability, because it is solely about updating the InnoDB data
+ dictionary caches (one InnoDB dict_table_t per partition or
+ sub-partition).
+ */
+ DBUG_ASSERT(table->found_next_number_field
+ && !altered_table->found_next_number_field);
for (i= 1; i < m_tot_parts; i++)
{
ha_alter_info->handler_ctx= part_inplace_ctx->handler_ctx_array[i];