Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2127 06/02/14 11:08:58 mikron@stripped +3 -0
WL 2826: Error handling of ALTER TABLE for partitioning
Added action code for recovery
sql/sql_table.cc
1.317 06/02/14 11:08:45 mikron@stripped +97 -2
Added action code for recovery
sql/sql_partition.cc
1.48 06/02/14 11:08:45 mikron@stripped +6 -6
Some renames to replace
sql/mysql_priv.h
1.392 06/02/14 11:08:44 mikron@stripped +1 -0
Added entry in table log struct
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mikron
# Host: mikael-ronstr-ms-dator.local
# Root: /Users/mikron/wl2826
--- 1.391/sql/mysql_priv.h 2006-02-11 06:41:37 +01:00
+++ 1.392/sql/mysql_priv.h 2006-02-14 11:08:44 +01:00
@@ -1175,6 +1175,7 @@
const char *from_name;
const char *handler_type;
uint next_entry;
+ uint entry_pos;
char action_type;
char entry_type;
char phase;
--- 1.316/sql/sql_table.cc 2006-02-13 13:52:10 +01:00
+++ 1.317/sql/sql_table.cc 2006-02-14 11:08:45 +01:00
@@ -478,6 +478,7 @@
/* Error handling */
DBUG_RETURN(TRUE);
}
+ table_log_entry->entry_pos= read_entry;
table_log_entry->entry_type= file_entry[TLOG_ENTRY_TYPE_POS];
table_log_entry->action_type= file_entry[TLOG_ACTION_TYPE_POS];
table_log_entry->phase= file_entry[TLOG_PHASE_POS];
@@ -544,8 +545,97 @@
bool
execute_table_log_action(TABLE_LOG_ENTRY *table_log_entry)
{
+ bool frm_action= FALSE;
+ LEX_STRING handler_name;
+ handler *file;
+ MEMROOT mem_root;
+ bool= error= TRUE;
+ char path[FN_REFLEN];
+ char from_path[FN_REFLEN];
+ char *par_ext= ".par";
DBUG_ENTER("execute_table_log_action");
- DBUG_RETURN(FALSE);
+
+ if (table_log_entry->entry_type == TLOG_IGNORE_LOG_ENTRY_CODE)
+ {
+ DBUG_RETURN(FALSE);
+ }
+ handler_name.str= table_log_entry->handler_type;
+ handler_name.length= strlen(table_log_entry->handler_type);
+ hton= ha_resolve_by_name(current_thd, handler_name);
+ if (!hton)
+ {
+ DBUG_RETURN(TRUE);
+ }
+ init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
+ if (strcmp("frm", table_log_entry->handler_type))
+ frm_action= TRUE;
+ else
+ {
+ file= get_new_handler(table_share, &mem_root, hton);
+ if (!file)
+ goto error;
+ }
+ switch (table_log_entry->action_type)
+ case TLOG_ACTION_DELETE_CODE:
+ case TLOG_ACTION_REPLACE_CODE:
+ if (table_log_entry->action_type == TLOG_ACTION_DELETE_CODE ||
+ (table_log_entry->action_type == TLOG_ACTION_REPLACE_CODE &&
+ table_log_entry->phase == 0UL))
+ {
+ if (frm_action)
+ {
+ strxmov(path, table_log_entry->name, reg_ext, NullS);
+ VOID(my_delete(path, MYF(0)));
+ strxmov(path, table_log_entry->name, par_ext, NullS);
+ VOID(my_delete(path, MYF(0)));
+ }
+ else
+ {
+ if (file->delete_table(table_name))
+ break;
+ }
+ if ((!inactivate_table_log_entry(table_log_entry->entry_pos)) &&
+ (!sync_table_log()))
+ ;
+ else
+ error= FALSE;
+ break;
+ }
+ if (table_log_entry->action_type == TLOG_ACTION_DELETE_CODE)
+ break;
+ case TLOG_ACTION_RENAME_CODE:
+ error= TRUE;
+ if (frm_action)
+ {
+ strxmov(path, table_log_entry->name, reg_ext, NullS);
+ strxmov(from_path, table_log_entry->from_name, reg_ext, NullS);
+ if (my_rename(path, from_path, MYF(0)))
+ break;
+ strxmov(path, table_log_entry->name, par_ext, NullS);
+ strxmov(from_path, table_log_entry->from_name, par_ext, NullS);
+ if (my_rename(path, from_path, MYF(0)))
+ break;
+ }
+ else
+ {
+ if (file->rename_table(table_log_entry->name,
+ table_log_entry->from_name))
+ break;
+ if ((!inactivate_table_log_entry(table_log_entry->entry_pos)) &&
+ (!sync_table_log()))
+ ;
+ else
+ error= FALSE;
+ }
+ break;
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ delete file;
+error:
+ free_root(&mem_root, MYF(0));
+ DBUG_RETURN(error);
}
@@ -864,6 +954,7 @@
uint read_entry= first_entry;
DBUG_ENTER("execute_table_log_entry");
+ lock_global_table_log();
do
{
if (read_table_log_entry(read_entry, &table_log_entry))
@@ -874,7 +965,8 @@
}
DBUG_ASSERT(table_log_entry.entry_type == TLOG_LOG_ENTRY_CODE ||
table_log_entry.entry_type == TLOG_IGNORE_LOG_ENTRY_CODE);
- if (execute_table_log_action(&table_log_entry))
+
+ if (execute_table_log_action(file, &table_log_entry))
{
DBUG_ASSERT(0);
/* Write to error log and continue with next log entry */
@@ -882,9 +974,11 @@
}
read_entry= table_log_entry.next_entry;
} while (read_entry);
+ unlock_global_table_log();
DBUG_RETURN(FALSE);
}
+
/*
Execute the table log at recovery of MySQL Server
SYNOPSIS
@@ -922,6 +1016,7 @@
}
}
}
+ release_handler_objects();
VOID(init_table_log());
DBUG_VOID_RETURN;
}
--- 1.47/sql/sql_partition.cc 2006-02-13 13:52:10 +01:00
+++ 1.48/sql/sql_partition.cc 2006-02-14 11:08:45 +01:00
@@ -5132,7 +5132,7 @@
{
TABLE_LOG_ENTRY table_log_entry;
TABLE_LOG_MEMORY_ENTRY *log_entry;
- DBUG_ENTER("write_log_replace_frm");
+ DBUG_ENTER("write_log_replace_delete_frm");
if (replace_flag)
table_log_entry.action_type= TLOG_REPLACE_ACTION_CODE;
@@ -5412,7 +5412,7 @@
lock_global_table_log();
do
{
- if (write_log_rename_delete_frm(lpt, 0UL, NULL,
+ if (write_log_replace_delete_frm(lpt, 0UL, NULL,
(const char*)shadow_path, FALSE))
break;
log_entry= part_info->first_log_entry;
@@ -5465,7 +5465,7 @@
lock_global_table_log();
do
{
- if (write_log_rename_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
+ if (write_log_replace_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
break;
log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry;
@@ -5525,7 +5525,7 @@
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,
+ if (write_log_replace_delete_frm(lpt, next_entry, (const char*)path,
(const char*)tmp_path, TRUE))
break;
log_entry= part_info->first_log_entry;
@@ -5585,7 +5585,7 @@
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
break;
- if (write_log_rename_delete_frm(lpt, next_entry, NULL, tmp_path,
+ if (write_log_replace_delete_frm(lpt, next_entry, NULL, tmp_path,
FALSE))
break;
log_entry= part_info->first_log_entry;
@@ -5647,7 +5647,7 @@
break;
if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
break;
- if (write_log_rename_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
+ if (write_log_replace_delete_frm(lpt, 0UL, path, shadow_path, FALSE))
break;
log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry;
| Thread |
|---|
| • bk commit into 5.1 tree (mikron:1.2127) | mikael | 14 Feb |