Commit 188b0b99 authored by Monty's avatar Monty Committed by Sergei Golubchik

Rename all external ddl_log function to start with ddl_log_ prefix

Rename deactivate_ddl_log_entry to ddl_log_increment_phase
parent 02b6cef4
...@@ -641,7 +641,7 @@ int init_embedded_server(int argc, char **argv, char **groups) ...@@ -641,7 +641,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
} }
} }
execute_ddl_log_recovery(); ddl_log_execute_recovery();
mysql_embedded_init= 1; mysql_embedded_init= 1;
return 0; return 0;
} }
......
...@@ -146,9 +146,9 @@ static bool write_ddl_log_file_entry(uint entry_no) ...@@ -146,9 +146,9 @@ static bool write_ddl_log_file_entry(uint entry_no)
*/ */
static bool sync_ddl_log_file() static bool ddl_log_sync_file()
{ {
DBUG_ENTER("sync_ddl_log_file"); DBUG_ENTER("ddl_log_sync_file");
DBUG_RETURN(mysql_file_sync(global_ddl_log.file_id, MYF(MY_WME))); DBUG_RETURN(mysql_file_sync(global_ddl_log.file_id, MYF(MY_WME)));
} }
...@@ -179,7 +179,7 @@ static bool write_ddl_log_header() ...@@ -179,7 +179,7 @@ static bool write_ddl_log_header()
sql_print_error("Error writing ddl log header"); sql_print_error("Error writing ddl log header");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(sync_ddl_log_file()); DBUG_RETURN(ddl_log_sync_file());
} }
...@@ -408,9 +408,9 @@ static bool init_ddl_log() ...@@ -408,9 +408,9 @@ static bool init_ddl_log()
@retval FALSE Success @retval FALSE Success
*/ */
static bool sync_ddl_log_no_lock() static bool ddl_log_sync_no_lock()
{ {
DBUG_ENTER("sync_ddl_log_no_lock"); DBUG_ENTER("ddl_log_sync_no_lock");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
if ((!global_ddl_log.recovery_phase) && if ((!global_ddl_log.recovery_phase) &&
...@@ -418,7 +418,7 @@ static bool sync_ddl_log_no_lock() ...@@ -418,7 +418,7 @@ static bool sync_ddl_log_no_lock()
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(sync_ddl_log_file()); DBUG_RETURN(ddl_log_sync_file());
} }
...@@ -449,10 +449,10 @@ static bool sync_ddl_log_no_lock() ...@@ -449,10 +449,10 @@ static bool sync_ddl_log_no_lock()
@retval FALSE Success @retval FALSE Success
*/ */
static bool deactivate_ddl_log_entry_no_lock(uint entry_no) static bool ddl_log_increment_phase_no_lock(uint entry_no)
{ {
uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf; uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf;
DBUG_ENTER("deactivate_ddl_log_entry_no_lock"); DBUG_ENTER("ddl_log_increment_phase_no_lock");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
if (!read_ddl_log_file_entry(entry_no)) if (!read_ddl_log_file_entry(entry_no))
...@@ -585,9 +585,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -585,9 +585,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
break; break;
} }
} }
if ((deactivate_ddl_log_entry_no_lock(ddl_log_entry->entry_pos))) if ((ddl_log_increment_phase_no_lock(ddl_log_entry->entry_pos)))
break; break;
(void) sync_ddl_log_no_lock(); (void) ddl_log_sync_no_lock();
error= 0; error= 0;
if (ddl_log_entry->action_type == DDL_LOG_DELETE_ACTION) if (ddl_log_entry->action_type == DDL_LOG_DELETE_ACTION)
break; break;
...@@ -621,9 +621,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -621,9 +621,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
ddl_log_entry->name)) ddl_log_entry->name))
break; break;
} }
if ((deactivate_ddl_log_entry_no_lock(ddl_log_entry->entry_pos))) if ((ddl_log_increment_phase_no_lock(ddl_log_entry->entry_pos)))
break; break;
(void) sync_ddl_log_no_lock(); (void) ddl_log_sync_no_lock();
error= FALSE; error= FALSE;
break; break;
} }
...@@ -646,7 +646,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -646,7 +646,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
file_entry_buf[DDL_LOG_PHASE_POS]--; file_entry_buf[DDL_LOG_PHASE_POS]--;
if (write_ddl_log_file_entry(ddl_log_entry->entry_pos)) if (write_ddl_log_file_entry(ddl_log_entry->entry_pos))
break; break;
if (sync_ddl_log_no_lock()) if (ddl_log_sync_no_lock())
break; break;
/* fall through */ /* fall through */
case EXCH_PHASE_FROM_TO_NAME: case EXCH_PHASE_FROM_TO_NAME:
...@@ -657,7 +657,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -657,7 +657,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
file_entry_buf[DDL_LOG_PHASE_POS]--; file_entry_buf[DDL_LOG_PHASE_POS]--;
if (write_ddl_log_file_entry(ddl_log_entry->entry_pos)) if (write_ddl_log_file_entry(ddl_log_entry->entry_pos))
break; break;
if (sync_ddl_log_no_lock()) if (ddl_log_sync_no_lock())
break; break;
/* fall through */ /* fall through */
case EXCH_PHASE_NAME_TO_TEMP: case EXCH_PHASE_NAME_TO_TEMP:
...@@ -668,7 +668,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -668,7 +668,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= DDL_IGNORE_LOG_ENTRY_CODE; file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= DDL_IGNORE_LOG_ENTRY_CODE;
if (write_ddl_log_file_entry(ddl_log_entry->entry_pos)) if (write_ddl_log_file_entry(ddl_log_entry->entry_pos))
break; break;
if (sync_ddl_log_no_lock()) if (ddl_log_sync_no_lock())
break; break;
error= FALSE; error= FALSE;
break; break;
...@@ -752,11 +752,11 @@ static bool get_free_ddl_log_entry(DDL_LOG_MEMORY_ENTRY **active_entry, ...@@ -752,11 +752,11 @@ static bool get_free_ddl_log_entry(DDL_LOG_MEMORY_ENTRY **active_entry,
@retval FALSE Success @retval FALSE Success
*/ */
static bool execute_ddl_log_entry_no_lock(THD *thd, uint first_entry) static bool ddl_log_execute_entry_no_lock(THD *thd, uint first_entry)
{ {
DDL_LOG_ENTRY ddl_log_entry; DDL_LOG_ENTRY ddl_log_entry;
uint read_entry= first_entry; uint read_entry= first_entry;
DBUG_ENTER("execute_ddl_log_entry_no_lock"); DBUG_ENTER("ddl_log_execute_entry_no_lock");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
do do
...@@ -803,11 +803,11 @@ static bool execute_ddl_log_entry_no_lock(THD *thd, uint first_entry) ...@@ -803,11 +803,11 @@ static bool execute_ddl_log_entry_no_lock(THD *thd, uint first_entry)
@retval FALSE Success @retval FALSE Success
*/ */
bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
DDL_LOG_MEMORY_ENTRY **active_entry) DDL_LOG_MEMORY_ENTRY **active_entry)
{ {
bool error, write_header; bool error, write_header;
DBUG_ENTER("write_ddl_log_entry"); DBUG_ENTER("ddl_log_write_entry");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
if (init_ddl_log()) if (init_ddl_log())
...@@ -840,12 +840,12 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, ...@@ -840,12 +840,12 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
} }
if (write_header && likely(!error)) if (write_header && likely(!error))
{ {
(void) sync_ddl_log_no_lock(); (void) ddl_log_sync_no_lock();
if (write_ddl_log_header()) if (write_ddl_log_header())
error= TRUE; error= TRUE;
} }
if (unlikely(error)) if (unlikely(error))
release_ddl_log_memory_entry(*active_entry); ddl_log_release_memory_entry(*active_entry);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -876,13 +876,13 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, ...@@ -876,13 +876,13 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
@retval FALSE Success @retval FALSE Success
*/ */
bool write_execute_ddl_log_entry(uint first_entry, bool ddl_log_write_execute_entry(uint first_entry,
bool complete, bool complete,
DDL_LOG_MEMORY_ENTRY **active_entry) DDL_LOG_MEMORY_ENTRY **active_entry)
{ {
bool write_header= FALSE; bool write_header= FALSE;
char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
DBUG_ENTER("write_execute_ddl_log_entry"); DBUG_ENTER("ddl_log_write_execute_entry");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
if (init_ddl_log()) if (init_ddl_log())
...@@ -897,7 +897,7 @@ bool write_execute_ddl_log_entry(uint first_entry, ...@@ -897,7 +897,7 @@ bool write_execute_ddl_log_entry(uint first_entry,
any log entries before, we are only here to write the execute any log entries before, we are only here to write the execute
entry to indicate it is done. entry to indicate it is done.
*/ */
(void) sync_ddl_log_no_lock(); (void) ddl_log_sync_no_lock();
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_LOG_EXECUTE_CODE; file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_LOG_EXECUTE_CODE;
} }
else else
...@@ -919,15 +919,15 @@ bool write_execute_ddl_log_entry(uint first_entry, ...@@ -919,15 +919,15 @@ bool write_execute_ddl_log_entry(uint first_entry,
if (write_ddl_log_file_entry((*active_entry)->entry_pos)) if (write_ddl_log_file_entry((*active_entry)->entry_pos))
{ {
sql_print_error("Error writing execute entry in ddl log"); sql_print_error("Error writing execute entry in ddl log");
release_ddl_log_memory_entry(*active_entry); ddl_log_release_memory_entry(*active_entry);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
(void) sync_ddl_log_no_lock(); (void) ddl_log_sync_no_lock();
if (write_header) if (write_header)
{ {
if (write_ddl_log_header()) if (write_ddl_log_header())
{ {
release_ddl_log_memory_entry(*active_entry); ddl_log_release_memory_entry(*active_entry);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
...@@ -938,7 +938,7 @@ bool write_execute_ddl_log_entry(uint first_entry, ...@@ -938,7 +938,7 @@ bool write_execute_ddl_log_entry(uint first_entry,
/** /**
Deactivate an individual entry. Deactivate an individual entry.
@details see deactivate_ddl_log_entry_no_lock. @details see ddl_log_increment_phase_no_lock.
@param entry_no Entry position of record to change @param entry_no Entry position of record to change
...@@ -947,13 +947,13 @@ bool write_execute_ddl_log_entry(uint first_entry, ...@@ -947,13 +947,13 @@ bool write_execute_ddl_log_entry(uint first_entry,
@retval FALSE Success @retval FALSE Success
*/ */
bool deactivate_ddl_log_entry(uint entry_no) bool ddl_log_increment_phase(uint entry_no)
{ {
bool error; bool error;
DBUG_ENTER("deactivate_ddl_log_entry"); DBUG_ENTER("ddl_log_increment_phase");
mysql_mutex_lock(&LOCK_gdl); mysql_mutex_lock(&LOCK_gdl);
error= deactivate_ddl_log_entry_no_lock(entry_no); error= ddl_log_increment_phase_no_lock(entry_no);
mysql_mutex_unlock(&LOCK_gdl); mysql_mutex_unlock(&LOCK_gdl);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -967,13 +967,13 @@ bool deactivate_ddl_log_entry(uint entry_no) ...@@ -967,13 +967,13 @@ bool deactivate_ddl_log_entry(uint entry_no)
@retval FALSE Success @retval FALSE Success
*/ */
bool sync_ddl_log() bool ddl_log_sync()
{ {
bool error; bool error;
DBUG_ENTER("sync_ddl_log"); DBUG_ENTER("ddl_log_sync");
mysql_mutex_lock(&LOCK_gdl); mysql_mutex_lock(&LOCK_gdl);
error= sync_ddl_log_no_lock(); error= ddl_log_sync_no_lock();
mysql_mutex_unlock(&LOCK_gdl); mysql_mutex_unlock(&LOCK_gdl);
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -985,12 +985,12 @@ bool sync_ddl_log() ...@@ -985,12 +985,12 @@ bool sync_ddl_log()
@param log_memory_entry Log memory entry to release @param log_memory_entry Log memory entry to release
*/ */
void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry) void ddl_log_release_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry)
{ {
DDL_LOG_MEMORY_ENTRY *first_free= global_ddl_log.first_free; DDL_LOG_MEMORY_ENTRY *first_free= global_ddl_log.first_free;
DDL_LOG_MEMORY_ENTRY *next_log_entry= log_entry->next_log_entry; DDL_LOG_MEMORY_ENTRY *next_log_entry= log_entry->next_log_entry;
DDL_LOG_MEMORY_ENTRY *prev_log_entry= log_entry->prev_log_entry; DDL_LOG_MEMORY_ENTRY *prev_log_entry= log_entry->prev_log_entry;
DBUG_ENTER("release_ddl_log_memory_entry"); DBUG_ENTER("ddl_log_release_memory_entry");
mysql_mutex_assert_owner(&LOCK_gdl); mysql_mutex_assert_owner(&LOCK_gdl);
global_ddl_log.first_free= log_entry; global_ddl_log.first_free= log_entry;
...@@ -1018,13 +1018,13 @@ void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry) ...@@ -1018,13 +1018,13 @@ void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry)
@retval FALSE Success @retval FALSE Success
*/ */
bool execute_ddl_log_entry(THD *thd, uint first_entry) bool ddl_log_execute_entry(THD *thd, uint first_entry)
{ {
bool error; bool error;
DBUG_ENTER("execute_ddl_log_entry"); DBUG_ENTER("ddl_log_execute_entry");
mysql_mutex_lock(&LOCK_gdl); mysql_mutex_lock(&LOCK_gdl);
error= execute_ddl_log_entry_no_lock(thd, first_entry); error= ddl_log_execute_entry_no_lock(thd, first_entry);
mysql_mutex_unlock(&LOCK_gdl); mysql_mutex_unlock(&LOCK_gdl);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1050,14 +1050,14 @@ static void close_ddl_log() ...@@ -1050,14 +1050,14 @@ static void close_ddl_log()
Execute the ddl log at recovery of MySQL Server. Execute the ddl log at recovery of MySQL Server.
*/ */
void execute_ddl_log_recovery() void ddl_log_execute_recovery()
{ {
uint num_entries, i; uint num_entries, i;
THD *thd, *original_thd; THD *thd, *original_thd;
DDL_LOG_ENTRY ddl_log_entry; DDL_LOG_ENTRY ddl_log_entry;
char file_name[FN_REFLEN]; char file_name[FN_REFLEN];
static char recover_query_string[]= "INTERNAL DDL LOG RECOVER IN PROGRESS"; static char recover_query_string[]= "INTERNAL DDL LOG RECOVER IN PROGRESS";
DBUG_ENTER("execute_ddl_log_recovery"); DBUG_ENTER("ddl_log_execute_recovery");
/* /*
Initialise global_ddl_log struct Initialise global_ddl_log struct
...@@ -1092,7 +1092,7 @@ void execute_ddl_log_recovery() ...@@ -1092,7 +1092,7 @@ void execute_ddl_log_recovery()
} }
if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE) if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE)
{ {
if (execute_ddl_log_entry_no_lock(thd, ddl_log_entry.next_entry)) if (ddl_log_execute_entry_no_lock(thd, ddl_log_entry.next_entry))
{ {
/* Real unpleasant scenario but we continue anyways. */ /* Real unpleasant scenario but we continue anyways. */
continue; continue;
...@@ -1115,11 +1115,11 @@ void execute_ddl_log_recovery() ...@@ -1115,11 +1115,11 @@ void execute_ddl_log_recovery()
Release all memory allocated to the ddl log. Release all memory allocated to the ddl log.
*/ */
void release_ddl_log() void ddl_log_release()
{ {
DDL_LOG_MEMORY_ENTRY *free_list; DDL_LOG_MEMORY_ENTRY *free_list;
DDL_LOG_MEMORY_ENTRY *used_list; DDL_LOG_MEMORY_ENTRY *used_list;
DBUG_ENTER("release_ddl_log"); DBUG_ENTER("ddl_log_release");
if (!global_ddl_log.do_release) if (!global_ddl_log.do_release)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -95,17 +95,17 @@ typedef struct st_ddl_log_memory_entry ...@@ -95,17 +95,17 @@ typedef struct st_ddl_log_memory_entry
} DDL_LOG_MEMORY_ENTRY; } DDL_LOG_MEMORY_ENTRY;
bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry, bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
DDL_LOG_MEMORY_ENTRY **active_entry); DDL_LOG_MEMORY_ENTRY **active_entry);
bool write_execute_ddl_log_entry(uint first_entry, bool ddl_log_write_execute_entry(uint first_entry,
bool complete, bool complete,
DDL_LOG_MEMORY_ENTRY **active_entry); DDL_LOG_MEMORY_ENTRY **active_entry);
bool deactivate_ddl_log_entry(uint entry_no); bool ddl_log_increment_phase(uint entry_no);
void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry); void ddl_log_release_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry);
bool sync_ddl_log(); bool ddl_log_sync();
void release_ddl_log(); void ddl_log_release();
void execute_ddl_log_recovery(); void ddl_log_execute_recovery();
bool execute_ddl_log_entry(THD *thd, uint first_entry); bool ddl_log_execute_entry(THD *thd, uint first_entry);
extern mysql_mutex_t LOCK_gdl; extern mysql_mutex_t LOCK_gdl;
#endif /* DDL_LOG_INCLUDED */ #endif /* DDL_LOG_INCLUDED */
...@@ -914,7 +914,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -914,7 +914,7 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff)); DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff));
if (unlikely((ret_error= file->delete_table(part_name_buff)))) if (unlikely((ret_error= file->delete_table(part_name_buff))))
error= ret_error; error= ret_error;
if (unlikely(deactivate_ddl_log_entry(sub_elem->log_entry-> if (unlikely(ddl_log_increment_phase(sub_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
} while (++j < num_subparts); } while (++j < num_subparts);
...@@ -931,7 +931,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -931,7 +931,7 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop partition %s", part_name_buff)); DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
if (unlikely((ret_error= file->delete_table(part_name_buff)))) if (unlikely((ret_error= file->delete_table(part_name_buff))))
error= ret_error; error= ret_error;
if (unlikely(deactivate_ddl_log_entry(part_elem->log_entry-> if (unlikely(ddl_log_increment_phase(part_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
} }
...@@ -942,7 +942,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -942,7 +942,7 @@ int ha_partition::drop_partitions(const char *path)
part_elem->part_state= PART_IS_DROPPED; part_elem->part_state= PART_IS_DROPPED;
} }
} while (++i < num_parts); } while (++i < num_parts);
(void) sync_ddl_log(); (void) ddl_log_sync();
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1023,7 +1023,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1023,7 +1023,7 @@ int ha_partition::rename_partitions(const char *path)
DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff)); DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff));
if (unlikely((ret_error= file->delete_table(norm_name_buff)))) if (unlikely((ret_error= file->delete_table(norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(sub_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(sub_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
else else
...@@ -1044,7 +1044,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1044,7 +1044,7 @@ 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 (unlikely((ret_error= file->delete_table(norm_name_buff)))) if (unlikely((ret_error= file->delete_table(norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(part_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(part_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
else else
...@@ -1052,7 +1052,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1052,7 +1052,7 @@ int ha_partition::rename_partitions(const char *path)
} }
} }
} while (++i < temp_partitions); } while (++i < temp_partitions);
(void) sync_ddl_log(); (void) ddl_log_sync();
} }
i= 0; i= 0;
do do
...@@ -1105,10 +1105,10 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1105,10 +1105,10 @@ int ha_partition::rename_partitions(const char *path)
DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff)); DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff));
if (unlikely((ret_error= file->delete_table(norm_name_buff)))) if (unlikely((ret_error= file->delete_table(norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(sub_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(sub_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
(void) sync_ddl_log(); (void) ddl_log_sync();
} }
file= m_new_file[part]; file= m_new_file[part];
if (unlikely((ret_error= if (unlikely((ret_error=
...@@ -1123,7 +1123,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1123,7 +1123,7 @@ int ha_partition::rename_partitions(const char *path)
if (unlikely((ret_error= file->ha_rename_table(part_name_buff, if (unlikely((ret_error= file->ha_rename_table(part_name_buff,
norm_name_buff)))) norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(sub_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(sub_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
else else
...@@ -1152,10 +1152,10 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1152,10 +1152,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 (unlikely((ret_error= file->delete_table(norm_name_buff)))) if (unlikely((ret_error= file->delete_table(norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(part_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(part_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
(void) sync_ddl_log(); (void) ddl_log_sync();
} }
file= m_new_file[i]; file= m_new_file[i];
DBUG_PRINT("info", ("Rename partition from %s to %s", DBUG_PRINT("info", ("Rename partition from %s to %s",
...@@ -1163,7 +1163,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1163,7 +1163,7 @@ int ha_partition::rename_partitions(const char *path)
if (unlikely((ret_error= file->ha_rename_table(part_name_buff, if (unlikely((ret_error= file->ha_rename_table(part_name_buff,
norm_name_buff)))) norm_name_buff))))
error= ret_error; error= ret_error;
else if (unlikely(deactivate_ddl_log_entry(part_elem->log_entry-> else if (unlikely(ddl_log_increment_phase(part_elem->log_entry->
entry_pos))) entry_pos)))
error= 1; error= 1;
else else
...@@ -1172,7 +1172,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -1172,7 +1172,7 @@ int ha_partition::rename_partitions(const char *path)
} }
} }
} while (++i < num_parts); } while (++i < num_parts);
(void) sync_ddl_log(); (void) ddl_log_sync();
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "parse_file.h" // File_parser_dummy_hook #include "parse_file.h" // File_parser_dummy_hook
#include "sql_db.h" // my_dboptions_cache_free #include "sql_db.h" // my_dboptions_cache_free
// my_dboptions_cache_init // my_dboptions_cache_init
#include "sql_table.h" // release_ddl_log, execute_ddl_log_recovery #include "sql_table.h" // ddl_log_release, ddl_log_execute_recovery
#include "sql_connect.h" // free_max_user_conn, init_max_user_conn, #include "sql_connect.h" // free_max_user_conn, init_max_user_conn,
// handle_one_connection // handle_one_connection
#include "thread_cache.h" #include "thread_cache.h"
...@@ -1890,7 +1890,7 @@ static void clean_up(bool print_message) ...@@ -1890,7 +1890,7 @@ static void clean_up(bool print_message)
my_bitmap_free(&slave_error_mask); my_bitmap_free(&slave_error_mask);
#endif #endif
stop_handle_manager(); stop_handle_manager();
release_ddl_log(); ddl_log_release();
logger.cleanup_base(); logger.cleanup_base();
...@@ -5680,7 +5680,7 @@ int mysqld_main(int argc, char **argv) ...@@ -5680,7 +5680,7 @@ int mysqld_main(int argc, char **argv)
initialize_information_schema_acl(); initialize_information_schema_acl();
execute_ddl_log_recovery(); ddl_log_execute_recovery();
/* /*
Change EVENTS_ORIGINAL to EVENTS_OFF (the default value) as there is no Change EVENTS_ORIGINAL to EVENTS_OFF (the default value) as there is no
......
...@@ -6168,7 +6168,7 @@ static void release_part_info_log_entries(DDL_LOG_MEMORY_ENTRY *log_entry) ...@@ -6168,7 +6168,7 @@ static void release_part_info_log_entries(DDL_LOG_MEMORY_ENTRY *log_entry)
while (log_entry) while (log_entry)
{ {
release_ddl_log_memory_entry(log_entry); ddl_log_release_memory_entry(log_entry);
log_entry= log_entry->next_active_log_entry; log_entry= log_entry->next_active_log_entry;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -6212,7 +6212,7 @@ static bool write_log_replace_delete_frm(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6212,7 +6212,7 @@ static bool write_log_replace_delete_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
ddl_log_entry.name= to_path; ddl_log_entry.name= to_path;
if (replace_flag) if (replace_flag)
ddl_log_entry.from_name= from_path; ddl_log_entry.from_name= from_path;
if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6289,7 +6289,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6289,7 +6289,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION; ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
else else
ddl_log_entry.action_type= DDL_LOG_RENAME_ACTION; ddl_log_entry.action_type= DDL_LOG_RENAME_ACTION;
if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6316,7 +6316,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6316,7 +6316,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION; ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
else else
ddl_log_entry.action_type= DDL_LOG_RENAME_ACTION; ddl_log_entry.action_type= DDL_LOG_RENAME_ACTION;
if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6392,7 +6392,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6392,7 +6392,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
sub_elem->partition_name, name_variant)) sub_elem->partition_name, name_variant))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
ddl_log_entry.name= tmp_path; ddl_log_entry.name= tmp_path;
if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6411,7 +6411,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6411,7 +6411,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
TRUE)) TRUE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
ddl_log_entry.name= tmp_path; ddl_log_entry.name= tmp_path;
if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6473,7 +6473,7 @@ static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -6473,7 +6473,7 @@ static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
(const char*)shadow_path, FALSE)) (const char*)shadow_path, FALSE))
goto error; goto error;
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
if (write_execute_ddl_log_entry(log_entry->entry_pos, if (ddl_log_write_execute_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
goto error; goto error;
mysql_mutex_unlock(&LOCK_gdl); mysql_mutex_unlock(&LOCK_gdl);
...@@ -6520,7 +6520,7 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -6520,7 +6520,7 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
goto error; goto error;
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry; part_info->frm_log_entry= log_entry;
if (write_execute_ddl_log_entry(log_entry->entry_pos, if (ddl_log_write_execute_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
goto error; goto error;
release_part_info_log_entries(old_first_log_entry); release_part_info_log_entries(old_first_log_entry);
...@@ -6575,7 +6575,7 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -6575,7 +6575,7 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
goto error; goto error;
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry; part_info->frm_log_entry= log_entry;
if (write_execute_ddl_log_entry(log_entry->entry_pos, if (ddl_log_write_execute_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
goto error; goto error;
release_part_info_log_entries(old_first_log_entry); release_part_info_log_entries(old_first_log_entry);
...@@ -6634,7 +6634,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -6634,7 +6634,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
goto error; goto error;
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
if (write_execute_ddl_log_entry(log_entry->entry_pos, if (ddl_log_write_execute_entry(log_entry->entry_pos,
FALSE, FALSE,
/* Reuse the old execute ddl_log_entry */ /* Reuse the old execute ddl_log_entry */
&exec_log_entry)) &exec_log_entry))
...@@ -6704,7 +6704,7 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -6704,7 +6704,7 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
log_entry= part_info->first_log_entry; log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry; part_info->frm_log_entry= log_entry;
/* Overwrite the revert execute log entry with this retry execute entry */ /* Overwrite the revert execute log entry with this retry execute entry */
if (write_execute_ddl_log_entry(log_entry->entry_pos, if (ddl_log_write_execute_entry(log_entry->entry_pos,
FALSE, &exec_log_entry)) FALSE, &exec_log_entry))
goto error; goto error;
release_part_info_log_entries(old_first_log_entry); release_part_info_log_entries(old_first_log_entry);
...@@ -6741,7 +6741,7 @@ static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6741,7 +6741,7 @@ static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt,
DBUG_ASSERT(log_entry); DBUG_ASSERT(log_entry);
mysql_mutex_lock(&LOCK_gdl); mysql_mutex_lock(&LOCK_gdl);
if (write_execute_ddl_log_entry(0UL, TRUE, &log_entry)) if (ddl_log_write_execute_entry(0UL, TRUE, &log_entry))
{ {
/* /*
Failed to write, Bad... Failed to write, Bad...
...@@ -6891,7 +6891,7 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -6891,7 +6891,7 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
} }
if (part_info->first_log_entry && if (part_info->first_log_entry &&
execute_ddl_log_entry(thd, part_info->first_log_entry->entry_pos)) ddl_log_execute_entry(thd, part_info->first_log_entry->entry_pos))
{ {
/* /*
We couldn't recover from error, most likely manual interaction We couldn't recover from error, most likely manual interaction
......
...@@ -372,12 +372,12 @@ static bool exchange_name_with_ddl_log(THD *thd, ...@@ -372,12 +372,12 @@ static bool exchange_name_with_ddl_log(THD *thd,
*/ */
DBUG_EXECUTE_IF("exchange_partition_fail_1", goto err_no_action_written;); DBUG_EXECUTE_IF("exchange_partition_fail_1", goto err_no_action_written;);
DBUG_EXECUTE_IF("exchange_partition_abort_1", DBUG_SUICIDE();); DBUG_EXECUTE_IF("exchange_partition_abort_1", DBUG_SUICIDE(););
if (unlikely(write_ddl_log_entry(&exchange_entry, &log_entry))) if (unlikely(ddl_log_write_entry(&exchange_entry, &log_entry)))
goto err_no_action_written; goto err_no_action_written;
DBUG_EXECUTE_IF("exchange_partition_fail_2", goto err_no_execute_written;); DBUG_EXECUTE_IF("exchange_partition_fail_2", goto err_no_execute_written;);
DBUG_EXECUTE_IF("exchange_partition_abort_2", DBUG_SUICIDE();); DBUG_EXECUTE_IF("exchange_partition_abort_2", DBUG_SUICIDE(););
if (unlikely(write_execute_ddl_log_entry(log_entry->entry_pos, FALSE, if (unlikely(ddl_log_write_execute_entry(log_entry->entry_pos, FALSE,
&exec_log_entry))) &exec_log_entry)))
goto err_no_execute_written; goto err_no_execute_written;
/* ddl_log is written and synced */ /* ddl_log is written and synced */
...@@ -404,7 +404,7 @@ static bool exchange_name_with_ddl_log(THD *thd, ...@@ -404,7 +404,7 @@ static bool exchange_name_with_ddl_log(THD *thd,
} }
DBUG_EXECUTE_IF("exchange_partition_fail_4", goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_fail_4", goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_4", DBUG_SUICIDE();); DBUG_EXECUTE_IF("exchange_partition_abort_4", DBUG_SUICIDE(););
if (unlikely(deactivate_ddl_log_entry(log_entry->entry_pos))) if (unlikely(ddl_log_increment_phase(log_entry->entry_pos)))
goto err_rename; goto err_rename;
/* call rename table from partition to table */ /* call rename table from partition to table */
...@@ -421,7 +421,7 @@ static bool exchange_name_with_ddl_log(THD *thd, ...@@ -421,7 +421,7 @@ static bool exchange_name_with_ddl_log(THD *thd,
} }
DBUG_EXECUTE_IF("exchange_partition_fail_6", goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_fail_6", goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_6", DBUG_SUICIDE();); DBUG_EXECUTE_IF("exchange_partition_abort_6", DBUG_SUICIDE(););
if (unlikely(deactivate_ddl_log_entry(log_entry->entry_pos))) if (unlikely(ddl_log_increment_phase(log_entry->entry_pos)))
goto err_rename; goto err_rename;
/* call rename table from tmp-nam to partition */ /* call rename table from tmp-nam to partition */
...@@ -438,7 +438,7 @@ static bool exchange_name_with_ddl_log(THD *thd, ...@@ -438,7 +438,7 @@ static bool exchange_name_with_ddl_log(THD *thd,
} }
DBUG_EXECUTE_IF("exchange_partition_fail_8", goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_fail_8", goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_8", DBUG_SUICIDE();); DBUG_EXECUTE_IF("exchange_partition_abort_8", DBUG_SUICIDE(););
if (unlikely(deactivate_ddl_log_entry(log_entry->entry_pos))) if (unlikely(ddl_log_increment_phase(log_entry->entry_pos)))
goto err_rename; goto err_rename;
/* The exchange is complete and ddl_log is deactivated */ /* The exchange is complete and ddl_log is deactivated */
...@@ -454,15 +454,15 @@ static bool exchange_name_with_ddl_log(THD *thd, ...@@ -454,15 +454,15 @@ static bool exchange_name_with_ddl_log(THD *thd,
will log to the error log about the failures... will log to the error log about the failures...
*/ */
/* execute the ddl log entry to revert the renames */ /* execute the ddl log entry to revert the renames */
(void) execute_ddl_log_entry(current_thd, log_entry->entry_pos); (void) ddl_log_execute_entry(current_thd, log_entry->entry_pos);
mysql_mutex_lock(&LOCK_gdl); mysql_mutex_lock(&LOCK_gdl);
/* mark the execute log entry done */ /* mark the execute log entry done */
(void) write_execute_ddl_log_entry(0, TRUE, &exec_log_entry); (void) ddl_log_write_execute_entry(0, TRUE, &exec_log_entry);
/* release the execute log entry */ /* release the execute log entry */
(void) release_ddl_log_memory_entry(exec_log_entry); (void) ddl_log_release_memory_entry(exec_log_entry);
err_no_execute_written: err_no_execute_written:
/* release the action log entry */ /* release the action log entry */
(void) release_ddl_log_memory_entry(log_entry); (void) ddl_log_release_memory_entry(log_entry);
err_no_action_written: err_no_action_written:
mysql_mutex_unlock(&LOCK_gdl); mysql_mutex_unlock(&LOCK_gdl);
delete file; delete file;
......
...@@ -768,8 +768,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -768,8 +768,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
lpt->table->file->ha_create_partitioning_metadata(path, shadow_path, lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
CHF_DELETE_FLAG) || CHF_DELETE_FLAG) ||
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos) || ddl_log_increment_phase(part_info->frm_log_entry->entry_pos) ||
(sync_ddl_log(), FALSE) || (ddl_log_sync(), FALSE) ||
mysql_file_rename(key_file_frm, mysql_file_rename(key_file_frm,
shadow_frm_name, frm_name, MYF(MY_WME)) || shadow_frm_name, frm_name, MYF(MY_WME)) ||
lpt->table->file->ha_create_partitioning_metadata(path, shadow_path, lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
...@@ -816,9 +816,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -816,9 +816,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
err: err:
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos); ddl_log_increment_phase(part_info->frm_log_entry->entry_pos);
part_info->frm_log_entry= NULL; part_info->frm_log_entry= NULL;
(void) sync_ddl_log(); (void) ddl_log_sync();
#endif #endif
; ;
} }
......
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