196 std::ostream &
print(std::ostream &out)
const;
445 bool is_drop,
bool dict_locked);
453 const char *new_file_path);
482 const char *new_name);
496 const char *schema_directory_path,
497 const bool is_drop_schema);
564 const char *old_file_path,
565 const char *new_file_path);
572 const char *new_file_path);
613 const char *new_name);
642 const char *schema_directory_path);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
uint32_t page_no_t
Page number.
Definition: api0api.h:46
Wrapper of mysql.innodb_ddl_log table.
Definition: log0ddl.h:250
dberr_t search(ulint thread_id, DDL_Records &records)
Search for all records of specified thread_id.
Definition: log0ddl.cc:679
static constexpr unsigned s_page_no_col_no
Column number of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:378
static constexpr unsigned s_thread_id_col_len
Column length of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:363
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:415
static constexpr unsigned s_index_id_col_len
Column length of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:387
static constexpr unsigned s_table_id_col_len
Column length of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:393
static constexpr unsigned s_id_col_no
Column number of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:354
static constexpr unsigned s_index_id_col_no
Column number of mysql.innodb_ddl_log.index_id.
Definition: log0ddl.h:384
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:571
static constexpr unsigned s_table_id_col_no
Column number of mysql.innodb_ddl_log.table_id.
Definition: log0ddl.h:390
static constexpr unsigned s_space_id_col_no
Column number of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:372
dberr_t search_all(DDL_Records &records)
Do a reverse scan on the table to fetch all the record.
Definition: log0ddl.cc:640
dict_table_t * m_table
innodb_ddl_log table.
Definition: log0ddl.h:402
que_thr_t * m_thr
Dummy query thread.
Definition: log0ddl.h:411
dberr_t search_by_id(ulint id, dict_index_t *index, DDL_Records &records)
Search specified index by specified ID.
Definition: log0ddl.cc:700
static constexpr unsigned s_page_no_col_len
Column length of mysql.innodb_ddl_log.page_no.
Definition: log0ddl.h:381
static constexpr unsigned s_space_id_col_len
Column length of mysql.innodb_ddl_log.space_id.
Definition: log0ddl.h:375
static constexpr unsigned s_thread_id_col_no
Column number of mysql.innodb_ddl_log.thread_id.
Definition: log0ddl.h:360
static constexpr unsigned s_old_file_path_col_no
Column number of mysql.innodb_ddl_log.old_file_path.
Definition: log0ddl.h:396
ulint parse_id(const dict_index_t *index, rec_t *rec, const ulint *offsets)
Parse the index record and get 'ID'.
Definition: log0ddl.cc:560
static constexpr unsigned s_type_col_len
Column length of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:369
static constexpr unsigned s_id_col_len
Column length of mysql.innodb_ddl_log.id.
Definition: log0ddl.h:357
static constexpr unsigned s_new_file_path_col_no
Column number of mysql.innodb_ddl_log.new_file_path.
Definition: log0ddl.h:399
dtuple_t * m_tuple
Tuple used for insert, search, delete operation.
Definition: log0ddl.h:405
dberr_t insert(const DDL_Record &record)
Insert the DDL log record into the innodb_ddl_log table.
Definition: log0ddl.cc:474
void stop_query_thread()
Stop the query thread.
Definition: log0ddl.cc:352
void create_tuple(const DDL_Record &record)
Create tuple for the innodb_ddl_log table.
Definition: log0ddl.cc:358
static constexpr unsigned s_type_col_no
Column number of mysql.innodb_ddl_log.type.
Definition: log0ddl.h:366
trx_t * m_trx
Transaction used for insert, delete operation.
Definition: log0ddl.h:408
DDL_Log_Table()
Constructor.
Definition: log0ddl.cc:329
ulint fetch_value(const byte *data, ulint offset)
Fetch the value from given offset.
Definition: log0ddl.cc:616
~DDL_Log_Table()
Destructor.
Definition: log0ddl.cc:340
dberr_t remove(ulint id)
Delete the innodb_ddl_log record of specified ID.
Definition: log0ddl.cc:743
void start_query_thread()
Set the query thread using graph.
Definition: log0ddl.cc:345
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:535
DDL log record.
Definition: log0ddl.h:81
ulint m_id
Log id.
Definition: log0ddl.h:200
ulint m_thread_id
Thread id.
Definition: log0ddl.h:206
const char * get_new_file_path() const
Get the new file path/name present in the DDL log record.
Definition: log0ddl.h:180
Log_Type m_type
Log type.
Definition: log0ddl.h:203
Log_Type get_type() const
Get the type of operation to perform for the DDL log record.
Definition: log0ddl.h:100
page_no_t get_page_no() const
Get the page no present in the DDL log record.
Definition: log0ddl.h:124
void set_new_file_path(const char *name)
Set the new file path/name for the DDL log record.
Definition: log0ddl.cc:193
void set_index_id(ulint index_id)
Set the index id for the DDL log record.
Definition: log0ddl.h:136
table_id_t get_table_id() const
Get the table id present in the DDL log record.
Definition: log0ddl.h:140
void set_table_id(table_id_t table_id)
Set the table if for the DDL log record.
Definition: log0ddl.h:144
space_id_t get_space_id() const
Get the space_id present in the DDL log record.
Definition: log0ddl.h:116
void set_page_no(page_no_t page_no)
Set the page number for the DDL log record.
Definition: log0ddl.h:128
Encryption::Progress get_encryption_type() const
Get encryption operation type.
Definition: log0ddl.h:155
~DDL_Record()
Destructor.
Definition: log0ddl.cc:168
void set_type(Log_Type type)
Set the type for the DDL log record.
Definition: log0ddl.h:104
ulint get_id() const
Get the id of the DDL log record.
Definition: log0ddl.h:91
ulint m_index_id
Index id.
Definition: log0ddl.h:215
mem_heap_t * m_heap
memory heap object used for storing file name.
Definition: log0ddl.h:228
DDL_Record()
Constructor.
Definition: log0ddl.cc:156
bool get_deletable() const
If this record can be deleted.
Definition: log0ddl.h:152
char * m_old_file_path
Tablespace file path for DELETE, Old tablespace file path for RENAME.
Definition: log0ddl.h:222
bool validate() const
Definition: log0ddl.h:234
space_id_t m_space_id
Tablespace id.
Definition: log0ddl.h:209
void set_deletable(bool deletable)
Set deletability of this record.
Definition: log0ddl.h:148
table_id_t m_table_id
Table id.
Definition: log0ddl.h:218
void set_id(ulint id)
Set the id for the DDL log record.
Definition: log0ddl.h:95
page_no_t m_page_no
Index root page.
Definition: log0ddl.h:212
ulint get_index_id() const
Get the index id present in the DDL log record.
Definition: log0ddl.h:132
void set_thread_id(ulint thread_id)
Set the thread id for the DDL log record.
Definition: log0ddl.h:112
void set_space_id(space_id_t space)
Set the space id for the DDL log record.
Definition: log0ddl.h:120
const char * get_old_file_path() const
Get the old file path/name present in the DDL log record.
Definition: log0ddl.h:167
bool m_deletable
If this record can be deleted.
Definition: log0ddl.h:231
std::ostream & print(std::ostream &out) const
Print the DDL record to specified output stream.
Definition: log0ddl.cc:212
void set_old_file_path(const char *name)
Set the old file path from the name for the DDL log record.
Definition: log0ddl.cc:174
ulint get_thread_id() const
Get the thread id for the DDL log record.
Definition: log0ddl.h:108
char * m_new_file_path
New tablespace file name for RENAME.
Definition: log0ddl.h:225
Progress
Encryption progress type.
Definition: os0enc.h:80
Class to write and replay ddl logs.
Definition: log0ddl.h:419
void replay_drop_log(const table_id_t table_id)
Replay DROP log.
Definition: log0ddl.cc:1953
dberr_t replay(DDL_Record &record)
Replay DDL log record.
Definition: log0ddl.cc:1721
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:1234
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:1871
~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:1271
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:1180
dberr_t post_ddl(THD *thd)
Replay and clean DDL logs after DDL transaction commints or rollbacks.
Definition: log0ddl.cc:2054
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:1035
dberr_t recover()
Recover in server startup.
Definition: log0ddl.cc:2091
dberr_t delete_by_id(trx_t *trx, uint64_t id, bool dict_locked)
Delete log record by id.
Definition: log0ddl.cc:1557
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:968
Log_DDL()
Constructor.
Definition: log0ddl.cc:843
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:1282
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:1326
dberr_t replay_delete_schema_directory_log(const char *schema_directory_path)
Replay a DELETE_SCHEMA_DIRECTORY_LOG.
Definition: log0ddl.cc:935
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:899
void replay_rename_table_log(const char *old_name, const char *new_name)
Relay RENAME TABLE log.
Definition: log0ddl.cc:1962
uint64_t next_id()
Get next autoinc counter by increasing 1 for innodb_ddl_log.
Definition: log0ddl.cc:848
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:1131
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:1373
bool skip(const dict_table_t *table, THD *thd)
Check if we need to skip ddl log for a table.
Definition: log0ddl.cc:860
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:1527
dberr_t replay_by_thread_id(ulint thread_id)
Scan, replay and delete log records by thread id.
Definition: log0ddl.cc:1626
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:1428
static bool is_in_recovery()
Is it in ddl recovery in server startup.
Definition: log0ddl.h:519
dberr_t delete_by_ids(DDL_Records &records)
Delete the log records present in the list.
Definition: log0ddl.cc:1684
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:1460
void replay_remove_cache_log(table_id_t table_id, const char *table_name)
Relay remove cache log.
Definition: log0ddl.cc:2022
void replay_delete_space_log(space_id_t space_id, const char *file_path)
Replay DELETE log(delete file if exist)
Definition: log0ddl.cc:1808
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:1398
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:1076
dberr_t replay_alter_encrypt_space_log(DDL_Record &record)
Replay an ALTER ENCRYPT TABLESPACE log record.
Definition: log0ddl.cc:1926
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:866
dberr_t write_remove_cache_log(trx_t *trx, dict_table_t *table)
Write a REMOVE cache log record.
Definition: log0ddl.cc:1497
dberr_t replay_all()
Scan, replay and delete all log records.
Definition: log0ddl.cc:1589
static bool s_in_recovery
Whether in recover(replay) ddl log in startup.
Definition: log0ddl.h:683
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:1774
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.
@ 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:246
void ddl_log_close()
Close the DDL log system.
Definition: log0ddl.h:690
void ddl_log_crash_reset(THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
Reset all crash injection counters.
Definition: log0ddl.cc:132
bool innodb_ddl_log_crash_reset_debug
Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;.
Definition: log0ddl.cc:77
Log_DDL * log_ddl
Object to handle Log_DDL.
Definition: log0ddl.cc:65
static my_thread_id thread_id
Definition: my_thr_init.cc:63
static int record
Definition: mysqltest.cc:193
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:811
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:1041
Data structure for a database table.
Definition: dict0mem.h:1904
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Definition: que0que.h:242
Definition: trx0trx.h:675
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