MySQL 8.4.3
Source Code Documentation
|
Atomic rename of table; RENAME TABLE t1 to t2, tmp to t1 [,...]. More...
#include "sql/sql_rename.h"
#include <string.h>
#include <set>
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_murmur3.h"
#include "my_sys.h"
#include "mysql/components/services/log_shared.h"
#include "mysqld_error.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/properties.h"
#include "sql/dd/types/abstract_table.h"
#include "sql/dd/types/table.h"
#include "sql/dd_sql_view.h"
#include "sql/derror.h"
#include "sql/handler.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/sp_cache.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_handler.h"
#include "sql/sql_table.h"
#include "sql/sql_trigger.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "sql/transaction.h"
Classes | |
struct | anonymous_namespace{sql_rename.cc}::table_list_hash |
struct | anonymous_namespace{sql_rename.cc}::table_list_equal |
Namespaces | |
namespace | dd |
The version of the current data dictionary table definitions. | |
namespace | anonymous_namespace{sql_rename.cc} |
Typedefs | |
typedef std::set< handlerton * > | post_ddl_htons_t |
Functions | |
static Table_ref * | rename_tables (THD *thd, Table_ref *table_list, bool *int_commit_done, post_ddl_htons_t *post_ddl_htons, Foreign_key_parents_invalidator *fk_invalidator) |
Rename all tables/views in the list. More... | |
static Table_ref * | reverse_table_list (Table_ref *table_list) |
static bool | check_if_owns_upgradable_mdl (THD *thd, const char *db, const char *table_name) |
Check if connection owns SNRW metadata lock on table or view. More... | |
static void | find_and_set_explicit_duration_for_schema_mdl (THD *thd, Table_ref *table, Prealloced_array< MDL_request *, 1 > *schema_reqs) |
Find metadata lock request for table's schema in the set of schema requests and set duration of corresponding lock to explicit. More... | |
bool | mysql_rename_tables (THD *thd, Table_ref *table_list) |
Rename tables from the list. More... | |
static bool | do_rename (THD *thd, Table_ref *ren_table, const char *new_db, const char *new_table_name, const char *new_table_alias, bool *int_commit_done, std::set< handlerton * > *post_ddl_htons, Foreign_key_parents_invalidator *fk_invalidator) |
Rename a single table or a view. More... | |
Atomic rename of table; RENAME TABLE t1 to t2, tmp to t1 [,...].
typedef std::set<handlerton *> post_ddl_htons_t |
|
static |
Check if connection owns SNRW metadata lock on table or view.
Report appropriate error if not.
|
static |
Rename a single table or a view.
[in] | thd | Thread handle. |
[in] | ren_table | A table/view to be renamed. |
[in] | new_db | The database to which the table to be moved to. |
[in] | new_table_name | The new table/view name. |
[in] | new_table_alias | The new table/view alias. |
[in,out] | int_commit_done | Whether intermediate commits were done. |
[in,out] | post_ddl_htons | Set of SEs supporting atomic DDL for which post-DDL hooks needs to be called. |
[in,out] | fk_invalidator | Object keeping track of which dd::Table objects to invalidate. |
|
static |
Find metadata lock request for table's schema in the set of schema requests and set duration of corresponding lock to explicit.
Rename tables from the list.
thd | Thread context. |
table_list | Every two entries in the table_list form a pair of original name and the new name. |
|
static |
Rename all tables/views in the list.
[in] | thd | Thread handle. |
[in] | table_list | List of tables to rename. |
[in,out] | int_commit_done | Whether intermediate commits were done. |
[in,out] | post_ddl_htons | Set of SEs supporting atomic DDL for which post-DDL hooks needs to be called. |
[in,out] | fk_invalidator | Object keeping track of which dd::Table objects to invalidate. |