Commit 5b6c6c49 authored by unknown's avatar unknown

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
parent de717a99
...@@ -714,10 +714,10 @@ int ha_partition::rename_partitions(const char *path) ...@@ -714,10 +714,10 @@ int ha_partition::rename_partitions(const char *path)
DBUG_PRINT("info", ("Delete partition %s", norm_name_buff)); DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
if ((ret_error= file->delete_table((const char *) norm_name_buff))) if ((ret_error= file->delete_table((const char *) norm_name_buff)))
error= ret_error; 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; error= 1;
else else
sub_elem->log_entry= NULL; /* Indicate success */ part_elem->log_entry= NULL; /* Indicate success */
} }
} while (++i < temp_partitions); } while (++i < temp_partitions);
VOID(sync_table_log()); VOID(sync_table_log());
...@@ -780,8 +780,8 @@ int ha_partition::rename_partitions(const char *path) ...@@ -780,8 +780,8 @@ int ha_partition::rename_partitions(const char *path)
TEMP_PART_NAME); TEMP_PART_NAME);
DBUG_PRINT("info", ("Rename subpartition from %s to %s", DBUG_PRINT("info", ("Rename subpartition from %s to %s",
part_name_buff, norm_name_buff)); part_name_buff, norm_name_buff));
if ((ret_error= file->rename_table((const char *) norm_name_buff, if ((ret_error= file->rename_table((const char *) part_name_buff,
(const char *) part_name_buff))) (const char *) norm_name_buff)))
error= ret_error; error= ret_error;
else if (inactivate_table_log_entry(sub_elem->log_entry->entry_pos)) else if (inactivate_table_log_entry(sub_elem->log_entry->entry_pos))
error= 1; error= 1;
...@@ -797,7 +797,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -797,7 +797,7 @@ int ha_partition::rename_partitions(const char *path)
if (part_elem->part_state == PART_IS_CHANGED) if (part_elem->part_state == PART_IS_CHANGED)
{ {
file= m_reorged_file[part_count++]; 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))) if ((ret_error= file->delete_table((const char *) norm_name_buff)))
error= ret_error; error= ret_error;
else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos)) else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos))
...@@ -810,8 +810,8 @@ int ha_partition::rename_partitions(const char *path) ...@@ -810,8 +810,8 @@ int ha_partition::rename_partitions(const char *path)
TRUE); TRUE);
DBUG_PRINT("info", ("Rename partition from %s to %s", DBUG_PRINT("info", ("Rename partition from %s to %s",
part_name_buff, norm_name_buff)); part_name_buff, norm_name_buff));
if ((ret_error= file->rename_table((const char *) norm_name_buff, if ((ret_error= file->rename_table((const char *) part_name_buff,
(const char *) part_name_buff))) (const char *) norm_name_buff)))
error= ret_error; error= ret_error;
else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos)) else if (inactivate_table_log_entry(part_elem->log_entry->entry_pos))
error= 1; error= 1;
......
...@@ -5678,7 +5678,7 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash) ...@@ -5678,7 +5678,7 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash)
{ {
partition_info *part_info= lpt->part_info; partition_info *part_info= lpt->part_info;
uint count_loop= 0; uint count_loop= 0;
bool success; bool not_success;
TABLE_LOG_MEMORY_ENTRY *log_entry= part_info->exec_log_entry; TABLE_LOG_MEMORY_ENTRY *log_entry= part_info->exec_log_entry;
DBUG_ENTER("write_log_completed"); DBUG_ENTER("write_log_completed");
...@@ -5686,11 +5686,11 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash) ...@@ -5686,11 +5686,11 @@ write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, bool dont_crash)
lock_global_table_log(); lock_global_table_log();
do 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; break;
my_sleep(1); my_sleep(1);
} while (count_loop++ < 20); } while (count_loop++ < 20);
if (!success && !dont_crash) if (not_success && !dont_crash)
{ {
/* /*
Failed to write 20 consecutive attempts to write. Bad... Failed to write 20 consecutive attempts to write. Bad...
......
...@@ -435,7 +435,7 @@ read_table_log_header() ...@@ -435,7 +435,7 @@ read_table_log_header()
{ {
if (read_table_log_file_entry(0UL)) if (read_table_log_file_entry(0UL))
{ {
/* Write message into error log */ ; /* Write message into error log */
} }
else else
successful_open= TRUE; successful_open= TRUE;
...@@ -446,6 +446,8 @@ read_table_log_header() ...@@ -446,6 +446,8 @@ read_table_log_header()
uint4korr(&file_entry[TLOG_HANDLER_TYPE_POS]); uint4korr(&file_entry[TLOG_HANDLER_TYPE_POS]);
if (successful_open) if (successful_open)
global_table_log.io_size= uint4korr(&file_entry[TLOG_IO_SIZE_POS]); 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_free= NULL;
global_table_log.first_used= NULL; global_table_log.first_used= NULL;
global_table_log.no_entries= 0; global_table_log.no_entries= 0;
...@@ -513,6 +515,7 @@ init_table_log() ...@@ -513,6 +515,7 @@ init_table_log()
char file_name[FN_REFLEN]; char file_name[FN_REFLEN];
DBUG_ENTER("init_table_log"); DBUG_ENTER("init_table_log");
global_table_log.io_size= IO_SIZE;
create_table_log_file_name(file_name); create_table_log_file_name(file_name);
VOID(my_delete(file_name, MYF(0))); VOID(my_delete(file_name, MYF(0)));
if ((global_table_log.file_id= my_create(file_name, if ((global_table_log.file_id= my_create(file_name,
......
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