Commit f8ec3ba0 authored by Thirunarayanan Balathandayuthapani's avatar Thirunarayanan Balathandayuthapani Committed by Marko Mäkelä

MDEV-21832 FORCE all partition to rebuild if any one of the

		partition does rebuild

- In ha_innobase::commit_inplace_alter_table() assumes that all partition
should do the same kind of alter operations. During DDL, if one partition
requires table rebuild and other partition doesn't need rebuild
then all partition should be forced to rebuild.
parent 67f27824
...@@ -9996,7 +9996,8 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, ...@@ -9996,7 +9996,8 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info *ha_alter_info) Alter_inplace_info *ha_alter_info)
{ {
uint index= 0; uint index= 0;
enum_alter_inplace_result result= HA_ALTER_INPLACE_NO_LOCK; enum_alter_inplace_result result;
alter_table_operations orig_ops;
ha_partition_inplace_ctx *part_inplace_ctx; ha_partition_inplace_ctx *part_inplace_ctx;
bool first_is_set= false; bool first_is_set= false;
THD *thd= ha_thd(); THD *thd= ha_thd();
...@@ -10023,11 +10024,14 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, ...@@ -10023,11 +10024,14 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
if (!part_inplace_ctx->handler_ctx_array) if (!part_inplace_ctx->handler_ctx_array)
DBUG_RETURN(HA_ALTER_ERROR); DBUG_RETURN(HA_ALTER_ERROR);
do {
result= HA_ALTER_INPLACE_NO_LOCK;
/* Set all to NULL, including the terminating one. */ /* Set all to NULL, including the terminating one. */
for (index= 0; index <= m_tot_parts; index++) for (index= 0; index <= m_tot_parts; index++)
part_inplace_ctx->handler_ctx_array[index]= NULL; part_inplace_ctx->handler_ctx_array[index]= NULL;
ha_alter_info->handler_flags |= ALTER_PARTITIONED; ha_alter_info->handler_flags |= ALTER_PARTITIONED;
orig_ops= ha_alter_info->handler_flags;
for (index= 0; index < m_tot_parts; index++) for (index= 0; index < m_tot_parts; index++)
{ {
enum_alter_inplace_result p_result= enum_alter_inplace_result p_result=
...@@ -10036,9 +10040,7 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, ...@@ -10036,9 +10040,7 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx; part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx;
if (index == 0) if (index == 0)
{
first_is_set= (ha_alter_info->handler_ctx != NULL); first_is_set= (ha_alter_info->handler_ctx != NULL);
}
else if (first_is_set != (ha_alter_info->handler_ctx != NULL)) else if (first_is_set != (ha_alter_info->handler_ctx != NULL))
{ {
/* Either none or all partitions must set handler_ctx! */ /* Either none or all partitions must set handler_ctx! */
...@@ -10050,6 +10052,7 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, ...@@ -10050,6 +10052,7 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table,
if (result == HA_ALTER_ERROR) if (result == HA_ALTER_ERROR)
break; break;
} }
} while (orig_ops != ha_alter_info->handler_flags);
ha_alter_info->handler_ctx= part_inplace_ctx; ha_alter_info->handler_ctx= part_inplace_ctx;
/* /*
......
...@@ -1459,6 +1459,7 @@ ha_innobase::check_if_supported_inplace_alter( ...@@ -1459,6 +1459,7 @@ ha_innobase::check_if_supported_inplace_alter(
} }
if (need_rebuild || fts_need_rebuild) { if (need_rebuild || fts_need_rebuild) {
ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
DBUG_RETURN(online DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK ? HA_ALTER_INPLACE_COPY_NO_LOCK
: HA_ALTER_INPLACE_COPY_LOCK); : HA_ALTER_INPLACE_COPY_LOCK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment