diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2023-01-18 16:52:06 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2023-01-26 17:15:20 +0300 |
commit | b943ae6f856ec9b2ee00c28927b4cc6639faeb28 (patch) | |
tree | beba93d0de489f3582880043c6634b5e8e080d10 | |
parent | 8d66abd3fdcacff10234dac98244730ad25f1fdc (diff) | |
download | mariadb-git-b943ae6f856ec9b2ee00c28927b4cc6639faeb28.tar.gz |
MDEV-25292 Cleanups
ddl_log_write_execute_entry() cleanup
Rename functions renamed:
do_rename() -> rename_table_and_triggers()
do_rename_temporary() -> rename_temporary_table()
check_rename() -> rename_check_preconditions()
-rw-r--r-- | sql/ddl_log.cc | 4 | ||||
-rw-r--r-- | sql/ddl_log.h | 6 | ||||
-rw-r--r-- | sql/handler.cc | 4 | ||||
-rw-r--r-- | sql/log_event.h | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 10 | ||||
-rw-r--r-- | sql/sql_partition_admin.cc | 2 | ||||
-rw-r--r-- | sql/sql_rename.cc | 49 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
9 files changed, 39 insertions, 44 deletions
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index 67c8a8bca4f..35a3f54e61f 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -2761,7 +2761,7 @@ int ddl_log_execute_recovery() if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE) { /* - Remeber information about executive ddl log entry, + Remember information about executive ddl log entry, used for binary logging during recovery */ recovery_state.execute_entry_pos= i; @@ -3531,7 +3531,7 @@ bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_state, ddl_log_entry.extra_name.length= 0; max_query_length= ddl_log_free_space_in_entry(&ddl_log_entry); } - if (ddl_log_write_execute_entry(first_entry->entry_pos, + if (ddl_log_write_execute_entry(first_entry->entry_pos, 0, &ddl_state->execute_entry)) goto err; diff --git a/sql/ddl_log.h b/sql/ddl_log.h index 88f6695fc72..87b7af57102 100644 --- a/sql/ddl_log.h +++ b/sql/ddl_log.h @@ -264,12 +264,6 @@ bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry, bool ddl_log_write_execute_entry(uint first_entry, uint cond_entry, DDL_LOG_MEMORY_ENTRY** active_entry); -inline -bool ddl_log_write_execute_entry(uint first_entry, - DDL_LOG_MEMORY_ENTRY **active_entry) -{ - return ddl_log_write_execute_entry(first_entry, 0, active_entry); -} bool ddl_log_disable_execute_entry(DDL_LOG_MEMORY_ENTRY **active_entry); void ddl_log_complete(DDL_LOG_STATE *ddl_log_state); diff --git a/sql/handler.cc b/sql/handler.cc index 591dfda931e..f331c6d02ce 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -8640,8 +8640,8 @@ bool Table_scope_and_contents_source_st::check_fields( THD *thd, Alter_info *alter_info, const Lex_table_name &table_name, const Lex_table_name &db) { - return vers_check_system_fields(thd, alter_info, table_name, db) || - check_period_fields(thd, alter_info); + return (vers_check_system_fields(thd, alter_info, table_name, db) || + check_period_fields(thd, alter_info)); } bool Table_scope_and_contents_source_st::check_period_fields( diff --git a/sql/log_event.h b/sql/log_event.h index 4976fcaaa17..5267227b373 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -681,9 +681,11 @@ enum Log_event_type /* New MySQL/Sun events are to be added right above this comment */ MYSQL_EVENTS_END, - MARIA_EVENTS_BEGIN= 160, /* New Maria event numbers start from here */ ANNOTATE_ROWS_EVENT= 160, + /* Keep that here for GDB to display ANNOTATE_ROWS_EVENT */ + MARIA_EVENTS_BEGIN= 160, + /* Binlog checkpoint event. Used for XA crash recovery on the master, not used in replication. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d85de205836..a65ebca5b10 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2915,7 +2915,7 @@ struct Item_change_record: public ilink /* - Register an item tree tree transformation, performed by the query + Register an item tree transformation, performed by the query optimizer. We need a pointer to runtime_memroot because it may be != thd->mem_root (due to possible set_n_backup_active_arena called for thd). */ diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index ba9a370a068..baaf2aaa6ae 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6743,7 +6743,7 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt) goto error; log_entry= part_info->list; part_info->main_entry= log_entry; - if (ddl_log_write_execute_entry(log_entry->entry_pos, + if (ddl_log_write_execute_entry(log_entry->entry_pos, 0, &exec_log_entry)) goto error; release_part_info_log_entries(old_first_log_entry); @@ -6798,7 +6798,7 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) goto error; log_entry= part_info->list; part_info->main_entry= log_entry; - if (ddl_log_write_execute_entry(log_entry->entry_pos, + if (ddl_log_write_execute_entry(log_entry->entry_pos, 0, &exec_log_entry)) goto error; release_part_info_log_entries(old_first_log_entry); @@ -6830,7 +6830,7 @@ static bool write_log_convert_partition(ALTER_PARTITION_PARAM_TYPE *lpt) if (write_log_convert_partition(lpt, &next_entry, (const char*)path)) goto error; DBUG_ASSERT(next_entry == part_info->list->entry_pos); - if (ddl_log_write_execute_entry(part_info->list->entry_pos, + if (ddl_log_write_execute_entry(part_info->list->entry_pos, 0, &part_info->execute_entry)) goto error; mysql_mutex_unlock(&LOCK_gdl); @@ -6885,7 +6885,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) goto error; log_entry= part_info->list; - if (ddl_log_write_execute_entry(log_entry->entry_pos, + if (ddl_log_write_execute_entry(log_entry->entry_pos, 0, &part_info->execute_entry)) goto error; mysql_mutex_unlock(&LOCK_gdl); @@ -6952,7 +6952,7 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) log_entry= part_info->list; part_info->main_entry= log_entry; /* Overwrite the revert execute log entry with this retry execute entry */ - if (ddl_log_write_execute_entry(log_entry->entry_pos, + if (ddl_log_write_execute_entry(log_entry->entry_pos, 0, &exec_log_entry)) goto error; release_part_info_log_entries(old_first_log_entry); diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index d290d0f5534..e0d40337d93 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -383,7 +383,7 @@ static bool exchange_name_with_ddl_log(THD *thd, DBUG_EXECUTE_IF("exchange_partition_fail_2", goto err_no_execute_written;); DBUG_EXECUTE_IF("exchange_partition_abort_2", DBUG_SUICIDE();); - if (unlikely(ddl_log_write_execute_entry(log_entry->entry_pos, + if (unlikely(ddl_log_write_execute_entry(log_entry->entry_pos, 0, &exec_log_entry))) goto err_no_execute_written; /* ddl_log is written and synced */ diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 1137e0e1b09..33c8a77ae46 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -209,10 +209,10 @@ err: static bool -do_rename_temporary(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table) +rename_temporary_table(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table) { LEX_CSTRING *new_alias; - DBUG_ENTER("do_rename_temporary"); + DBUG_ENTER("rename_temporary_table"); new_alias= (lower_case_table_names == 2) ? &new_table->alias : &new_table->table_name; @@ -229,7 +229,7 @@ do_rename_temporary(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table) /** - Parameters for do_rename + Parameters for rename_table_and_triggers() */ struct rename_param @@ -241,8 +241,6 @@ struct rename_param /** - check_rename() - Check pre-conditions for rename - From table should exists - To table should not exists. @@ -259,14 +257,14 @@ struct rename_param */ static int -check_rename(THD *thd, rename_param *param, - TABLE_LIST *ren_table, - const LEX_CSTRING *new_db, - const LEX_CSTRING *new_table_name, - const LEX_CSTRING *new_table_alias, - bool if_exists) +rename_check_preconditions(THD *thd, rename_param *param, + TABLE_LIST *ren_table, + const LEX_CSTRING *new_db, + const LEX_CSTRING *new_table_name, + const LEX_CSTRING *new_table_alias, + bool if_exists) { - DBUG_ENTER("check_rename"); + DBUG_ENTER("rename_check_preconditions"); DBUG_PRINT("enter", ("if_exists: %d", (int) if_exists)); @@ -317,7 +315,6 @@ check_rename(THD *thd, rename_param *param, Rename a single table or a view SYNPOSIS - do_rename() thd Thread handle ren_table A table/view to be renamed new_db The database to which the table to be moved to @@ -335,15 +332,16 @@ check_rename(THD *thd, rename_param *param, */ static bool -do_rename(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state, - TABLE_LIST *ren_table, const LEX_CSTRING *new_db, - bool skip_error, bool *force_if_exists) +rename_table_and_triggers(THD *thd, rename_param *param, + DDL_LOG_STATE *ddl_log_state, + TABLE_LIST *ren_table, const LEX_CSTRING *new_db, + bool skip_error, bool *force_if_exists) { int rc= 1; handlerton *hton; LEX_CSTRING *old_alias, *new_alias; TRIGGER_RENAME_PARAM rename_param; - DBUG_ENTER("do_rename"); + DBUG_ENTER("rename_table_and_triggers"); DBUG_PRINT("enter", ("skip_error: %d", (int) skip_error)); old_alias= ¶m->old_alias; @@ -516,24 +514,25 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state, pair->from= ren_table; pair->to= new_table; - if (do_rename_temporary(thd, ren_table, new_table)) + if (rename_temporary_table(thd, ren_table, new_table)) goto revert_rename; } else { int error; rename_param param; - error= check_rename(thd, ¶m, ren_table, &new_table->db, - &new_table->table_name, - &new_table->alias, (skip_error || if_exists)); + error= rename_check_preconditions(thd, ¶m, ren_table, + &new_table->db, &new_table->table_name, + &new_table->alias, + (skip_error || if_exists)); if (error < 0) continue; // Ignore rename (if exists) if (error > 0) goto revert_rename; - if (do_rename(thd, ¶m, ddl_log_state, - ren_table, &new_table->db, - skip_error, force_if_exists)) + if (rename_table_and_triggers(thd, ¶m, ddl_log_state, + ren_table, &new_table->db, + skip_error, force_if_exists)) goto revert_rename; } } @@ -543,7 +542,7 @@ revert_rename: /* Revert temporary tables. Normal tables are reverted in the caller */ List_iterator_fast<TABLE_PAIR> it(tmp_tables); while (TABLE_PAIR *pair= it++) - do_rename_temporary(thd, pair->to, pair->from); + rename_temporary_table(thd, pair->to, pair->from); DBUG_RETURN(1); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3d294879aa3..03c7a49d314 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -870,7 +870,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) if (write_log_replace_frm(lpt, part_info->list->entry_pos, (const char*) bak_path, (const char*) path) || - ddl_log_write_execute_entry(part_info->list->entry_pos, + ddl_log_write_execute_entry(part_info->list->entry_pos, 0, &part_info->execute_entry)) { mysql_mutex_unlock(&LOCK_gdl); |