MySQL 8.0.40
Source Code Documentation
|
Class to write and replay ddl logs. More...
#include <log0ddl.h>
Public Member Functions | |
Log_DDL () | |
Constructor. More... | |
~Log_DDL ()=default | |
Deconstructor. More... | |
dberr_t | write_free_tree_log (trx_t *trx, const dict_index_t *index, bool is_drop_table) |
Write DDL log for freeing B-tree. More... | |
dberr_t | write_delete_space_log (trx_t *trx, const dict_table_t *table, space_id_t space_id, const char *file_path, bool is_drop, bool dict_locked) |
Write DDL log for deleting tablespace file. More... | |
dberr_t | write_rename_space_log (space_id_t space_id, const char *old_file_path, const char *new_file_path) |
Write a RENAME log record. More... | |
DDL_Record * | find_alter_encrypt_record (space_id_t space_id) |
Find alter encrypt record for the tablespace. More... | |
dberr_t | write_alter_encrypt_space_log (space_id_t space_id, Encryption::Progress type, DDL_Record *existing_rec) |
Write an ALTER ENCRYPT Tablespace DDL log record. More... | |
dberr_t | write_drop_log (trx_t *trx, const table_id_t table_id) |
Write a DROP log to indicate the entry in innodb_table_metadata should be removed for specified table. More... | |
dberr_t | write_rename_table_log (dict_table_t *table, const char *old_name, const char *new_name) |
Write a RENAME table log record. More... | |
dberr_t | write_remove_cache_log (trx_t *trx, dict_table_t *table) |
Write a REMOVE cache log record. More... | |
dberr_t | replay (DDL_Record &record) |
Replay DDL log record. More... | |
dberr_t | post_ddl (THD *thd) |
Replay and clean DDL logs after DDL transaction commints or rollbacks. More... | |
dberr_t | recover () |
Recover in server startup. More... | |
Static Public Member Functions | |
static bool | is_in_recovery () |
Is it in ddl recovery in server startup. More... | |
Private Member Functions | |
dberr_t | insert_free_tree_log (trx_t *trx, const dict_index_t *index, uint64_t id, ulint thread_id) |
Insert a FREE log record. More... | |
void | replay_free_tree_log (space_id_t space_id, page_no_t page_no, ulint index_id) |
Replay FREE log(free B-tree if exist) More... | |
dberr_t | insert_delete_space_log (trx_t *trx, uint64_t id, ulint thread_id, space_id_t space_id, const char *file_path, bool dict_locked) |
Insert a DELETE log record. More... | |
void | replay_delete_space_log (space_id_t space_id, const char *file_path) |
Replay DELETE log(delete file if exist) More... | |
dberr_t | insert_rename_space_log (uint64_t id, ulint thread_id, space_id_t space_id, const char *old_file_path, const char *new_file_path) |
Insert a RENAME log record. More... | |
void | replay_rename_space_log (space_id_t space_id, const char *old_file_path, const char *new_file_path) |
Replay RENAME log. More... | |
dberr_t | insert_alter_encrypt_space_log (uint64_t id, ulint thread_id, space_id_t space_id, Encryption::Progress type, DDL_Record *existing_rec) |
Insert an ALTER ENCRYPT TABLESPACE log record. More... | |
dberr_t | replay_alter_encrypt_space_log (DDL_Record &record) |
Replay an ALTER ENCRYPT TABLESPACE log record. More... | |
dberr_t | insert_drop_log (trx_t *trx, uint64_t id, ulint thread_id, const table_id_t table_id) |
Insert a DROP log record. More... | |
void | replay_drop_log (const table_id_t table_id) |
Replay DROP log. More... | |
dberr_t | insert_rename_table_log (uint64_t id, ulint thread_id, table_id_t table_id, const char *old_name, const char *new_name) |
Insert a RENAME TABLE log record. More... | |
void | replay_rename_table_log (const char *old_name, const char *new_name) |
Relay RENAME TABLE log. More... | |
dberr_t | insert_remove_cache_log (uint64_t id, ulint thread_id, table_id_t table_id, const char *table_name) |
Insert a REMOVE cache log record. More... | |
void | replay_remove_cache_log (table_id_t table_id, const char *table_name) |
Relay remove cache log. More... | |
dberr_t | delete_by_id (trx_t *trx, uint64_t id, bool dict_locked) |
Delete log record by id. More... | |
dberr_t | replay_by_thread_id (ulint thread_id) |
Scan, replay and delete log records by thread id. More... | |
dberr_t | delete_by_ids (DDL_Records &records) |
Delete the log records present in the list. More... | |
dberr_t | replay_all () |
Scan, replay and delete all log records. More... | |
uint64_t | next_id () |
Get next autoinc counter by increasing 1 for innodb_ddl_log. More... | |
bool | skip (const dict_table_t *table, THD *thd) |
Check if we need to skip ddl log for a table. More... | |
Static Private Attributes | |
static bool | s_in_recovery = false |
Whether in recover(replay) ddl log in startup. More... | |
Class to write and replay ddl logs.
Log_DDL::Log_DDL | ( | ) |
Constructor.
|
default |
Deconstructor.
Delete log record by id.
[in] | trx | transaction instance |
[in] | id | log id |
[in] | dict_locked | true if dict_sys mutex is held, otherwise false |
|
private |
Delete the log records present in the list.
[in] | records | DDL_Records where the IDs are got |
DDL_Record * Log_DDL::find_alter_encrypt_record | ( | space_id_t | space_id | ) |
Find alter encrypt record for the tablespace.
[in] | space_id | space_id return log record if exists, null otherwise |
|
private |
Insert an ALTER ENCRYPT TABLESPACE log record.
[in] | id | log id |
[in] | thread_id | thread id |
[in] | space_id | tablespace id |
[in] | type | encryption operation type |
[out] | existing_rec | alter_encrypt ddl record, nullptr if none |
|
private |
Insert a DELETE log record.
[in,out] | trx | transaction |
[in] | id | log id |
[in] | thread_id | thread id |
[in] | space_id | tablespace id |
[in] | file_path | file path |
[in] | dict_locked | true if dict_sys mutex is held |
|
private |
Insert a DROP log record.
[in,out] | trx | transaction |
[in] | id | log id |
[in] | thread_id | thread id |
[in] | table_id | table id |
|
private |
Insert a FREE log record.
[in,out] | trx | transaction |
[in] | index | dict index |
[in] | id | log id |
[in] | thread_id | thread id |
|
private |
Insert a REMOVE cache log record.
[in] | id | log id |
[in] | thread_id | thread id |
[in] | table_id | table id |
[in] | table_name | table name |
|
private |
Insert a RENAME log record.
[in] | id | log id |
[in] | thread_id | thread id |
[in] | space_id | tablespace id |
[in] | old_file_path | file path after rename |
[in] | new_file_path | file path before rename |
|
private |
Insert a RENAME TABLE log record.
[in] | id | log id |
[in] | thread_id | thread id |
[in] | table_id | table id |
[in] | old_name | table name after rename |
[in] | new_name | table name before rename |
|
inlinestatic |
Is it in ddl recovery in server startup.
|
inlineprivate |
Get next autoinc counter by increasing 1 for innodb_ddl_log.
Replay and clean DDL logs after DDL transaction commints or rollbacks.
[in] | thd | mysql thread |
dberr_t Log_DDL::recover | ( | ) |
Recover in server startup.
Scan innodb_ddl_log table, and replay all log entries. Note: redo log should be applied, and DD transactions should be recovered before calling this function.
dberr_t Log_DDL::replay | ( | DDL_Record & | record | ) |
Replay DDL log record.
[in,out] | record | DDL log record return DB_SUCCESS or error |
|
private |
Scan, replay and delete all log records.
|
private |
Replay an ALTER ENCRYPT TABLESPACE log record.
[in] | record | DDL Record |
Scan, replay and delete log records by thread id.
[in] | thread_id | thread id |
|
private |
Replay DELETE log(delete file if exist)
[in] | space_id | tablespace id |
[in] | file_path | file path |
|
private |
Replay DROP log.
[in] | table_id | table id |
|
private |
Replay FREE log(free B-tree if exist)
[in] | space_id | tablespace id |
[in] | page_no | root page no |
[in] | index_id | index id |
|
private |
Relay remove cache log.
[in] | table_id | table id |
[in] | table_name | table name |
|
private |
Replay RENAME log.
[in] | space_id | tablespace id |
[in] | old_file_path | old file path |
[in] | new_file_path | new file path |
|
private |
Relay RENAME TABLE log.
[in] | old_name | old name |
[in] | new_name | new name |
|
inlineprivate |
Check if we need to skip ddl log for a table.
[in] | table | dict table |
[in] | thd | mysql thread |
dberr_t Log_DDL::write_alter_encrypt_space_log | ( | space_id_t | space_id, |
Encryption::Progress | type, | ||
DDL_Record * | existing_rec | ||
) |
Write an ALTER ENCRYPT Tablespace DDL log record.
[in] | space_id | tablespace id |
[in] | type | encryption operation type |
[out] | existing_rec | alter_encrypt ddl record, nullptr if none |
dberr_t Log_DDL::write_delete_space_log | ( | trx_t * | trx, |
const dict_table_t * | table, | ||
space_id_t | space_id, | ||
const char * | file_path, | ||
bool | is_drop, | ||
bool | dict_locked | ||
) |
Write DDL log for deleting tablespace file.
[in,out] | trx | transaction |
[in] | table | dict table |
[in] | space_id | tablespace id |
[in] | file_path | file path |
[in] | is_drop | flag whether dropping tablespace |
[in] | dict_locked | true if dict_sys mutex is held |
dberr_t Log_DDL::write_drop_log | ( | trx_t * | trx, |
const table_id_t | table_id | ||
) |
Write a DROP log to indicate the entry in innodb_table_metadata should be removed for specified table.
[in,out] | trx | transaction |
[in] | table_id | table ID |
dberr_t Log_DDL::write_free_tree_log | ( | trx_t * | trx, |
const dict_index_t * | index, | ||
bool | is_drop_table | ||
) |
Write DDL log for freeing B-tree.
[in,out] | trx | transaction |
[in] | index | dict index |
[in] | is_drop_table | true if this is drop table |
dberr_t Log_DDL::write_remove_cache_log | ( | trx_t * | trx, |
dict_table_t * | table | ||
) |
Write a REMOVE cache log record.
[in,out] | trx | transaction |
[in] | table | dict table |
dberr_t Log_DDL::write_rename_space_log | ( | space_id_t | space_id, |
const char * | old_file_path, | ||
const char * | new_file_path | ||
) |
Write a RENAME log record.
[in] | space_id | tablespace id |
[in] | old_file_path | file path after rename |
[in] | new_file_path | file path before rename |
dberr_t Log_DDL::write_rename_table_log | ( | dict_table_t * | table, |
const char * | old_name, | ||
const char * | new_name | ||
) |
Write a RENAME table log record.
[in] | table | dict table |
[in] | old_name | table name after rename |
[in] | new_name | table name before rename |
|
staticprivate |
Whether in recover(replay) ddl log in startup.
Whether in recover(replay) DDL log in startup.