MySQL 8.0.40
Source Code Documentation
DDL_Log_Table Class Reference

Wrapper of mysql.innodb_ddl_log table. More...

#include <log0ddl.h>

Public Member Functions

 DDL_Log_Table ()
 Constructor. More...
 
 DDL_Log_Table (trx_t *trx)
 Constructor and it initializes transaction and query thread. More...
 
 ~DDL_Log_Table ()
 Destructor. More...
 
dberr_t insert (const DDL_Record &record)
 Insert the DDL log record into the innodb_ddl_log table. More...
 
dberr_t search (ulint thread_id, DDL_Records &records)
 Search for all records of specified thread_id. More...
 
dberr_t search_all (DDL_Records &records)
 Do a reverse scan on the table to fetch all the record. More...
 
dberr_t remove (ulint id)
 Delete the innodb_ddl_log record of specified ID. More...
 
dberr_t remove (const DDL_Records &records)
 Delete specified DDL_Records from innodb_ddl_log. More...
 

Private Member Functions

void start_query_thread ()
 Set the query thread using graph. More...
 
void stop_query_thread ()
 Stop the query thread. More...
 
void create_tuple (const DDL_Record &record)
 Create tuple for the innodb_ddl_log table. More...
 
void create_tuple (ulint id, const dict_index_t *index)
 Create tuple for the given index. More...
 
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. More...
 
ulint parse_id (const dict_index_t *index, rec_t *rec, const ulint *offsets)
 Parse the index record and get 'ID'. More...
 
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. More...
 
ulint fetch_value (const byte *data, ulint offset)
 Fetch the value from given offset. More...
 
dberr_t search_by_id (ulint id, dict_index_t *index, DDL_Records &records)
 Search specified index by specified ID. More...
 

Private Attributes

dict_table_tm_table
 innodb_ddl_log table. More...
 
dtuple_tm_tuple
 Tuple used for insert, search, delete operation. More...
 
trx_tm_trx
 Transaction used for insert, delete operation. More...
 
que_thr_tm_thr
 Dummy query thread. More...
 
mem_heap_tm_heap
 Heap to store the m_tuple, m_thr and all operation on mysql.innodb_ddl_log table. More...
 

Static Private Attributes

static constexpr unsigned s_id_col_no = 0
 Column number of mysql.innodb_ddl_log.id. More...
 
static constexpr unsigned s_id_col_len = 8
 Column length of mysql.innodb_ddl_log.id. More...
 
static constexpr unsigned s_thread_id_col_no = 1
 Column number of mysql.innodb_ddl_log.thread_id. More...
 
static constexpr unsigned s_thread_id_col_len = 8
 Column length of mysql.innodb_ddl_log.thread_id. More...
 
static constexpr unsigned s_type_col_no = 2
 Column number of mysql.innodb_ddl_log.type. More...
 
static constexpr unsigned s_type_col_len = 4
 Column length of mysql.innodb_ddl_log.type. More...
 
static constexpr unsigned s_space_id_col_no = 3
 Column number of mysql.innodb_ddl_log.space_id. More...
 
static constexpr unsigned s_space_id_col_len = 4
 Column length of mysql.innodb_ddl_log.space_id. More...
 
static constexpr unsigned s_page_no_col_no = 4
 Column number of mysql.innodb_ddl_log.page_no. More...
 
static constexpr unsigned s_page_no_col_len = 4
 Column length of mysql.innodb_ddl_log.page_no. More...
 
static constexpr unsigned s_index_id_col_no = 5
 Column number of mysql.innodb_ddl_log.index_id. More...
 
static constexpr unsigned s_index_id_col_len = 8
 Column length of mysql.innodb_ddl_log.index_id. More...
 
static constexpr unsigned s_table_id_col_no = 6
 Column number of mysql.innodb_ddl_log.table_id. More...
 
static constexpr unsigned s_table_id_col_len = 8
 Column length of mysql.innodb_ddl_log.table_id. More...
 
static constexpr unsigned s_old_file_path_col_no = 7
 Column number of mysql.innodb_ddl_log.old_file_path. More...
 
static constexpr unsigned s_new_file_path_col_no = 8
 Column number of mysql.innodb_ddl_log.new_file_path. More...
 

Detailed Description

