summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-08-31 11:55:03 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-08-31 11:55:03 +0300
commit595dad83ad3c23879c59deec1173ea16b47871ed (patch)
treec0d29b05c5a17df4f2dd13c463c7b74206248898
parentf02af1d2295f108d96671b5a4f731ec998002dd5 (diff)
downloadmariadb-git-595dad83ad3c23879c59deec1173ea16b47871ed.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.cc4
-rw-r--r--sql/ddl_log.h6
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/log_event.h4
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_partition.cc10
-rw-r--r--sql/sql_partition_admin.cc2
-rw-r--r--sql/sql_rename.cc49
-rw-r--r--sql/sql_table.cc2
9 files changed, 39 insertions, 44 deletions
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc
index 2ac4e256112..80f2e4d2e3e 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;
@@ -3532,7 +3532,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 9960855a813..a74d2f1e492 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 47fa92a0d2f..9835d42c8c5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -8618,8 +8618,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 6a2f57f60e6..81b6f6f3fa3 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -680,9 +680,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 a9f6f26173d..65a417e2afc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2911,7 +2911,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 77f46187bbc..3eb78b2439b 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6694,7 +6694,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);
@@ -6749,7 +6749,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);
@@ -6781,7 +6781,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);
@@ -6836,7 +6836,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);
@@ -6903,7 +6903,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 66f43116211..84220898662 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -382,7 +382,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 094578874a8..1ba92b5033d 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -208,10 +208,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;
@@ -228,7 +228,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
@@ -240,8 +240,6 @@ struct rename_param
/**
- check_rename()
-
Check pre-conditions for rename
- From table should exists
- To table should not exists.
@@ -258,14 +256,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));
@@ -316,7 +314,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
@@ -334,15 +331,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= &param->old_alias;
@@ -515,24 +513,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, &param, ren_table, &new_table->db,
- &new_table->table_name,
- &new_table->alias, (skip_error || if_exists));
+ error= rename_check_preconditions(thd, &param, 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, &param, ddl_log_state,
- ren_table, &new_table->db,
- skip_error, force_if_exists))
+ if (rename_table_and_triggers(thd, &param, ddl_log_state,
+ ren_table, &new_table->db,
+ skip_error, force_if_exists))
goto revert_rename;
}
}
@@ -542,7 +541,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 7cbc5fbada0..d42ef7fedae 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -869,7 +869,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);