From 5b6c6c49b8316d6d8b2f77abafc6743c372385d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Feb 2006 16:22:19 -0500 Subject: [PATCH] WL 2826: Error handling of ALTER TABLE for partitioning Bug fixes sql/ha_partition.cc: Bug fixes sql/sql_partition.cc: Bug fixes sql/sql_table.cc: Bug fixes --- sql/ha_partition.cc | 14 +++++++------- sql/sql_partition.cc | 6 +++--- sql/sql_table.cc | 5 ++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index d65203e1b34..4bc0d4e3327 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -714,10 +714,10 @@ int ha_partition::rename_partitions(const char *path) DBUG_PRINT("info", ("Delete partition %s", norm_name_buff)); if ((ret_error= file->delete_table((const char *) norm_name_buff))) error= ret_error; - else if (inactivate_table_log_entry(sub_elem->log_entry->entry_pos)) + else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos)) error= 1; else - sub_elem->log_entry= NULL; /* Indicate success */ + part_elem->log_entry= NULL; /* Indicate success */ } } while (++i < temp_partitions); VOID(sync_table_log()); @@ -780,8 +780,8 @@ int ha_partition::rename_partitions(const char *path) TEMP_PART_NAME); DBUG_PRINT("info", ("Rename subpartition from %s to %s", part_name_buff, norm_name_buff)); - if ((ret_error= file->rename_table((const char *) norm_name_buff, - (const char *) part_name_buff))) + if ((ret_error= file->rename_table((const char *) part_name_buff, + (const char *) norm_name_buff))) error= ret_error; else if (inactivate_table_log_entry(sub_elem->log_entry->entry_pos)) error= 1; @@ -797,7 +797,7 @@ int ha_partition::rename_partitions(const char *path) if (part_elem->part_state == PART_IS_CHANGED) { file= m_reorged_file[part_count++]; - DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff)); + DBUG_PRINT("info", ("Delete partition %s", norm_name_buff)); if ((ret_error= file->delete_table((const char *) norm_name_buff))) error= ret_error; else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos)) @@ -810,8 +810,8 @@ int ha_partition::rename_partitions(const char *path) TRUE); DBUG_PRINT("info", ("Rename partition from %s to %s", part_name_buff, norm_name_buff)); - if ((ret_error= file->rename_table((const char *) norm_name_buff, - (const char *) part_name_buff))) + if ((ret_error= file->rename_table((const char *) part_name_buff, + (const char *) norm_name_buff))) error= ret_error; else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos)) error= 1; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index c7b75c6548c..6756d345cab 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5678,7 +5678,7 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash) { partition_info *part_info= lpt->part_info; uint count_loop= 0; - bool success; + bool not_success; TABLE_LOG_MEMORY_ENTRY *log_entry= part_info->exec_log_entry; DBUG_ENTER("write_log_completed"); @@ -5686,11 +5686,11 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash) lock_global_table_log(); do { - if (!(success= write_execute_table_log_entry(0UL, TRUE, &log_entry))) + if (!(not_success= write_execute_table_log_entry(0UL, TRUE, &log_entry))) break; my_sleep(1); } while (count_loop++ < 20); - if (!success && !dont_crash) + if (not_success && !dont_crash) { /* Failed to write 20 consecutive attempts to write. Bad... diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 963c8e5171e..4db976c34fa 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -435,7 +435,7 @@ read_table_log_header() { if (read_table_log_file_entry(0UL)) { - /* Write message into error log */ + ; /* Write message into error log */ } else successful_open= TRUE; @@ -446,6 +446,8 @@ read_table_log_header() uint4korr(&file_entry[TLOG_HANDLER_TYPE_POS]); if (successful_open) global_table_log.io_size= uint4korr(&file_entry[TLOG_IO_SIZE_POS]); + else + global_table_log.io_size= IO_SIZE; global_table_log.first_free= NULL; global_table_log.first_used= NULL; global_table_log.no_entries= 0; @@ -513,6 +515,7 @@ init_table_log() char file_name[FN_REFLEN]; DBUG_ENTER("init_table_log"); + global_table_log.io_size= IO_SIZE; create_table_log_file_name(file_name); VOID(my_delete(file_name, MYF(0))); if ((global_table_log.file_id= my_create(file_name,