MySQL 8.0.31
Source Code Documentation
dd::anonymous_namespace{dd.cc} Namespace Reference

Functions

bool create_temporary_schemas (THD *thd, Object_id *mysql_schema_id, Object_id *target_table_schema_id, String_type *target_table_schema_name, Object_id *actual_table_schema_id)
 
void establish_table_name_sets (std::set< String_type > *create_set, std::set< String_type > *remove_set)
 
bool update_meta_data (THD *thd)
 Adjust metadata in source DD tables in mysql schema. More...
 
bool migrate_meta_data (THD *thd, const std::set< String_type > &create_set, const std::set< String_type > &remove_set)
 Copy meta data from the actual tables to the target tables. More...
 
bool update_object_ids (THD *thd, const std::set< String_type > &create_set, const std::set< String_type > &remove_set, Object_id mysql_schema_id, Object_id target_table_schema_id, const String_type &target_table_schema_name, Object_id actual_table_schema_id)
 

Function Documentation

◆ create_temporary_schemas()

bool dd::anonymous_namespace{dd.cc}::create_temporary_schemas ( THD thd,
Object_id mysql_schema_id,
Object_id target_table_schema_id,
String_type target_table_schema_name,
Object_id actual_table_schema_id 
)

◆ establish_table_name_sets()

void dd::anonymous_namespace{dd.cc}::establish_table_name_sets ( std::set< String_type > *  create_set,
std::set< String_type > *  remove_set 
)

◆ migrate_meta_data()

bool dd::anonymous_namespace{dd.cc}::migrate_meta_data ( THD thd,
const std::set< String_type > &  create_set,
const std::set< String_type > &  remove_set 
)

Copy meta data from the actual tables to the target tables.

The default is to copy all data. This is sufficient if we e.g. add a new index in the new DD version. If there are changes to the table columns, e.g. if we add or remove a column, we must add code to handle each case specifically. Suppose e.g. we add a new column to allow defining a default tablespace for each schema, and store the tablespace id in that column. Then, we could migrate the meta data for 'schemata' and set a default value for all existing schemas:

... migrated_set.insert("schemata"); if (dd::execute_query(thd, "INSERT INTO schemata " "SELECT id, catalog_id, name, default_collation_id, 1, " " created, last_altered, options FROM mysql.schemata")) ...

The code block above would go into the 'Version dependent migration' part of the function below.

Parameters
thdThread context.
create_setSet of new or modified tables to be created.
remove_setSet of abandoned or modified tables to be removed.
Returns
false if success. otherwise true.

◆ update_meta_data()

bool dd::anonymous_namespace{dd.cc}::update_meta_data ( THD thd)

Adjust metadata in source DD tables in mysql schema.

This is done by mostly executing UPDATE queries on them, but we do not migrate data to destination DD tables.

Parameters
thdThread context.
Returns
false if success. otherwise true.

◆ update_object_ids()

bool dd::anonymous_namespace{dd.cc}::update_object_ids ( THD thd,
const std::set< String_type > &  create_set,
const std::set< String_type > &  remove_set,
Object_id  mysql_schema_id,
Object_id  target_table_schema_id,
const String_type target_table_schema_name,
Object_id  actual_table_schema_id 
)