191 std::ostream &
print(std::ostream &out)
const;
434 bool is_drop,
bool dict_locked);
442 const char *new_file_path);
471 const char *new_name);
544 const char *old_file_path,
545 const char *new_file_path);
552 const char *new_file_path);
593 const char *new_name);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:51
uint32_t page_no_t
Page number.
Definition: api0api.h:49
Wrapper of mysql.innodb_ddl_log table.
Definition: log0ddl.h:239
dberr_t search(ulint thread_id, DDL_Records &records)
Search for all records of specified thread_id.
Definition: log0ddl.cc:666
static constexpr unsigned s_page_no_col_no
Column number of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:367
static constexpr unsigned s_thread_id_col_len
Column length of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:352
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:404
static constexpr unsigned s_index_id_col_len
Column length of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:376
static constexpr unsigned s_table_id_col_len
Column length of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:382
static constexpr unsigned s_id_col_no
Column number of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:343
static constexpr unsigned s_index_id_col_no
Column number of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:373
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:558
static constexpr unsigned s_table_id_col_no
Column number of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:379
static constexpr unsigned s_space_id_col_no
Column number of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:361
dberr_t search_all(DDL_Records &records)
Do a reverse scan on the table to fetch all the record.
Definition: log0ddl.cc:627
dict_table_t * m_table
innodb_ddl_log table.
Definition: log0ddl.h:391
que_thr_t * m_thr
Dummy query thread.
Definition: log0ddl.h:400
dberr_t search_by_id(ulint id, dict_index_t *index, DDL_Records &records)
Search specified index by specified ID.
Definition: log0ddl.cc:687
static constexpr unsigned s_page_no_col_len
Column length of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:370
static constexpr unsigned s_space_id_col_len
Column length of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:364
static constexpr unsigned s_thread_id_col_no
Column number of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:349
static constexpr unsigned s_old_file_path_col_no
Column number of mysql.innodb_ddl_log.old_file_path.
Definition: log0ddl.h:385
ulint parse_id(const dict_index_t *index, rec_t *rec, const ulint *offsets)
Parse the index record and get 'ID'.
Definition: log0ddl.cc:547
static constexpr unsigned s_type_col_len
Column length of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:358
static constexpr unsigned s_id_col_len
Column length of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:346
static constexpr unsigned s_new_file_path_col_no
Column number of mysql.innodb_ddl_log.new_file_path.
Definition: log0ddl.h:388
dtuple_t * m_tuple
Tuple used for insert, search, delete operation.
Definition: log0ddl.h:394
dberr_t insert(const DDL_Record &record)
Insert the DDL log record into the innodb_ddl_log table.
Definition: log0ddl.cc:462
void stop_query_thread()
Stop the query thread.
Definition: log0ddl.cc:340
void create_tuple(const DDL_Record &record)
Create tuple for the innodb_ddl_log table.
Definition: log0ddl.cc:346
static constexpr unsigned s_type_col_no
Column number of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:355
trx_t * m_trx
Transaction used for insert, delete operation.
Definition: log0ddl.h:397
DDL_Log_Table()
Constructor.
Definition: log0ddl.cc:317
ulint fetch_value(const byte *data, ulint offset)
Fetch the value from given offset.
Definition: log0ddl.cc:603
~DDL_Log_Table()
Destructor.
Definition: log0ddl.cc:328
dberr_t remove(ulint id)
Delete the innodb_ddl_log record of specified ID.
Definition: log0ddl.cc:730
void start_query_thread()
Set the query thread using graph.
Definition: log0ddl.cc:333
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:522
DDL log record.
Definition: log0ddl.h:78
ulint m_id
Log id.
Definition: log0ddl.h:195
ulint m_thread_id
Thread id.
Definition: log0ddl.h:201
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:198
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:186
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:161
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:210
mem_heap_t * m_heap
memory heap object used for storing file name.
Definition: log0ddl.h:223
DDL_Record()
Constructor.
Definition: log0ddl.cc:149
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:217
space_id_t m_space_id
Tablespace id.
Definition: log0ddl.h:204
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:213
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:207
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:226
std::ostream & print(std::ostream &out) const
Print the DDL record to specified output stream.
Definition: log0ddl.cc:205
void set_old_file_path(const char *name)
Set the old file path from the name for the DDL log record.
Definition: log0ddl.cc:167
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:220
Progress
Encryption progress type.
Definition: os0enc.h:80
Class to write and replay ddl logs.
Definition: log0ddl.h:408
void replay_drop_log(const table_id_t table_id)
Replay DROP log.
Definition: log0ddl.cc:1804
dberr_t replay(DDL_Record &record)
Replay DDL log record.
Definition: log0ddl.cc:1576
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:1119
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:1722
~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:1156
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:1065
dberr_t post_ddl(THD *thd)
Replay and clean DDL logs after DDL transaction commints or rollbacks.
Definition: log0ddl.cc:1905
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:920
dberr_t recover()
Recover in server startup.
Definition: log0ddl.cc:1942
dberr_t delete_by_id(trx_t *trx, uint64_t id, bool dict_locked)
Delete log record by id.
Definition: log0ddl.cc:1442
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:853
Log_DDL()
Constructor.
Definition: log0ddl.cc:830
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:1167
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:1211
void replay_rename_table_log(const char *old_name, const char *new_name)
Relay RENAME TABLE log.
Definition: log0ddl.cc:1813
uint64_t next_id()
Get next autoinc counter by increasing 1 for innodb_ddl_log.
Definition: log0ddl.cc:835
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:1016
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:1258
bool skip(const dict_table_t *table, THD *thd)
Check if we need to skip ddl log for a table.
Definition: log0ddl.cc:847
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:1412
dberr_t replay_by_thread_id(ulint thread_id)
Scan, replay and delete log records by thread id.
Definition: log0ddl.cc:1506
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:1313
static bool is_in_recovery()
Is it in ddl recovery in server startup.
Definition: log0ddl.h:499
dberr_t delete_by_ids(DDL_Records &records)
Delete the log records present in the list.
Definition: log0ddl.cc:1539
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:1345
void replay_remove_cache_log(table_id_t table_id, const char *table_name)
Relay remove cache log.
Definition: log0ddl.cc:1873
void replay_delete_space_log(space_id_t space_id, const char *file_path)
Replay DELETE log(delete file if exist)
Definition: log0ddl.cc:1659
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:1283
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:961
dberr_t replay_alter_encrypt_space_log(DDL_Record &record)
Replay an ALTER ENCRYPT TABLESPACE log record.
Definition: log0ddl.cc:1777
dberr_t write_remove_cache_log(trx_t *trx, dict_table_t *table)
Write a REMOVE cache log record.
Definition: log0ddl.cc:1382
dberr_t replay_all()
Scan, replay and delete all log records.
Definition: log0ddl.cc:1474
static bool s_in_recovery
Whether in recover(replay) ddl log in startup.
Definition: log0ddl.h:648
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:1625
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
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:235
void ddl_log_close()
Close the DDL log system.
Definition: log0ddl.h:655
void ddl_log_crash_reset(THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
Reset all crash injection counters.
Definition: log0ddl.cc:126
bool innodb_ddl_log_crash_reset_debug
Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;.
Definition: log0ddl.cc:74
Log_DDL * log_ddl
Object to handle Log_DDL.
Definition: log0ddl.cc:62
static my_thread_id thread_id
Definition: my_thr_init.cc:63
static int record
Definition: mysqltest.cc:188
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:33
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:69
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510