diff options
author | Daniel Black <daniel@mariadb.org> | 2022-04-06 14:23:20 +1000 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2022-04-06 14:23:20 +1000 |
commit | 7b06bc9a9447f1ec63930f27a4209b312d24c519 (patch) | |
tree | 75d95e1083d527a38754446ca1c933142c779d24 /sql/sql_partition.cc | |
parent | 5c69e936308b9b636d3e58aff624d2716f289fbd (diff) | |
parent | b249abde57f1788a8085f45cc6252ee70ece3354 (diff) | |
download | mariadb-git-7b06bc9a9447f1ec63930f27a4209b312d24c519.tar.gz |
Merge branch 10.7 into 10.8
Closes #2083
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 3b7d10aa8a8..9a4a0d0be28 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -7017,7 +7017,8 @@ static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt) static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, bool action_completed, bool drop_partition, - bool frm_install) + bool frm_install, + bool reopen) { THD *thd= lpt->thd; partition_info *part_info= lpt->part_info->get_clone(thd); @@ -7061,6 +7062,9 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL); } + if (!reopen) + DBUG_VOID_RETURN; + if (part_info->list && ddl_log_execute_entry(thd, part_info->list->entry_pos)) { @@ -7491,7 +7495,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("drop_partition_9")) { - handle_alter_part_error(lpt, action_completed, TRUE, frm_install); + handle_alter_part_error(lpt, action_completed, TRUE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) @@ -7527,9 +7531,12 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, (thd->binlog_xid= 0))) || ERROR_INJECT("convert_partition_9")) { + DDL_LOG_STATE main_state= *lpt->part_info; + handle_alter_part_error(lpt, true, true, false, false); ddl_log_complete(&chain_drop_backup); - (void) ddl_log_revert(thd, lpt->part_info); - handle_alter_part_error(lpt, true, true, false); + (void) ddl_log_revert(thd, &main_state); + if (thd->locked_tables_mode) + thd->locked_tables_list.reopen_tables(thd, false); goto err; } ddl_log_complete(lpt->part_info); @@ -7576,9 +7583,12 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, (thd->binlog_xid= 0))) || ERROR_INJECT("convert_partition_9")) { + DDL_LOG_STATE main_state= *lpt->part_info; + handle_alter_part_error(lpt, true, true, false, false); ddl_log_complete(&chain_drop_backup); - (void) ddl_log_revert(thd, lpt->part_info); - handle_alter_part_error(lpt, true, true, false); + (void) ddl_log_revert(thd, &main_state); + if (thd->locked_tables_mode) + thd->locked_tables_list.reopen_tables(thd, false); goto err; } ddl_log_complete(lpt->part_info); @@ -7650,7 +7660,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("add_partition_10")) { - handle_alter_part_error(lpt, action_completed, FALSE, frm_install); + handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) @@ -7743,7 +7753,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, thd->query(), thd->query_length()), FALSE)) || ERROR_INJECT("change_partition_12")) { - handle_alter_part_error(lpt, action_completed, FALSE, frm_install); + handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true); goto err; } if (alter_partition_lock_handling(lpt)) |