Commit ddb14e0f authored by unknown's avatar unknown

WL 2826: Error handling of ALTER TABLE for partitioning

More work on table logging of ALTER TABLE for partitioning


sql/mysql_priv.h:
  More work on table logging of ALTER TABLE for partitioning
sql/sql_partition.cc:
  More work on table logging of ALTER TABLE for partitioning
parent 392b82a1
...@@ -1199,12 +1199,6 @@ bool execute_table_log_entry(uint first_entry); ...@@ -1199,12 +1199,6 @@ bool execute_table_log_entry(uint first_entry);
void lock_global_table_log(); void lock_global_table_log();
void unlock_global_table_log(); void unlock_global_table_log();
bool write_log_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt, bool install_flag);
bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
bool write_log_add_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
bool write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
bool write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
#define WFRM_WRITE_SHADOW 1 #define WFRM_WRITE_SHADOW 1
#define WFRM_INSTALL_SHADOW 2 #define WFRM_INSTALL_SHADOW 2
#define WFRM_PACK_FRM 4 #define WFRM_PACK_FRM 4
......
...@@ -5107,56 +5107,48 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry) ...@@ -5107,56 +5107,48 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry)
/* /*
Write the log entry to ensure that the shadow frm file is removed at Log an delete/rename frm file
crash.
SYNOPSIS SYNOPSIS
write_log_shadow_frm() write_log_rename_delete_frm()
lpt Struct containing parameters lpt Struct for parameters
install_frm Should we log action to install shadow frm or should next_entry Next reference to use in log record
the action be to remove the shadow frm file. path Name to rename from
rename_flag TRUE if rename, else delete
RETURN VALUES RETURN VALUES
TRUE Error TRUE Error
FALSE Success FALSE Success
DESCRIPTION DESCRIPTION
Prepare an entry to the table log indicating a drop/install of the shadow frm Support routine that writes a rename or delete of an frm file into the
file and its corresponding handler file. table log. It also inserts an entry that keeps track of used space into
the partition info object
*/ */
bool bool
write_log_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt, bool install_frm) write_log_rename_delete_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
uint next_entry,
const char *from_path
const char *to_path,
bool rename_flag)
{ {
TABLE_LOG_ENTRY table_log_entry; TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry; TABLE_LOG_MEMORY_ENTRY *log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= NULL; DBUG_ENTER("write_log_rename_frm");
char shadow_path[FN_LEN];
DBUG_ENTER("write_log_shadow_frm");
lock_global_table_log(); if (rename_flag)
do table_log_entry.action_type= 'r';
{ else
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
lpt->table_name, "#");
table_log_entry.action_type= 'd'; table_log_entry.action_type= 'd';
table_log_entry.next_entry= 0; table_log_entry.next_entry= next_entry;
table_log_entry.handler_type= "frm"; table_log_entry.handler_type= "frm";
table_log_entry.name= shadow_path; if (rename_flag)
table_log_entry.name= to_path;
if (write_table_log_entry(&table_log_entry, &log_entry)) table_log_entry.from_name= from_path;
break; if (write_table_log_entry(&table_log_entry, &log_entry))
insert_part_info_log_entry_list(part_info, log_entry); {
if (write_execute_table_log_entry(log_entry->entry_pos, DBUG_RETURN(TRUE);
FALSE, &exec_log_entry)) }
break; insert_part_info_log_entry_list(part_info, log_entry);
part_info->exec_log_entry= exec_log_entry; DBUG_RETURN(FALSE);
unlock_global_table_log();
DBUG_RETURN(FALSE);
} while (TRUE);
release_part_info_log_entries(part_info->first_log_entry);
part_info->first_log_entry= NULL;
unlock_global_table_log();
my_error(ER_TABLE_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
} }
...@@ -5174,24 +5166,41 @@ static ...@@ -5174,24 +5166,41 @@ static
bool bool
write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
uint *next_entry, uint *next_entry,
const char *path) const char *path,
bool temp_list)
{ {
TABLE_LOG_ENTRY table_log_entry; TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info; partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry; TABLE_LOG_MEMORY_ENTRY *log_entry;
char tmp_path[FN_LEN]; char tmp_path[FN_LEN];
List_iterator<partition_element> part_it(part_info->partitions); List_iterator<partition_element> part_it(part_info->partitions);
List_iterator<partition_element> temp_it(part_info->temp_partitions);
uint no_temp_partitions= part_info->temp_partitions.elements;
uint no_elements= part_info->partitions.elements; uint no_elements= part_info->partitions.elements;
uint i= 0; uint i= 0;
DBUG_ENTER("write_log_dropped_partitions"); DBUG_ENTER("write_log_dropped_partitions");
table_log_entry.action_type= 'd'; table_log_entry.action_type= 'd';
do if (temp_list)
no_elements= no_temp_partitions;
while (no_elements--)
{ {
partition_element *part_elem= part_it++; partition_element *part_elem;
if (temp_list)
part_elem= temp_it++;
else
part_elem= part_it++;
if (part_elem->part_state == PART_TO_BE_DROPPED || if (part_elem->part_state == PART_TO_BE_DROPPED ||
part_elem->part_state == PART_TO_BE_ADDED) part_elem->part_state == PART_TO_BE_ADDED ||
part_elem->part_state == PART_CHANGED)
{ {
uint name_variant;
if (part_elem->part_state == PART_CHANGED ||
(part_elem->part_state == PART_TO_BE_ADDED &&
no_temp_partitions))
name_variant= TEMP_PART_NAME;
else
name_variant= NORMAL_PART_NAME;
if (is_sub_partitioned(part_info)) if (is_sub_partitioned(part_info))
{ {
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
...@@ -5202,11 +5211,11 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5202,11 +5211,11 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
partition_element *sub_elem= sub_it++; partition_element *sub_elem= sub_it++;
table_log_entry.next_entry= *next_entry; table_log_entry.next_entry= *next_entry;
table_log_entry.handler_type= table_log_entry.handler_type=
ha_resolve_storage_engine_name(sub_elem->engine_type); ha_resolve_storage_engine_name(sub_elem->engine_type);
create_subpartition_name(tmp_path, path, create_subpartition_name(tmp_path, path,
part_elem->partition_name, part_elem->partition_name,
sub_elem->partition_name, sub_elem->partition_name,
NORMAL_PART_NAME); name_variant);
table_log_entry.name= tmp_path; table_log_entry.name= tmp_path;
if (write_table_log_entry(&table_log_entry, &log_entry)) if (write_table_log_entry(&table_log_entry, &log_entry))
{ {
...@@ -5223,7 +5232,7 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5223,7 +5232,7 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
ha_resolve_storage_engine_name(part_elem->engine_type); ha_resolve_storage_engine_name(part_elem->engine_type);
create_partition_name(tmp_path, path, create_partition_name(tmp_path, path,
part_elem->partition_name, part_elem->partition_name,
NORMAL_PART_NAME, TRUE); name_variant, TRUE);
table_log_entry.name= tmp_path; table_log_entry.name= tmp_path;
if (write_table_log_entry(&table_log_entry, &log_entry)) if (write_table_log_entry(&table_log_entry, &log_entry))
{ {
...@@ -5233,66 +5242,103 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5233,66 +5242,103 @@ write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
insert_part_info_log_entry_list(part_info, log_entry); insert_part_info_log_entry_list(part_info, log_entry);
} }
} }
} while (++i < no_elements); }
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
/* /*
Write the log entries to ensure that the drop partition command is completed Write the log entry to ensure that the shadow frm file is removed at
even in the presence of a crash. crash.
SYNOPSIS
write_log_drop_shadow_frm()
lpt Struct containing parameters
install_frm Should we log action to install shadow frm or should
the action be to remove the shadow frm file.
RETURN VALUES
TRUE Error
FALSE Success
DESCRIPTION
Prepare an entry to the table log indicating a drop/install of the shadow frm
file and its corresponding handler file.
*/
static
bool
write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
{
TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
char shadow_path[FN_LEN];
DBUG_ENTER("write_log_drop_shadow_frm");
lock_global_table_log();
do
{
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
lpt->table_name, "#");
if (write_log_rename_delete_frm(lpt, 0UL, NULL,
(const char*)shadow_path, FALSE))
break;
log_entry= part_info->first_log_entry;
if (write_execute_table_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry))
break;
part_info->exec_log_entry= exec_log_entry;
unlock_global_table_log();
DBUG_RETURN(FALSE);
} while (TRUE);
release_part_info_log_entries(part_info->first_log_entry);
part_info->first_log_entry= NULL;
unlock_global_table_log();
my_error(ER_TABLE_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
/*
Log renaming of shadow frm to real frm name and dropping of old frm
SYNOPSIS SYNOPSIS
write_log_drop_partition() write_log_rename_frm()
lpt Struct containing parameters lpt Struct containing parameters
RETURN VALUES RETURN VALUES
TRUE Error TRUE Error
FALSE Success FALSE Success
DESCRIPTION DESCRIPTION
Prepare entries to the table log indicating all partitions to drop and to Prepare an entry to ensure that we complete the renaming of the frm
install the shadow frm file and remove the old frm file. file if failure occurs in the middle of the rename process.
*/ */
static
bool bool
write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
TABLE_LOG_ENTRY table_log_entry; TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info; partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry; TABLE_LOG_MEMORY_ENTRY *log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; TABLE_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char tmp_path[FN_LEN]; char shadow_path[FN_LEN];
char path[FN_LEN];
uint next_entry= 0;
TABLE_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; TABLE_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
DBUG_ENTER("write_log_drop_partition"); DBUG_ENTER("write_log_drop_shadow_frm");
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path), lpt->db,
lpt->table_name, "");
lock_global_table_log(); lock_global_table_log();
do do
{ {
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path)) build_table_filename(path, sizeof(path), lpt->db,
break; lpt->table_name, "");
/* build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
At first we write an entry that installs the new frm file
*/
build_table_filename(tmp_path, sizeof(tmp_path), lpt->db,
lpt->table_name, "#"); lpt->table_name, "#");
table_log_entry.action_type= 'r'; if (write_log_rename_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
table_log_entry.next_entry= next_entry;
table_log_entry.handler_type= "frm";
table_log_entry.name= path;
table_log_entry.from_name= tmp_path;
if (write_table_log_entry(&table_log_entry, &log_entry))
break; break;
insert_part_info_log_entry_list(part_info, log_entry); log_entry= part_info->first_log_entry;
if (write_execute_table_log_entry(log_entry->entry_pos, if (write_execute_table_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
break; break;
release_part_info_log_entries(old_first_log_entry); release_part_info_log_entries(old_first_log_entry);
unlock_global_table_log(); unlock_global_table_log();
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} while (TRUE); } while (TRUE);
release_part_info_log_entries(part_info->first_log_entry); release_part_info_log_entries(part_info->first_log_entry);
part_info->first_log_entry= old_first_log_entry; part_info->first_log_entry= old_first_log_entry;
...@@ -5303,50 +5349,49 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5303,50 +5349,49 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
/* /*
Write the log entries to ensure that the add partition command is not Write the log entries to ensure that the drop partition command is completed
executed at all if a crash before it has completed even in the presence of a crash.
SYNOPSIS SYNOPSIS
write_log_add_partition() write_log_drop_partition()
lpt Struct containing parameters lpt Struct containing parameters
RETURN VALUES RETURN VALUES
TRUE Error TRUE Error
FALSE Success FALSE Success
DESCRIPTION DESCRIPTION
Prepare entries to the table log indicating all partitions to drop and to Prepare entries to the table log indicating all partitions to drop and to
remove the shadow frm file. install the shadow frm file and remove the old frm file.
The removal of the shadow frm file is already in the log file so we only
need to link the new entries to the existing and carefully ensure that
the new linked list has first the dropped partitions and then the
drop of the shadow frm file.
We always inject entries backwards in the list in the table log since we
don't know the entry position until we have written it.
*/ */
static
bool bool
write_log_add_partition(ALTER_PARTITION_PARAM_TYPE *lpt) write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
TABLE_LOG_ENTRY table_log_entry; TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info; partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry; TABLE_LOG_MEMORY_ENTRY *log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char tmp_path[FN_LEN]; char tmp_path[FN_LEN];
char path[FN_LEN]; char path[FN_LEN];
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; uint next_entry= 0;
TABLE_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; TABLE_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
uint next_entry= old_first_log_entry->entry_pos; DBUG_ENTER("write_log_drop_partition");
/* Ensure we linked the existing entries at the back */
DBUG_ENTER("write_log_add_partition");
part_info->first_log_entry= NULL; part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path), lpt->db, build_table_filename(path, sizeof(path), lpt->db,
lpt->table_name, ""); lpt->table_name, "");
build_table_filename(tmp_path, sizeof(tmp_path), lpt->db,
lpt->table_name, "#");
lock_global_table_log(); lock_global_table_log();
do do
{ {
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path)) if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path),
FALSE)
break;
if (write_log_rename_delete_frm(lpt, next_entry, (const char*)path,
(const char*)tmp_path, TRUE))
break; break;
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
/* Ensure first entry is the last dropped partition */
if (write_execute_table_log_entry(log_entry->entry_pos, if (write_execute_table_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
break; break;
...@@ -5363,28 +5408,58 @@ write_log_add_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5363,28 +5408,58 @@ write_log_add_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
/* /*
Write indicator of how to abort in first phase of change partitions Write the log entries to ensure that the add partition command is not
executed at all if a crash before it has completed
SYNOPSIS SYNOPSIS
write_log_ph1_change_partition() write_log_add_change_partition()
lpt Struct containing parameters lpt Struct containing parameters
RETURN VALUES RETURN VALUES
TRUE Error TRUE Error
FALSE Success FALSE Success
DESCRIPTION DESCRIPTION
Write the log entries to remove partitions in creation when changing Prepare entries to the table log indicating all partitions to drop and to
partitions in an ADD/REORGANIZE/COALESCE command. These commands will remove the shadow frm file.
abort the entire operation if the system crashes before the next phase We always inject entries backwards in the list in the table log since we
is done. don't know the entry position until we have written it.
*/ */
static
bool bool
write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
DBUG_ENTER("write_log_ph1_change_partition"); partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry, *exec_log_entry;
char tmp_path[FN_LEN];
char path[FN_LEN];
uint next_entry= 0;
DBUG_ENTER("write_log_add_change_partition");
build_table_filename(path, sizeof(path), lpt->db,
lpt->table_name, "");
lock_global_table_log(); lock_global_table_log();
do
{
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path),
FALSE)
break;
build_table_filename(tmp_path, sizeof(tmp_path), lpt->db,
lpt->table_name, "#");
if (write_log_rename_delete_frm(lpt, next_entry, tmp_path,
NULL, FALSE))
break;
log_entry= part_info->first_log_entry;
if (write_execute_table_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry))
break;
unlock_global_table_log();
DBUG_RETURN(FALSE);
} while (TRUE);
release_part_info_log_entries(part_info->first_log_entry);
part_info->first_log_entry= NULL;
unlock_global_table_log(); unlock_global_table_log();
DBUG_RETURN(FALSE); my_error(ER_TABLE_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
} }
...@@ -5393,7 +5468,7 @@ write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5393,7 +5468,7 @@ write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
change partitions. change partitions.
SYNOPSIS SYNOPSIS
write_log_ph2_change_partition() write_log_final_change_partition()
lpt Struct containing parameters lpt Struct containing parameters
RETURN VALUES RETURN VALUES
TRUE Error TRUE Error
...@@ -5404,14 +5479,46 @@ write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5404,14 +5479,46 @@ write_log_ph1_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
frm file. frm file.
*/ */
static
bool bool
write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{ {
DBUG_ENTER("write_log_ph2_change_partition"); TABLE_LOG_ENTRY table_log_entry;
partition_info *part_info= lpt->part_info;
TABLE_LOG_MEMORY_ENTRY *log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char shadow_path[FN_LEN];
TABLE_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
uint next_entry= 0;
DBUG_ENTER("write_log_final_change_partition");
lock_global_table_log(); lock_global_table_log();
do
{
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path),
TRUE)
break;
if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
break;
build_table_filename(path, sizeof(path), lpt->db,
lpt->table_name, "");
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
lpt->table_name, "#");
if (write_log_rename_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
break;
log_entry= part_info->first_log_entry;
if (write_execute_table_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry))
break;
release_part_info_log_entries(old_first_log_entry);
unlock_global_table_log();
DBUG_RETURN(FALSE);
} while (TRUE);
release_part_info_log_entries(part_info->first_log_entry);
part_info->first_log_entry= old_first_log_entry;
unlock_global_table_log(); unlock_global_table_log();
DBUG_RETURN(FALSE); my_error(ER_TABLE_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
} }
...@@ -5425,6 +5532,7 @@ write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5425,6 +5532,7 @@ write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
TRUE Error TRUE Error
FALSE Success FALSE Success
*/ */
static static
bool bool
write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt) write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt)
...@@ -5641,7 +5749,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5641,7 +5749,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
We insert Error injections at all places where it could be interesting We insert Error injections at all places where it could be interesting
to test if recovery is properly done. to test if recovery is properly done.
*/ */
if (write_log_shadow_frm(lpt, FALSE) || if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_1") || ERROR_INJECT_CRASH("crash_drop_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_drop_partition_2") || ERROR_INJECT_CRASH("crash_drop_partition_2") ||
...@@ -5697,26 +5805,24 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5697,26 +5805,24 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
8) Remove entries from table log 8) Remove entries from table log
9) Complete query 9) Complete query
*/ */
if (write_log_shadow_frm(lpt, FALSE) || if (write_log_add_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_1") || ERROR_INJECT_CRASH("crash_add_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_add_partition_2") || ERROR_INJECT_CRASH("crash_add_partition_2") ||
write_log_add_partition(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_3") ||
mysql_change_partitions(lpt) || mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_4") || ERROR_INJECT_CRASH("crash_add_partition_3") ||
abort_and_upgrade_lock(lpt) || abort_and_upgrade_lock(lpt) ||
((!thd->lex->no_write_to_binlog) && ((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE, (write_bin_log(thd, FALSE,
thd->query, thd->query_length), FALSE)) || thd->query, thd->query_length), FALSE)) ||
ERROR_INJECT_CRASH("crash_add_partition_4") ||
write_log_rename_frm(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_5") || ERROR_INJECT_CRASH("crash_add_partition_5") ||
write_log_shadow_frm(lpt, TRUE) ||
ERROR_INJECT_CRASH("crash_add_partition_6") ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) || mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_add_partition_7") || ERROR_INJECT_CRASH("crash_add_partition_6") ||
(close_open_tables_and_downgrade(lpt), FALSE) || (close_open_tables_and_downgrade(lpt), FALSE) ||
write_log_completed(lpt) || write_log_completed(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_8")) ERROR_INJECT_CRASH("crash_add_partition_7"))
{ {
fast_alter_partition_error_handler(lpt); fast_alter_partition_error_handler(lpt);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -5778,33 +5884,31 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5778,33 +5884,31 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
14)Complete query 14)Complete query
*/ */
if (write_log_shadow_frm(lpt, FALSE) || if (write_log_add_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_1") || ERROR_INJECT_CRASH("crash_change_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_2") || ERROR_INJECT_CRASH("crash_change_partition_2") ||
write_log_ph1_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_3") ||
mysql_change_partitions(lpt) || mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_3") ||
write_log_final_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_4") || ERROR_INJECT_CRASH("crash_change_partition_4") ||
write_log_ph2_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_5") ||
abort_and_upgrade_lock(lpt) || abort_and_upgrade_lock(lpt) ||
table->file->extra(HA_EXTRA_PREPARE_FOR_DELETE) || table->file->extra(HA_EXTRA_PREPARE_FOR_DELETE) ||
ERROR_INJECT_CRASH("crash_change_partition_6") || ERROR_INJECT_CRASH("crash_change_partition_5") ||
mysql_rename_partitions(lpt) || mysql_rename_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_7") || ERROR_INJECT_CRASH("crash_change_partition_6") ||
((!thd->lex->no_write_to_binlog) && ((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE, (write_bin_log(thd, FALSE,
thd->query, thd->query_length), FALSE)) || thd->query, thd->query_length), FALSE)) ||
ERROR_INJECT_CRASH("crash_change_partition_8") || ERROR_INJECT_CRASH("crash_change_partition_7") ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) || mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_9") || ERROR_INJECT_CRASH("crash_change_partition_8") ||
(close_open_tables_and_downgrade(lpt), FALSE) || (close_open_tables_and_downgrade(lpt), FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_10") || ERROR_INJECT_CRASH("crash_change_partition_9") ||
mysql_drop_partitions(lpt) || mysql_drop_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_11") || ERROR_INJECT_CRASH("crash_change_partition_10") ||
write_log_completed(lpt) || write_log_completed(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_12") || ERROR_INJECT_CRASH("crash_change_partition_11") ||
(mysql_wait_completed_table(lpt, table), FALSE)) (mysql_wait_completed_table(lpt, table), FALSE))
{ {
fast_alter_partition_error_handler(lpt); fast_alter_partition_error_handler(lpt);
......
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