MySQL 8.0.40
Source Code Documentation
|
Classes | |
class | DD_bootstrap_ctx |
Enumerations | |
enum class | Stage { NOT_STARTED , STARTED , CREATED_TABLESPACES , FETCHED_PROPERTIES , CREATED_TABLES , SYNCED , UPGRADED_TABLES , POPULATED , STORED_DD_META_DATA , VERSION_UPDATED , FINISHED } |
Functions | |
bool | DDSE_dict_init (THD *thd, dict_init_mode_t dict_init_mode, uint version) |
Initialize InnoDB for. More... | |
bool | initialize_dictionary (THD *thd, bool is_dd_upgrade, Dictionary_impl *d) |
Create mysql schema. More... | |
bool | initialize (THD *thd) |
Initialize the dictionary while starting the server for the first time. More... | |
bool | restart (THD *thd) |
Initialize the dictionary while restarting the server. More... | |
void | recover_innodb_upon_upgrade (THD *thd) |
This function is used in case of crash during upgrade. More... | |
bool | setup_dd_objects_and_collations (THD *thd) |
Initialization and verification of dictionary objects after upgrade, similar to what is done after normal server restart. More... | |
bool | store_plugin_IS_table_metadata (THD *thd) |
Iterate through all the plugins, and store IS table meta data into dictionary, once during MySQL server bootstrap. More... | |
bool | invalid_triggers (THD *thd, const char *schema_name, const dd::Table &table) |
Validate all the triggers of the given table. More... | |
Variables | |
static constexpr uint | DD_VERSION_80011 = 80011 |
static constexpr uint | DD_VERSION_80012 = 80012 |
static constexpr uint | DD_VERSION_80013 = 80013 |
static constexpr uint | DD_VERSION_80014 = 80014 |
static constexpr uint | DD_VERSION_80015 = 80015 |
static constexpr uint | DD_VERSION_80016 = 80016 |
static constexpr uint | DD_VERSION_80017 = 80017 |
static constexpr uint | DD_VERSION_80021 = 80021 |
static constexpr uint | DD_VERSION_80022 = 80022 |
static constexpr uint | DD_VERSION_80023 = 80023 |
static std::set< uint > | supported_dd_versions |
static constexpr uint | SERVER_VERSION_50700 = 50700 |
static constexpr uint | SERVER_VERSION_80011 = 80011 |
static constexpr uint | SERVER_VERSION_80013 = 80013 |
static constexpr uint | SERVER_VERSION_80014 = 80014 |
static constexpr uint | SERVER_VERSION_80015 = 80015 |
static constexpr uint | SERVER_VERSION_80016 = 80016 |
static std::set< uint > | unsupported_server_versions = {} |
|
strong |
bool dd::bootstrap::DDSE_dict_init | ( | THD * | thd, |
dict_init_mode_t | dict_init_mode, | ||
uint | version | ||
) |
Initialize InnoDB for.
thd | Thread context. |
dict_init_mode | mode to initialize InnoDB |
version | Dictionary version. |
bool dd::bootstrap::initialize | ( | THD * | thd | ) |
Initialize the dictionary while starting the server for the first time.
At this point, the DDSE has been initialized as a normal plugin. The dictionary initialization proceeds as follows:
1.1 Call dict_init() to initialize the DDSE. This will make the predefined tablespaces be created physically, and their meta data be returned to the SQL layer along with the meta data for the DD tables required by the DDSE. The tables are not yet created physically. 1.2 Prepare the dd::Tablespace objects reflecting the predefined tablespace objects and add them to the core registry in the storage adapter.
2.1 Create and use the dictionary schema by executing SQL statements. The schema is created physically since this is the first time start, and the meta data is generated and stored in the core registry of the storage adapter without being written to disk. 2.2 Create tables by executing SQL statements. Like for the schema, the tables are created physically, and the meta data is generated and stored in the core registry without being written to disk. This is done to prepare enough meta data to actually be able to open the DD tables.
3.1 Store meta data for the DD schema, tablespace and tables, i.e., the DD objects that were generated in the scaffolding phase, and make sure the IDs are maintained when the objects are stored. 3.2 Populate the DD tables which have some predefined static contents to be inserted. This is, e.g., relevant for the 'catalogs' table, which only has a single default entry in it. Dynamic contents is added in other ways, e.g. by storing generated DD objects (see above) or by inserting data from other sources (see re-population of character sets in the context of server restart below). 3.3 Store various properties of the DD tables, including the SE private data, a representation of the DDL statement used to create the table etc. 3.4 Verify that the dictionary objects representing the core DD table meta data are present in the core registry of the storage adapter. If an object representing the meta data of a core DD table is not available, then we loose access to the DD tables, and we will not be able to handle cache misses or updates to the meta data. 3.5 Update the version numbers that are stored, e.g. the DD version and the current mysqld server version.
thd | Thread context. |
bool dd::bootstrap::initialize_dictionary | ( | THD * | thd, |
bool | is_dd_upgrade, | ||
Dictionary_impl * | d | ||
) |
Create mysql schema.
Create dictionary tables inside InnoDB. Create entry for dictionary tables inside dictionary tables. Add hard coded data to dictionary tables. Create Foreign key constraint on dictionary tables.
This function is used in both cases, new data directory initialization and in place upgrade.
thd | Thread context. |
is_dd_upgrade | Flag to indicate if it is in place upgrade. |
d | Dictionary instance |
bool dd::bootstrap::invalid_triggers | ( | THD * | thd, |
const char * | schema_name, | ||
const dd::Table & | table | ||
) |
Validate all the triggers of the given table.
void dd::bootstrap::recover_innodb_upon_upgrade | ( | THD * | thd | ) |
This function is used in case of crash during upgrade.
It tries to initialize dictionary and calls DDSE_dict_recover. InnoDB should do the recovery and empty undo log. Upgrade process will do the cleanup and exit.
thd | Thread context. |
bool dd::bootstrap::restart | ( | THD * | thd | ) |
Initialize the dictionary while restarting the server.
At this point, the DDSE has been initialized as a normal plugin. The dictionary initialization proceeds as follows:
1.1 Call dict_init() to initialize the DDSE. This will retrieve the meta data of the predefined tablespaces and the DD tables required by the DDSE. Both the tables and the tablespaces are already created physically, the point here is just to get hold of enough meta data to start using the DD. 1.2 Prepare the dd::Tablespace objects reflecting the predefined tablespace objects and add them to the core registry in the storage adapter.
2.1 Create and use the dictionary schema by executing SQL statements. The schema is not created physically, but the meta data is generated and stored in the core registry without being written to disk. 2.2 Create tables by executing SQL statements. Like for the schema, the tables are not created physically, but the meta data is generated and stored in the core registry without being written to disk. This is done to prepare enough meta data to actually be able to open the DD tables. The SQL DDL statements are either retrieved from the table definitions that are part of the server binary (for restart), or from one of the DD tables (for upgrade).
3.1 Read meta data for the DD tables from the DD tables. Here, we use the meta data from the scaffolding phase for the schema, tablespace and the DD tables to open the physical DD tables. We read the stored objects, and update the in-memory copies in the core registry with the real meta data from the objects that are retrieved form persistent storage. Finally, we flush the tables to empty the table definition cache to make sure the table share structures for the DD tables are re-created based on the actual meta data that was read from disk rather than the temporary meta data from the scaffolding phase. 3.2 If this is a restart with a new DD version, we must upgrade the DD tables. In that case, we create the new target DD tables in a temporary schema, migrate the meta data to the new tables, and then do DML on the DD tables to make sure the new DD tables will be used instead of the old ones. This DML involves changing the schema ids directly in the DD tables, and updating the meta data stored in the 'dd_properties' DD table. This will make sure the switch from the old to the new tables is atomic. After this is done, we will reset the DD cache and start over the initialization from step 1.2. Then, the new DD tables will be used, and a normal restart will be done. 3.3 Re-populate character sets and collations: The character set and collation information is read from files and added to a server internal data structure when the server starts. This data structure is, in turn, used to populate the corresponding DD tables. The tables must be re-populated on each server start if new character sets or collations have been added. However, we can not do this if in read only mode. 3.4 Verify that the dictionary objects representing the core DD table meta data are present in the core registry of the storage adapter. If an object representing the meta data of a core DD table is not available, then we loose access to the DD tables, and we will not be able to handle cache misses or updates to the meta data. 3.5 If an upgrade was done, the persistent version numbers are updated, e.g. the DD version and the current mysqld server version.
thd | Thread context. |
bool dd::bootstrap::setup_dd_objects_and_collations | ( | THD * | thd | ) |
Initialization and verification of dictionary objects after upgrade, similar to what is done after normal server restart.
thd | Thread context |
bool dd::bootstrap::store_plugin_IS_table_metadata | ( | THD * | thd | ) |
Iterate through all the plugins, and store IS table meta data into dictionary, once during MySQL server bootstrap.
thd | Thread context. |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
static |