Wrapper of mysql.innodb_ddl_log table.

Accessing to this table doesn't require row lock because thread could only access/modify its own ddl records.

Constructor & Destructor Documentation

◆ DDL_Log_Table() [1/2]

DDL_Log_Table::DDL_Log_Table ( )

Constructor.

◆ DDL_Log_Table() [2/2]

DDL_Log_Table::DDL_Log_Table ( trx_t trx)
explicit

Constructor and it initializes transaction and query thread.

Once trx is passed in, make sure destructor is called before the trx commits.

Parameters
[in,out]trxTransaction

◆ ~DDL_Log_Table()

DDL_Log_Table::~DDL_Log_Table ( )

Destructor.

Member Function Documentation

◆ convert_to_ddl_record()

void DDL_Log_Table::convert_to_ddl_record ( bool  is_clustered,
rec_t rec,
const ulint offsets,
DDL_Record record 
)
private

Convert the innodb_ddl_log index record to DDL_Record.

Parameters
[in]is_clusteredtrue if this is clustered index record, otherwise the secondary index record
[in]recindex record
[in]offsetsindex record offset
[in,out]recordto store the innodb_ddl_log record.

◆ create_tuple() [1/2]

void DDL_Log_Table::create_tuple ( const DDL_Record record)
private

Create tuple for the innodb_ddl_log table.

It is used for insert operation.

Parameters
[in]recordDDL log record.

◆ create_tuple() [2/2]

void DDL_Log_Table::create_tuple ( ulint  id,
const dict_index_t index 
)
private

Create tuple for the given index.

Used for search by id (and following delete)

Parameters
[in]idThread id/ id of the record
[in]indexClustered index or secondary index.

◆ fetch_value()

ulint DDL_Log_Table::fetch_value ( const byte data,
ulint  offset 
)
private

Fetch the value from given offset.

Parameters
[in]datavalue to be retrieved from data
[in]offsetoffset of the column
Returns
value of the given offset.

◆ insert()

dberr_t DDL_Log_Table::insert ( const DDL_Record record)

Insert the DDL log record into the innodb_ddl_log table.

This is thread safe.

Parameters
[in]recordRecord to be inserted.
Returns
DB_SUCCESS or error.

◆ parse_id()

ulint DDL_Log_Table::parse_id ( const dict_index_t index,
rec_t rec,
const ulint offsets 
)
private

Parse the index record and get 'ID'.

Parameters
[in]indexindex where the record resides
[in]recindex rec
[in]offsetsoffsets of the index.
Returns
id of the record.

◆ remove() [1/2]

dberr_t DDL_Log_Table::remove ( const DDL_Records records)

Delete specified DDL_Records from innodb_ddl_log.

This is thread safe. Different threads have their own ddl records to delete. And this could be called during recovery.

Parameters
[in]recordsDDL_Record(s) to be deleted
Returns
DB_SUCCESS or error.

◆ remove() [2/2]

dberr_t DDL_Log_Table::remove ( ulint  id)

Delete the innodb_ddl_log record of specified ID.

This is thread safe. One thread will only remove its ddl record.

Parameters
[in]idID of the DDL_Record
Returns
DB_SUCCESS or error.

◆ search()

dberr_t DDL_Log_Table::search ( ulint  thread_id,
DDL_Records records 
)

Search for all records of specified thread_id.

The records are kept in reverse order. This is thread safe. Because different threads have different thread ids, there should not be any conflict with update.

Parameters
[in]thread_idthread id to search
[out]recordsDDL_Records of the specified thread id
Returns
DB_SUCCESS or error.

◆ search_all()

dberr_t DDL_Log_Table::search_all ( DDL_Records records)

Do a reverse scan on the table to fetch all the record.

This is only called during recovery

Parameters
[out]recordsDDL_Records of the whole table
Returns
DB_SUCCESS or error.

Scan the index in decreasing order.

◆ search_by_id()

dberr_t DDL_Log_Table::search_by_id ( ulint  id,
dict_index_t index,
DDL_Records records 
)
private

Search specified index by specified ID.

Parameters
[in]idID to search
[in]indexindex to search
[in,out]recordsDDL_Record(s) got by the search
Returns
DB_SUCCESS or error

◆ set_field()

void DDL_Log_Table::set_field ( const byte data,
ulint  offset,
ulint  len,
DDL_Record record 
)
private

