193 std::ostream &
print(std::ostream &out)
const;
442 bool is_drop,
bool dict_locked);
450 const char *new_file_path);
479 const char *new_name);
552 const char *old_file_path,
553 const char *new_file_path);
560 const char *new_file_path);
601 const char *new_name);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:47
uint32_t page_no_t
Page number.
Definition: api0api.h:45
Wrapper of mysql.innodb_ddl_log table.
Definition: log0ddl.h:247
dberr_t search(ulint thread_id, DDL_Records &records)
Search for all records of specified thread_id.
Definition: log0ddl.cc:672
static constexpr unsigned s_page_no_col_no
Column number of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:375
static constexpr unsigned s_thread_id_col_len
Column length of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:360
mem_heap_t * m_heap
Heap to store the m_tuple, m_thr and all operation on mysql.innodb_ddl_log table.
Definition: log0ddl.h:412
static constexpr unsigned s_index_id_col_len
Column length of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:384
static constexpr unsigned s_table_id_col_len
Column length of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:390
static constexpr unsigned s_id_col_no
Column number of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:351
static constexpr unsigned s_index_id_col_no
Column number of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:381
void set_field(const byte *data, ulint offset, ulint len, DDL_Record &record)
Set the given field of the innodb_ddl_log record from given data.
Definition: log0ddl.cc:564
static constexpr unsigned s_table_id_col_no
Column number of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:387
static constexpr unsigned s_space_id_col_no
Column number of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:369
dberr_t search_all(DDL_Records &records)
Do a reverse scan on the table to fetch all the record.
Definition: log0ddl.cc:633
dict_table_t * m_table
innodb_ddl_log table.
Definition: log0ddl.h:399
que_thr_t * m_thr
Dummy query thread.
Definition: log0ddl.h:408
dberr_t search_by_id(ulint id, dict_index_t *index, DDL_Records &records)
Search specified index by specified ID.
Definition: log0ddl.cc:693
static constexpr unsigned s_page_no_col_len
Column length of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:378
static constexpr unsigned s_space_id_col_len
Column length of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:372
static constexpr unsigned s_thread_id_col_no
Column number of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:357
static constexpr unsigned s_old_file_path_col_no
Column number of mysql.innodb_ddl_log.old_file_path.
Definition: log0ddl.h:393
ulint parse_id(const dict_index_t *index, rec_t *rec, const ulint *offsets)
Parse the index record and get 'ID'.
Definition: log0ddl.cc:553
static constexpr unsigned s_type_col_len
Column length of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:366
static constexpr unsigned s_id_col_len
Column length of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:354
static constexpr unsigned s_new_file_path_col_no
Column number of mysql.innodb_ddl_log.new_file_path.
Definition: log0ddl.h:396
dtuple_t * m_tuple
Tuple used for insert, search, delete operation.
Definition: log0ddl.h:402
dberr_t insert(const DDL_Record &record)
Insert the DDL log record into the innodb_ddl_log table.
Definition: log0ddl.cc:467
void stop_query_thread()
Stop the query thread.
Definition: log0ddl.cc:345
void create_tuple(const DDL_Record &record)
Create tuple for the innodb_ddl_log table.
Definition: log0ddl.cc:351
static constexpr unsigned s_type_col_no
Column number of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:363
trx_t * m_trx
Transaction used for insert, delete operation.
Definition: log0ddl.h:405
DDL_Log_Table()
Constructor.
Definition: log0ddl.cc:322
ulint fetch_value(const byte *data, ulint offset)
Fetch the value from given offset.
Definition: log0ddl.cc:609
~DDL_Log_Table()
Destructor.
Definition: log0ddl.cc:333
dberr_t remove(ulint id)
Delete the innodb_ddl_log record of specified ID.
Definition: log0ddl.cc:736
void start_query_thread()
Set the query thread using graph.
Definition: log0ddl.cc:338
void convert_to_ddl_record(bool is_clustered, rec_t *rec, const ulint *offsets, DDL_Record &record)
Convert the innodb_ddl_log index record to DDL_Record.
Definition: log0ddl.cc:528
DDL log record.
Definition: log0ddl.h:78
ulint m_id
Log id.
Definition: log0ddl.h:197
ulint m_thread_id
Thread id.
Definition: log0ddl.h:203
const char * get_new_file_path() const
Get the new file path/name present in the DDL log record.
Definition: log0ddl.h:177
Log_Type m_type
Log type.
Definition: log0ddl.h:200
Log_Type get_type() const
Get the type of operation to perform for the DDL log record.
Definition: log0ddl.h:97
page_no_t get_page_no() const
Get the page no present in the DDL log record.
Definition: log0ddl.h:121
void set_new_file_path(const char *name)
Set the new file path/name for the DDL log record.
Definition: log0ddl.cc:191
void set_index_id(ulint index_id)
Set the index id for the DDL log record.
Definition: log0ddl.h:133
table_id_t get_table_id() const
Get the table id present in the DDL log record.
Definition: log0ddl.h:137
void set_table_id(table_id_t table_id)
Set the table if for the DDL log record.
Definition: log0ddl.h:141
space_id_t get_space_id() const
Get the space_id present in the DDL log record.
Definition: log0ddl.h:113
void set_page_no(page_no_t page_no)
Set the page number for the DDL log record.
Definition: log0ddl.h:125
Encryption::Progress get_encryption_type() const
Get encryption operation type.
Definition: log0ddl.h:152
~DDL_Record()
Destructor.
Definition: log0ddl.cc:166
void set_type(Log_Type type)
Set the type for the DDL log record.
Definition: log0ddl.h:101
ulint get_id() const
Get the id of the DDL log record.
Definition: log0ddl.h:88
ulint m_index_id
Index id.
Definition: log0ddl.h:212
mem_heap_t * m_heap
memory heap object used for storing file name.
Definition: log0ddl.h:225
DDL_Record()
Constructor.
Definition: log0ddl.cc:154
bool get_deletable() const
If this record can be deleted.
Definition: log0ddl.h:149
char * m_old_file_path
Tablespace file path for DELETE, Old tablespace file path for RENAME.
Definition: log0ddl.h:219
bool validate() const
Definition: log0ddl.h:231
space_id_t m_space_id
Tablespace id.
Definition: log0ddl.h:206
void set_deletable(bool deletable)
Set deletability of this record.
Definition: log0ddl.h:145
table_id_t m_table_id
Table id.
Definition: log0ddl.h:215
void set_id(ulint id)
Set the id for the DDL log record.
Definition: log0ddl.h:92
page_no_t m_page_no
Index root page.
Definition: log0ddl.h:209
ulint get_index_id() const
Get the index id present in the DDL log record.
Definition: log0ddl.h:129
void set_thread_id(ulint thread_id)
Set the thread id for the DDL log record.
Definition: log0ddl.h:109
void set_space_id(space_id_t space)
Set the space id for the DDL log record.
Definition: log0ddl.h:117
const char * get_old_file_path() const
Get the old file path/name present in the DDL log record.
Definition: log0ddl.h:164
bool m_deletable
If this record can be deleted.
Definition: log0ddl.h:228
std::ostream & print(std::ostream &out) const
Print the DDL record to specified output stream.
Definition: log0ddl.cc:210
void set_old_file_path(const char *name)
Set the old file path from the name for the DDL log record.
Definition: log0ddl.cc:172
ulint get_thread_id() const
Get the thread id for the DDL log record.
Definition: log0ddl.h:105
char * m_new_file_path
New tablespace file name for RENAME.
Definition: log0ddl.h:222
Progress
Encryption progress type.
Definition: os0enc.h:80
Class to write and replay ddl logs.
Definition: log0ddl.h:416
void replay_drop_log(const table_id_t table_id)
Replay DROP log.
Definition: log0ddl.cc:1840
dberr_t replay(DDL_Record &record)
Replay DDL log record.
Definition: log0ddl.cc:1612
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.
Definition: log0ddl.cc:1125
void replay_rename_space_log(space_id_t space_id, const char *old_file_path, const char *new_file_path)
Replay RENAME log.
Definition: log0ddl.cc:1758
~Log_DDL()=default
Deconstructor.
DDL_Record * find_alter_encrypt_record(space_id_t space_id)
Find alter encrypt record for the tablespace.
Definition: log0ddl.cc:1162
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.
Definition: log0ddl.cc:1071
dberr_t post_ddl(THD *thd)
Replay and clean DDL logs after DDL transaction commints or rollbacks.
Definition: log0ddl.cc:1941
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.
Definition: log0ddl.cc:926
dberr_t recover()
Recover in server startup.
Definition: log0ddl.cc:1978
dberr_t delete_by_id(trx_t *trx, uint64_t id, bool dict_locked)
Delete log record by id.
Definition: log0ddl.cc:1448
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.
Definition: log0ddl.cc:859
Log_DDL()
Constructor.
Definition: log0ddl.cc:836
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.
Definition: log0ddl.cc:1173
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.
Definition: log0ddl.cc:1217
void replay_rename_table_log(const char *old_name, const char *new_name)
Relay RENAME TABLE log.
Definition: log0ddl.cc:1849
uint64_t next_id()
Get next autoinc counter by increasing 1 for innodb_ddl_log.
Definition: log0ddl.cc:841
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.
Definition: log0ddl.cc:1022
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...
Definition: log0ddl.cc:1264
bool skip(const dict_table_t *table, THD *thd)
Check if we need to skip ddl log for a table.
Definition: log0ddl.cc:853
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.
Definition: log0ddl.cc:1418
dberr_t replay_by_thread_id(ulint thread_id)
Scan, replay and delete log records by thread id.
Definition: log0ddl.cc:1517
dberr_t write_rename_table_log(dict_table_t *table, const char *old_name, const char *new_name)
Write a RENAME table log record.
Definition: log0ddl.cc:1319
static bool is_in_recovery()
Is it in ddl recovery in server startup.
Definition: log0ddl.h:507
dberr_t delete_by_ids(DDL_Records &records)
Delete the log records present in the list.
Definition: log0ddl.cc:1575
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.
Definition: log0ddl.cc:1351
void replay_remove_cache_log(table_id_t table_id, const char *table_name)
Relay remove cache log.
Definition: log0ddl.cc:1909
void replay_delete_space_log(space_id_t space_id, const char *file_path)
Replay DELETE log(delete file if exist)
Definition: log0ddl.cc:1695
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.
Definition: log0ddl.cc:1289
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.
Definition: log0ddl.cc:967
dberr_t replay_alter_encrypt_space_log(DDL_Record &record)
Replay an ALTER ENCRYPT TABLESPACE log record.
Definition: log0ddl.cc:1813
dberr_t write_remove_cache_log(trx_t *trx, dict_table_t *table)
Write a REMOVE cache log record.
Definition: log0ddl.cc:1388
dberr_t replay_all()
Scan, replay and delete all log records.
Definition: log0ddl.cc:1480
static bool s_in_recovery
Whether in recover(replay) ddl log in startup.
Definition: log0ddl.h:656
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)
Definition: log0ddl.cc:1661
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
dberr_t
Definition: db0err.h:39
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:232
Log_Type
DDL log types defined as uint32_t because it costs 4 bytes in mysql.innodb_ddl_log.
Definition: log0ddl.h:45
@ BIGGEST_LOG
Biggest log type.
@ ALTER_UNENCRYPT_TABLESPACE_LOG
Alter Unencrypt a tablespace.
@ DROP_LOG
Drop the entry in innodb_table_metadata.
@ REMOVE_CACHE_LOG
Remove a table from dict cache.
@ SMALLEST_LOG
Smallest log type.
@ DELETE_SPACE_LOG
Delete a file.
@ RENAME_SPACE_LOG
Rename a file.
@ RENAME_TABLE_LOG
Rename table in dict cache.
@ ALTER_ENCRYPT_TABLESPACE_LOG
Alter Encrypt a tablespace.
@ FREE_TREE_LOG
Drop an index tree.
std::vector< DDL_Record * > DDL_Records
Array of DDL records.
Definition: log0ddl.h:243
void ddl_log_close()
Close the DDL log system.
Definition: log0ddl.h:663
void ddl_log_crash_reset(THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
Reset all crash injection counters.
Definition: log0ddl.cc:130
bool innodb_ddl_log_crash_reset_debug
Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;.
Definition: log0ddl.cc:75
Log_DDL * log_ddl
Object to handle Log_DDL.
Definition: log0ddl.cc:63
static my_thread_id thread_id
Definition: my_thr_init.cc:63
static int record
Definition: mysqltest.cc:195
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const char * table_name
Definition: rules_table_service.cc:56
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:809
byte rec_t
Definition: rem0types.h:41
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
Data structure for an index.
Definition: dict0mem.h:1046
Data structure for a database table.
Definition: dict0mem.h:1909
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:682
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Definition: que0que.h:242
Definition: trx0trx.h:684
unsigned long int ulint
Definition: univ.i:406
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510