MySQL 8.0.40
Source Code Documentation
|
Classes | |
class | Check_table_intact |
Class to check the system tables we are using from 5.7 are not corrupted before migrating the information to new DD. More... | |
class | Handle_old_incorrect_sql_modes_hook |
class | System_table_close_guard |
RAII for handling open and close of event and proc tables. More... | |
class | Table_upgrade_guard |
RAII to handle cleanup after table upgrading. More... | |
class | Thd_mem_root_guard |
THD::mem_root is only switched with the given mem_root and switched back on destruction. More... | |
struct | Trg_file_data |
Structure representing contents of .TRG file. More... | |
class | Trigger_loader |
Class to handle loading and parsing of Triggers. More... | |
class | Upgrade_MDL_guard |
RAII to handle MDL locks while upgrading. More... | |
class | Upgrade_status |
Class to manage a temporary file to maintain the progress of the upgrade. More... | |
Functions | |
static void | load_event_creation_context (THD *thd, TABLE *table, Event_parse_data *et_parse_data) |
Load the charset and time zone information for an event. More... | |
static bool | update_event_timing_fields (THD *thd, TABLE *table, const char *event_db_name, const char *event_name) |
Update the created, last modified and last executed time for the event with the values read from the old data dir. More... | |
static int | find_string_in_array (const LEX_CSTRING *haystack, const LEX_CSTRING *needle, const CHARSET_INFO *cs) |
Searches for a LEX_STRING in an LEX_STRING array. More... | |
static bool | set_status_and_interval_for_event (THD *thd, TABLE *table, Event_parse_data *et_parse_data) |
Update the event's interval and status information in the DD. More... | |
static bool | migrate_event_to_dd (THD *thd, TABLE *event_table) |
Create an entry in the DD for the event by reading all the event attributes stored in 'mysql.event' table. More... | |
bool | migrate_events_to_dd (THD *thd) |
Migrate all the events from 'mysql.event' to 'events' DD table. More... | |
static bool | set_st_sp_chistics (THD *thd, TABLE *proc_table, st_sp_chistics *chistics) |
Set st_sp_chistics for routines. More... | |
static bool | migrate_routine_to_dd (THD *thd, TABLE *proc_table) |
This function migrate one SP/SF from mysql.proc to routines DD table. More... | |
bool | migrate_routines_to_dd (THD *thd) |
Migrate Stored Procedure and Functions from mysql.proc to routines dd table. More... | |
static bool | load_db_schema_collation (THD *thd, const LEX_STRING *db_opt_path, const CHARSET_INFO **schema_charset) |
Returns the collation id for the database specified. More... | |
bool | migrate_schema_to_dd (THD *thd, const char *dbname) |
Update the Schemata:DD for every database present in the data directory. More... | |
bool | find_schema_from_datadir (std::vector< String_type > *db_name) |
Scans datadir for databases and lists all the database names. More... | |
static bool | is_equal (const LEX_CSTRING &a, const LEX_CSTRING &b) |
static void | fill_create_info_for_upgrade (HA_CREATE_INFO *create_info, const TABLE *table) |
Fill HA_CREATE_INFO from TABLE_SHARE. More... | |
static bool | create_unlinked_view (THD *thd, Table_ref *view_ref) |
Create the view in DD without its column and dependency information. More... | |
static void | create_alter_view_stmt (const THD *thd, Table_ref *view_ref, String *str, const String_type &db_name, const String_type &view_name, const CHARSET_INFO *cs) |
Construct ALTER VIEW statement to fix the column list and dependency information but retains the previous view definition entry in DD. More... | |
static bool | fix_view_cols_and_deps (THD *thd, Table_ref *view_ref, const String_type &db_name, const String_type &view_name) |
Finalize upgrading view by fixing column data, table and routines dependency. More... | |
static bool | migrate_view_to_dd (THD *thd, const FRM_context &frm_context, const String_type &db_name, const String_type &view_name, MEM_ROOT *mem_root, bool is_fix_view_cols_and_deps) |
Create an entry in the DD for the view. More... | |
static bool | fill_partition_info_for_upgrade (THD *thd, TABLE_SHARE *share, const FRM_context *frm_context, TABLE *table) |
Create partition information for upgrade. More... | |
static bool | invalid_triggers (Table_trigger_dispatcher *d, List<::Trigger > &triggers) |
static bool | add_triggers_to_table (THD *thd, TABLE *table, const String_type &schema_name, const String_type &table_name) |
Add triggers to table. More... | |
static bool | fix_generated_columns_for_upgrade (THD *thd, TABLE *table, List< Create_field > &create_fields) |
Fix generated columns. More... | |
static bool | set_se_data_for_user_tables (THD *thd, const String_type &schema_name, const String_type &table_name, TABLE *table, bool skip_error) |
Call handler API to get storate engine specific metadata. More... | |
static bool | fix_fk_parent_key_names (THD *thd, const String_type &schema_name, const String_type &table_name, handlerton *hton) |
Set names of parent keys (unique constraint names matching FK in parent tables) for the FKs in which table participates. More... | |
static bool | migrate_table_to_dd (THD *thd, const String_type &schema_name, const String_type &table_name, bool is_fix_view_cols_and_deps) |
Read .frm files and enter metadata for tables/views. More... | |
bool | migrate_plugin_table_to_dd (THD *thd) |
Upgrade mysql.plugin table. More... | |
static bool | is_skipped_ndb_table (const char *db_name, const char *table_name) |
Migration of NDB tables is deferred until later, except for: More... | |
bool | migrate_all_frm_to_dd (THD *thd, const char *dbname, bool is_fix_view_cols_and_deps) |
Scan the database to identify all .frm files. More... | |
bool | in_progress () |
Check if upgrade is in progress. More... | |
void | set_in_progress (bool param) |
bool | allow_sdi_creation () |
Check if creation of SDI file is allowed by upgrade. More... | |
void | set_allow_sdi_creation (bool param) |
static bool | check_file_extension (const String_type &extn) |
Check if it is a file extension which should be moved to backup_metadata_57 folder upgrade upgrade is successful. More... | |
static void | rename_stats_tables () |
Rename stats tables. More... | |
static bool | ha_finish_upgrade (THD *thd, plugin_ref plugin, void *failed_upgrade) |
Cleanup inside SE after upgrade for one SE. More... | |
bool | ha_finish_upgrade (THD *thd, bool failed_upgrade) |
bool | finalize_upgrade (THD *thd) |
In case of successful upgrade, this function deletes all .frm, .TRG, .TRG, .par, .opt, .isl files from all databases. More... | |
bool | check_for_dd_tables () |
Function to scan mysql schema to check if any tables exist with the same name as DD tables to be created. More... | |
void | rename_back_stats_tables (THD *thd) |
Rename back .ibd files for innodb stats table. More... | |
static void | drop_sdi_files () |
Drop all .SDI files created during upgrade. More... | |
bool | add_sdi_info (THD *thd) |
Create SDI information for all tablespaces and tables. More... | |
bool | terminate (THD *thd) |
Drop all DD tables in case there is an error while upgrading server. More... | |
static bool | ha_migrate_tablespaces (THD *thd, plugin_ref plugin, void *) |
create data dictionary entry for tablespaces for one SE. More... | |
static bool | ha_migrate_tablespaces (THD *thd) |
create data dictionary entry for tablespaces for one SE. More... | |
static bool | migrate_stats (THD *thd) |
Migrate statistics from 5.7 stats tables. More... | |
static bool | restart_dictionary (THD *thd) |
static bool | upgrade_logs (THD *thd, plugin_ref plugin, void *) |
Upgrade logs inside one SE. More... | |
static bool | ha_upgrade_engine_logs (THD *thd) |
Upgrade logs inside all SE. More... | |
bool | do_pre_checks_and_initialize_dd (THD *thd) |
Check if the server is starting on a data directory without dictionary tables or not. More... | |
bool | fill_dd_and_finalize (THD *thd) |
Finalize upgrade to the new data-dictionary by populating Data Dictionary tables with metadata. More... | |
bool dd::upgrade_57::add_sdi_info | ( | THD * | thd | ) |
Create SDI information for all tablespaces and tables.
[in] | thd | Thread handle. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Add triggers to table.
bool dd::upgrade_57::allow_sdi_creation | ( | ) |
Check if creation of SDI file is allowed by upgrade.
|
static |
Check if it is a file extension which should be moved to backup_metadata_57 folder upgrade upgrade is successful.
bool dd::upgrade_57::check_for_dd_tables | ( | ) |
Function to scan mysql schema to check if any tables exist with the same name as DD tables to be created.
This function checks existence of .frm files in mysql schema.
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Construct ALTER VIEW statement to fix the column list and dependency information but retains the previous view definition entry in DD.
[in] | thd | Thread handle. |
[in] | view_ref | Table_ref to store view data. |
[out] | str | String object to store view definition. |
[in] | db_name | database name. |
[in] | view_name | view name. |
[in] | cs | Charset Information. |
Create the view in DD without its column and dependency information.
[in] | thd | Thread handle. |
[in] | view_ref | Table_ref to store view data. |
false | ON SUCCESS |
true | ON FAILURE |
bool dd::upgrade_57::do_pre_checks_and_initialize_dd | ( | THD * | thd | ) |
Check if the server is starting on a data directory without dictionary tables or not.
If the dictionary tables are present, continue with restart of the server.
If the dictionary tables are not present, create the dictionary tables in existing data directory. This function marks dd_upgrade_flag as true to indicate to the server that Data dictionary is being upgraded.
metadata mysql.plugin table is migrated to the DD tables in case of upgrade. mysql.plugin table is used to initialize all other Storage Engines. This is necessary before migrating other user tables.
thd | Thread context. |
|
static |
Drop all .SDI files created during upgrade.
|
static |
Fill HA_CREATE_INFO from TABLE_SHARE.
bool dd::upgrade_57::fill_dd_and_finalize | ( | THD * | thd | ) |
Finalize upgrade to the new data-dictionary by populating Data Dictionary tables with metadata.
Populate metadata in Data dictionary tables. This will be done for following database objects:
thd | Thread context. |
|
static |
Create partition information for upgrade.
This function uses the same method to create partition information as done by open_table_from_share().
bool dd::upgrade_57::finalize_upgrade | ( | THD * | thd | ) |
In case of successful upgrade, this function deletes all .frm, .TRG, .TRG, .par, .opt, .isl files from all databases.
mysql.proc, mysql.event, statistics tables from 5.7 will be deleted as part of cleanup.
[in] | thd | Thread handle. |
bool dd::upgrade_57::find_schema_from_datadir | ( | std::vector< String_type > * | db_name | ) |
Scans datadir for databases and lists all the database names.
Find all the directories inside data directory.
Every directory will be treated as a schema. These directories are in filename-encoded form.
[out] | db_name | An std::vector containing all database name. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Searches for a LEX_STRING in an LEX_STRING array.
[in] | haystack | The array. |
[in] | needle | The string to search for. |
[in] | cs | Charset info. |
-1 | Not found. |
>=0 | Ordinal position. |
|
static |
Set names of parent keys (unique constraint names matching FK in parent tables) for the FKs in which table participates.
thd | Thread context. |
schema_name | Name of schema. |
table_name | Name of table. |
hton | Table's handlerton. |
false | - Success. |
true | - Failure. |
|
static |
Fix generated columns.
[in] | thd | Thread handle. |
[in] | table | TABLE object. |
[in] | create_fields | List of Create_fields |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Finalize upgrading view by fixing column data, table and routines dependency.
View will be marked invalid if ALTER VIEW statement fails on the view.
[in] | thd | Thread handle. |
[in] | view_ref | Table_ref with view data. |
[in] | db_name | database name. |
[in] | view_name | view name. |
false | ON SUCCESS |
true | ON FAILURE |
bool dd::upgrade_57::ha_finish_upgrade | ( | THD * | thd, |
bool | failed_upgrade | ||
) |
|
static |
Cleanup inside SE after upgrade for one SE.
[in] | thd | Thread Handle |
[in] | plugin | Handlerton Plugin |
[in] | failed_upgrade | Flag to tell SE if cleanup is after failed failed upgrade or successful upgrade. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
create data dictionary entry for tablespaces for one SE.
[in] | thd | Thread Handle |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
create data dictionary entry for tablespaces for one SE.
[in] | thd | Thread Handle |
[in] | plugin | Handlerton Plugin |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Upgrade logs inside all SE.
[in] | thd | Thread Handle |
false | ON SUCCESS |
true | ON FAILURE |
bool dd::upgrade_57::in_progress | ( | ) |
Check if upgrade is in progress.
|
static |
|
static |
|
static |
Migration of NDB tables is deferred until later, except for:
To check whether the table is a NDB table, look for the presence of a table_name.ndb file in the data directory. These files still exist at this point, though they will be permanently removed later in the upgrade.
|
static |
Returns the collation id for the database specified.
[in] | thd | Thread handle. |
[in] | db_opt_path | Path for database. |
[out] | schema_charset | Character set of database. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Load the charset and time zone information for an event.
bool dd::upgrade_57::migrate_all_frm_to_dd | ( | THD * | thd, |
const char * | dbname, | ||
bool | is_fix_view_cols_and_deps | ||
) |
Scan the database to identify all .frm files.
Identify all .frm files to upgrade in a database.
Triggers existence will be checked only for tables found here.
[in] | thd | Thread handle. |
[in] | dbname | Pointer for database name. |
[in] | is_fix_view_cols_and_deps | Fix view col data, table and routines dependency. |
false | ON SUCCESS |
true | ON FAILURE |
Create an entry in the DD for the event by reading all the event attributes stored in 'mysql.event' table.
bool dd::upgrade_57::migrate_events_to_dd | ( | THD * | thd | ) |
Migrate all the events from 'mysql.event' to 'events' DD table.
Migrate all events from mysql.event to mysql.events table.
[in] | thd | Thread handle. |
false | ON SUCCESS |
true | ON FAILURE |
bool dd::upgrade_57::migrate_plugin_table_to_dd | ( | THD * | thd | ) |
Upgrade mysql.plugin table.
Migrate plugin table to Data Dictionary.
This is required to initialize the plugins. User tables will be upgraded after all the plugins are initialized.
All plugin initialization should happens before user tables upgrade. It is needed to initialize all the Storage Engines.
[in] | thd | Thread handle. |
false | ON SUCCESS |
true | ON FAILURE |
This function migrate one SP/SF from mysql.proc to routines DD table.
One record in mysql.proc is metadata for one SP/SF. This function parses one record to extract metadata required and store it in DD table.
bool dd::upgrade_57::migrate_routines_to_dd | ( | THD * | thd | ) |
Migrate Stored Procedure and Functions from mysql.proc to routines dd table.
Migrate all SP/SF from mysql.proc to mysql.routines dd table.
[in] | thd | Thread handle. |
false | ON SUCCESS |
true | ON FAILURE |
bool dd::upgrade_57::migrate_schema_to_dd | ( | THD * | thd, |
const char * | dbname | ||
) |
Update the Schemata:DD for every database present in the data directory.
Create entry in mysql.schemata for all the folders found in data directory.
If db.opt file is not present in any folder, that folder will be treated as a database and a warning is issued.
[in] | thd | Thread handle. |
[in] | dbname | Schema name. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Migrate statistics from 5.7 stats tables.
Ignore error here as stats table data can be regenerated by user using ANALYZE command.
|
static |
Read .frm files and enter metadata for tables/views.
|
static |
Create an entry in the DD for the view.
[in] | thd | Thread handle. |
[in] | frm_context | Structure to hold view definition read from frm file. |
[in] | db_name | database name. |
[in] | view_name | view name. |
[in] | mem_root | MEM_ROOT to handle memory allocations. |
[in] | is_fix_view_cols_and_deps | Flag to create view with dependency information. |
false | ON SUCCESS |
true | ON FAILURE |
void dd::upgrade_57::rename_back_stats_tables | ( | THD * | thd | ) |
Rename back .ibd files for innodb stats table.
|
static |
Rename stats tables.
Installation from 5.7 should contain mysql.innodb_table_stats and mysql.innodb_index_stats. Rename .frm and .ibd files for these tables here. These tables will be created from scratch with other dictionary tables. Data from 5.7 stats table will be inserted in new created stats table via INSERT...SELECT statement.
|
static |
void dd::upgrade_57::set_allow_sdi_creation | ( | bool | param | ) |
void dd::upgrade_57::set_in_progress | ( | bool | param | ) |
|
static |
Call handler API to get storate engine specific metadata.
Storage Engine should fill tablespace information, Foreign key information, partition information and correct row type.
[in] | thd | Thread Handle |
[in] | schema_name | Name of schema |
[in] | table_name | Name of table |
[in] | table | TABLE object |
[in] | skip_error | Skip error in case of innodb stats table. |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
Set st_sp_chistics for routines.
|
static |
Update the event's interval and status information in the DD.
bool dd::upgrade_57::terminate | ( | THD * | thd | ) |
Drop all DD tables in case there is an error while upgrading server.
[in] | thd | Thread context. |
|
static |
Update the created, last modified and last executed time for the event with the values read from the old data dir.
|
static |
Upgrade logs inside one SE.
[in] | thd | Thread Handle |
[in] | plugin | Handlerton Plugin |
false | ON SUCCESS |
true | ON FAILURE |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const TABLE_FIELD_TYPE dd::upgrade_57::event_table_fields[ET_FIELD_COUNT] |
Column definitions for 5.7 mysql.event table (5.7.13 and up).
|
static |
Column definitions for 5.7 mysql.event table (before 5.7.13).
const String_type dd::upgrade_57::IBD_EXT = ".ibd" |
const String_type dd::upgrade_57::index_stats = "innodb_index_stats" |
const String_type dd::upgrade_57::index_stats_backup = "innodb_index_stats_backup57" |
const String_type dd::upgrade_57::ISL_EXT = ".isl" |
const String_type dd::upgrade_57::NDB_EXT = ".ndb" |
const String_type dd::upgrade_57::OPT_EXT = ".opt" |
const String_type dd::upgrade_57::PAR_EXT = ".par" |
|
static |
|
static |
|
static |
Column definitions for 5.7 mysql.proc table (5.7.13 and up).
|
static |
Column definitions for 5.7 mysql.proc table (before 5.7.13).
|
static |
|
static |
|
static |
|
static |
const String_type dd::upgrade_57::table_stats = "innodb_table_stats" |
const String_type dd::upgrade_57::table_stats_backup = "innodb_table_stats_backup57" |
const char * dd::upgrade_57::TRG_EXT = ".TRG" |
|
static |
Table of .TRG file field descriptors.
const LEX_CSTRING dd::upgrade_57::trg_file_type = {STRING_WITH_LEN("TRIGGERS")} |
|
static |
const char * dd::upgrade_57::TRN_EXT = ".TRN" |
|
static |