Set the given field of the innodb_ddl_log record from given data.

Parameters
[in]datadata to be set
[in]offsetcolumn of the ddl record
[in]lenlength of the data
[in,out]recordDDL_Record to set

◆ start_query_thread()

void DDL_Log_Table::start_query_thread ( )
private

Set the query thread using graph.

◆ stop_query_thread()

void DDL_Log_Table::stop_query_thread ( )
private

Stop the query thread.

Member Data Documentation

◆ m_heap

mem_heap_t* DDL_Log_Table::m_heap
private

Heap to store the m_tuple, m_thr and all operation on mysql.innodb_ddl_log table.

◆ m_table

dict_table_t* DDL_Log_Table::m_table
private

innodb_ddl_log table.

◆ m_thr

que_thr_t* DDL_Log_Table::m_thr
private

Dummy query thread.

◆ m_trx

trx_t* DDL_Log_Table::m_trx
private

Transaction used for insert, delete operation.

◆ m_tuple

dtuple_t* DDL_Log_Table::m_tuple
private

Tuple used for insert, search, delete operation.

◆ s_id_col_len

constexpr unsigned DDL_Log_Table::s_id_col_len = 8
staticconstexprprivate

Column length of mysql.innodb_ddl_log.id.

◆ s_id_col_no

constexpr unsigned DDL_Log_Table::s_id_col_no = 0
staticconstexprprivate

Column number of mysql.innodb_ddl_log.id.

◆ s_index_id_col_len

constexpr unsigned DDL_Log_Table::s_index_id_col_len = 8
staticconstexprprivate

Column length of mysql.innodb_ddl_log.index_id.

◆ s_index_id_col_no

constexpr unsigned DDL_Log_Table::s_index_id_col_no = 5
staticconstexprprivate

Column number of mysql.innodb_ddl_log.index_id.

◆ s_new_file_path_col_no

constexpr unsigned DDL_Log_Table::s_new_file_path_col_no = 8
staticconstexprprivate

Column number of mysql.innodb_ddl_log.new_file_path.

◆ s_old_file_path_col_no

constexpr unsigned DDL_Log_Table::s_old_file_path_col_no = 7
staticconstexprprivate

Column number of mysql.innodb_ddl_log.old_file_path.

◆ s_page_no_col_len

constexpr unsigned DDL_Log_Table::s_page_no_col_len = 4
staticconstexprprivate

Column length of mysql.innodb_ddl_log.page_no.

◆ s_page_no_col_no

constexpr unsigned DDL_Log_Table::s_page_no_col_no = 4
staticconstexprprivate

Column number of mysql.innodb_ddl_log.page_no.

◆ s_space_id_col_len

constexpr unsigned DDL_Log_Table::s_space_id_col_len = 4
staticconstexprprivate

Column length of mysql.innodb_ddl_log.space_id.

◆ s_space_id_col_no

constexpr unsigned DDL_Log_Table::s_space_id_col_no = 3
staticconstexprprivate

Column number of mysql.innodb_ddl_log.space_id.

◆ s_table_id_col_len

constexpr unsigned DDL_Log_Table::s_table_id_col_len = 8
staticconstexprprivate

Column length of mysql.innodb_ddl_log.table_id.

◆ s_table_id_col_no

constexpr unsigned DDL_Log_Table::s_table_id_col_no = 6
staticconstexprprivate

Column number of mysql.innodb_ddl_log.table_id.

◆ s_thread_id_col_len

constexpr unsigned DDL_Log_Table::s_thread_id_col_len = 8
staticconstexprprivate

Column length of mysql.innodb_ddl_log.thread_id.

◆ s_thread_id_col_no

constexpr unsigned DDL_Log_Table::s_thread_id_col_no = 1
staticconstexprprivate

Column number of mysql.innodb_ddl_log.thread_id.

◆ s_type_col_len

constexpr unsigned DDL_Log_Table::s_type_col_len = 4
staticconstexprprivate

Column length of mysql.innodb_ddl_log.type.

◆ s_type_col_no

constexpr unsigned DDL_Log_Table::s_type_col_no = 2
staticconstexprprivate

Column number of mysql.innodb_ddl_log.type.


The documentation for this class was generated from the following files: