199 std::ostream &
print(std::ostream &out)
const;
448 bool is_drop,
bool dict_locked);
456 const char *new_file_path);
485 const char *new_name);
499 const char *schema_directory_path,
500 const bool is_drop_schema);
567 const char *old_file_path,
568 const char *new_file_path);
575 const char *new_file_path);
616 const char *new_name);
645 const char *schema_directory_path);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:49
uint32_t page_no_t
Page number.
Definition: api0api.h:47
Wrapper of mysql.innodb_ddl_log table.
Definition: log0ddl.h:253
dberr_t search(ulint thread_id, DDL_Records &records)
Search for all records of specified thread_id.
Definition: log0ddl.cc:681
static constexpr unsigned s_page_no_col_no
Column number of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:381
static constexpr unsigned s_thread_id_col_len
Column length of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:366
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:418
static constexpr unsigned s_index_id_col_len
Column length of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:390
static constexpr unsigned s_table_id_col_len
Column length of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:396
static constexpr unsigned s_id_col_no
Column number of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:357
static constexpr unsigned s_index_id_col_no
Column number of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:387
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:573
static constexpr unsigned s_table_id_col_no
Column number of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:393
static constexpr unsigned s_space_id_col_no
Column number of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:375
dberr_t search_all(DDL_Records &records)
Do a reverse scan on the table to fetch all the record.
Definition: log0ddl.cc:642
dict_table_t * m_table
innodb_ddl_log table.
Definition: log0ddl.h:405
que_thr_t * m_thr
Dummy query thread.
Definition: log0ddl.h:414
dberr_t search_by_id(ulint id, dict_index_t *index, DDL_Records &records)
Search specified index by specified ID.
Definition: log0ddl.cc:702
static constexpr unsigned s_page_no_col_len
Column length of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:384
static constexpr unsigned s_space_id_col_len
Column length of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:378
static constexpr unsigned s_thread_id_col_no
Column number of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:363
static constexpr unsigned s_old_file_path_col_no
Column number of mysql.innodb_ddl_log.old_file_path.
Definition: log0ddl.h:399
ulint parse_id(const dict_index_t *index, rec_t *rec, const ulint *offsets)
Parse the index record and get 'ID'.
Definition: log0ddl.cc:562
static constexpr unsigned s_type_col_len
Column length of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:372
static constexpr unsigned s_id_col_len
Column length of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:360
static constexpr unsigned s_new_file_path_col_no
Column number of mysql.innodb_ddl_log.new_file_path.
Definition: log0ddl.h:402
dtuple_t * m_tuple
Tuple used for insert, search, delete operation.
Definition: log0ddl.h:408
dberr_t insert(const DDL_Record &record)
Insert the DDL log record into the innodb_ddl_log table.
Definition: log0ddl.cc:476
void stop_query_thread()
Stop the query thread.
Definition: log0ddl.cc:354
void create_tuple(const DDL_Record &record)
Create tuple for the innodb_ddl_log table.
Definition: log0ddl.cc:360
static constexpr unsigned s_type_col_no
Column number of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:369
trx_t * m_trx
Transaction used for insert, delete operation.
Definition: log0ddl.h:411
DDL_Log_Table()
Constructor.
Definition: log0ddl.cc:331
ulint fetch_value(const byte *data, ulint offset)
Fetch the value from given offset.
Definition: log0ddl.cc:618
~DDL_Log_Table()
Destructor.
Definition: log0ddl.cc:342
dberr_t remove(ulint id)
Delete the innodb_ddl_log record of specified ID.
Definition: log0ddl.cc:745
void start_query_thread()
Set the query thread using graph.
Definition: log0ddl.cc:347
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:537
DDL log record.
Definition: log0ddl.h:84
ulint m_id
Log id.
Definition: log0ddl.h:203
ulint m_thread_id
Thread id.
Definition: log0ddl.h:209
const char * get_new_file_path() const
Get the new file path/name present in the DDL log record.
Definition: log0ddl.h:183
Log_Type m_type
Log type.
Definition: log0ddl.h:206
Log_Type get_type() const
Get the type of operation to perform for the DDL log record.
Definition: log0ddl.h:103
page_no_t get_page_no() const
Get the page no present in the DDL log record.
Definition: log0ddl.h:127
void set_new_file_path(const char *name)
Set the new file path/name for the DDL log record.
Definition: log0ddl.cc:195
void set_index_id(ulint index_id)
Set the index id for the DDL log record.
Definition: log0ddl.h:139
table_id_t get_table_id() const
Get the table id present in the DDL log record.
Definition: log0ddl.h:143
void set_table_id(table_id_t table_id)
Set the table if for the DDL log record.
Definition: log0ddl.h:147
space_id_t get_space_id() const
Get the space_id present in the DDL log record.
Definition: log0ddl.h:119
void set_page_no(page_no_t page_no)
Set the page number for the DDL log record.
Definition: log0ddl.h:131
Encryption::Progress get_encryption_type() const
Get encryption operation type.
Definition: log0ddl.h:158
~DDL_Record()
Destructor.
Definition: log0ddl.cc:170
void set_type(Log_Type type)
Set the type for the DDL log record.
Definition: log0ddl.h:107
ulint get_id() const
Get the id of the DDL log record.
Definition: log0ddl.h:94
ulint m_index_id
Index id.
Definition: log0ddl.h:218
mem_heap_t * m_heap
memory heap object used for storing file name.
Definition: log0ddl.h:231
DDL_Record()
Constructor.
Definition: log0ddl.cc:158
bool get_deletable() const
If this record can be deleted.
Definition: log0ddl.h:155
char * m_old_file_path
Tablespace file path for DELETE, Old tablespace file path for RENAME.
Definition: log0ddl.h:225
bool validate() const
Definition: log0ddl.h:237
space_id_t m_space_id
Tablespace id.
Definition: log0ddl.h:212
void set_deletable(bool deletable)
Set deletability of this record.
Definition: log0ddl.h:151
table_id_t m_table_id
Table id.
Definition: log0ddl.h:221
void set_id(ulint id)
Set the id for the DDL log record.
Definition: log0ddl.h:98
page_no_t m_page_no
Index root page.
Definition: log0ddl.h:215
ulint get_index_id() const
Get the index id present in the DDL log record.
Definition: log0ddl.h:135
void set_thread_id(ulint thread_id)
Set the thread id for the DDL log record.
Definition: log0ddl.h:115
void set_space_id(space_id_t space)
Set the space id for the DDL log record.
Definition: log0ddl.h:123
const char * get_old_file_path() const
Get the old file path/name present in the DDL log record.
Definition: log0ddl.h:170
bool m_deletable
If this record can be deleted.
Definition: log0ddl.h:234
std::ostream & print(std::ostream &out) const
Print the DDL record to specified output stream.
Definition: log0ddl.cc:214
void set_old_file_path(const char *name)
Set the old file path from the name for the DDL log record.
Definition: log0ddl.cc:176
ulint get_thread_id() const
Get the thread id for the DDL log record.
Definition: log0ddl.h:111
char * m_new_file_path
New tablespace file name for RENAME.
Definition: log0ddl.h:228
Progress
Encryption progress type.
Definition: os0enc.h:80
Class to write and replay ddl logs.
Definition: log0ddl.h:422
void replay_drop_log(const table_id_t table_id)
Replay DROP log.
Definition: log0ddl.cc:1943
dberr_t replay(DDL_Record &record)
Replay DDL log record.
Definition: log0ddl.cc:1727
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:1239
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:1875
~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:1276
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:1185
dberr_t post_ddl(THD *thd)
Replay and clean DDL logs after DDL transaction commints or rollbacks.
Definition: log0ddl.cc:2043
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:1040
dberr_t recover()
Recover in server startup.
Definition: log0ddl.cc:2080
dberr_t delete_by_id(trx_t *trx, uint64_t id, bool dict_locked)
Delete log record by id.
Definition: log0ddl.cc:1562
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:971
Log_DDL()
Constructor.
Definition: log0ddl.cc:845
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:1287
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:1331
dberr_t replay_delete_schema_directory_log(const char *schema_directory_path)
Replay a DELETE_SCHEMA_DIRECTORY_LOG.
Definition: log0ddl.cc:938
dberr_t insert_delete_schema_directory_log(trx_t *trx, uint64_t id, ulint thread_id, const char *schema_directory_path)
Insert a DELETE_SCHEMA_DIRECTORY_LOG.
Definition: log0ddl.cc:902
void replay_rename_table_log(const char *old_name, const char *new_name)
Relay RENAME TABLE log.
Definition: log0ddl.cc:1952
uint64_t next_id()
Get next autoinc counter by increasing 1 for innodb_ddl_log.
Definition: log0ddl.cc:850
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:1136
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:1378
bool skip(const dict_table_t *table, THD *thd)
Check if we need to skip ddl log for a table.
Definition: log0ddl.cc:862
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:1532
dberr_t replay_by_thread_id(ulint thread_id)
Scan, replay and delete log records by thread id.
Definition: log0ddl.cc:1632
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:1433
static bool is_in_recovery()
Is it in ddl recovery in server startup.
Definition: log0ddl.h:522
dberr_t delete_by_ids(DDL_Records &records)
Delete the log records present in the list.
Definition: log0ddl.cc:1690
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:1465
void replay_remove_cache_log(table_id_t table_id, const char *table_name)
Relay remove cache log.
Definition: log0ddl.cc:2011
void replay_delete_space_log(space_id_t space_id, const char *file_path)
Replay DELETE log(delete file if exist)
Definition: log0ddl.cc:1814
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:1403
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:1081
dberr_t replay_alter_encrypt_space_log(DDL_Record &record)
Replay an ALTER ENCRYPT TABLESPACE log record.
Definition: log0ddl.cc:1916
dberr_t write_delete_schema_directory_log(trx_t *trx, const char *schema_directory_path, const bool is_drop_schema)
Write a DELETE_SCHEMA_DIRECTORY_LOG.
Definition: log0ddl.cc:869
dberr_t write_remove_cache_log(trx_t *trx, dict_table_t *table)
Write a REMOVE cache log record.
Definition: log0ddl.cc:1502
dberr_t replay_all()
Scan, replay and delete all log records.
Definition: log0ddl.cc:1594
static bool s_in_recovery
Whether in recover(replay) ddl log in startup.
Definition: log0ddl.h:686
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:1780
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
Data dictionary global types.
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:216
Log_Type
DDL log types defined as uint32_t because it costs 4 bytes in mysql.innodb_ddl_log.
Definition: log0ddl.h:48
@ 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.
@ DELETE_SCHEMA_DIRECTORY_LOG
For Atomic DROP/CREATE SCHEMA implementation.
@ 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:249
void ddl_log_close()
Close the DDL log system.
Definition: log0ddl.h:693
void ddl_log_crash_reset(THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
Reset all crash injection counters.
Definition: log0ddl.cc:134
bool innodb_ddl_log_crash_reset_debug
Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;.
Definition: log0ddl.cc:79
Log_DDL * log_ddl
Object to handle Log_DDL.
Definition: log0ddl.cc:67
static my_thread_id thread_id
Definition: my_thr_init.cc:60
static int record
Definition: mysqltest.cc:195
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
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:651
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
Definition: system_variables_bits.h:153
Data structure for an index.
Definition: dict0mem.h:1069
Data structure for a database table.
Definition: dict0mem.h:1927
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:706
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:295
Definition: que0que.h:242
Definition: trx0trx.h:670
unsigned long int ulint
Definition: univ.i:403
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:97
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510