MySQL 8.0.40
Source Code Documentation
|
Wrapper for the mysql.innodb_dynamic_metadata used to buffer the persistent dynamic metadata. More...
#include <dict0dict.h>
Public Member Functions | |
DDTableBuffer () | |
Default constructor. More... | |
~DDTableBuffer () | |
Destructor. More... | |
dberr_t | replace (table_id_t id, uint64_t version, const byte *metadata, size_t len) |
Replace the dynamic metadata for a specific table. More... | |
dberr_t | remove (table_id_t id) |
Remove the whole row for a specific table. More... | |
void | truncate (void) |
Truncate the table. More... | |
std::vector< byte > | get (table_id_t id, uint64_t *version) |
Get the buffered metadata for a specific table, the caller has to delete the returned std::string object by ut::delete_. More... | |
Private Member Functions | |
void | init () |
Initialize m_index, the in-memory clustered index of the table and two tuples used in this class. More... | |
void | open () |
Open the mysql.innodb_dynamic_metadata when DD is not fully up. More... | |
void | create_tuples () |
Create the search and replace tuples. More... | |
void | init_tuple_with_id (dtuple_t *tuple, table_id_t id) |
Initialize the id field of tuple. More... | |
void | close () |
Free the things initialized in init() More... | |
upd_t * | update_set_metadata (const dtuple_t *entry, const rec_t *rec) |
Prepare for a update on METADATA field. More... | |
Private Attributes | |
dict_index_t * | m_index |
The clustered index of this system table. More... | |
mem_heap_t * | m_dynamic_heap |
The heap used for dynamic allocations, which should always be freed before return. More... | |
mem_heap_t * | m_replace_heap |
The heap used during replace() operation, which should always be freed before return. More... | |
mem_heap_t * | m_heap |
The heap used to create the search tuple and replace tuple. More... | |
dtuple_t * | m_search_tuple |
The tuple used to search for specified table, it's protected by dict_persist->mutex. More... | |
dtuple_t * | m_replace_tuple |
The tuple used to replace for specified table, it's protected by dict_persist->mutex. More... | |
Static Private Attributes | |
static constexpr unsigned | TABLE_ID_COL_NO = 0 |
Column number of mysql.innodb_dynamic_metadata.table_id. More... | |
static constexpr unsigned | VERSION_COL_NO = 1 |
Column number of mysql.innodb_dynamic_metadata.version. More... | |
static constexpr unsigned | METADATA_COL_NO = 2 |
Column number of mysql.innodb_dynamic_metadata.metadata. More... | |
static constexpr unsigned | N_USER_COLS = METADATA_COL_NO + 1 |
Number of user columns. More... | |
static constexpr unsigned | N_COLS = N_USER_COLS + DATA_N_SYS_COLS |
Number of columns. More... | |
static constexpr unsigned | TABLE_ID_FIELD_NO = TABLE_ID_COL_NO |
Clustered index field number of mysql.innodb_dynamic_metadata.table_id. More... | |
static constexpr unsigned | VERSION_FIELD_NO = VERSION_COL_NO + 2 |
Clustered index field number of mysql.innodb_dynamic_metadata.version. More... | |
static constexpr unsigned | METADATA_FIELD_NO = METADATA_COL_NO + 2 |
Clustered index field number of mysql.innodb_dynamic_metadata.metadata Plusing 2 here skips the DATA_TRX_ID and DATA_ROLL_PTR fields. More... | |
static constexpr unsigned | N_FIELDS = METADATA_FIELD_NO + 1 |
Number of fields in the clustered index. More... | |
Wrapper for the mysql.innodb_dynamic_metadata used to buffer the persistent dynamic metadata.
This should be a table with only clustered index, no delete-marked records, no locking, no undo logging, no purge, no adaptive hash index. We should always use low level btr functions to access and modify the table. Accessing this table should be protected by dict_sys->mutex
DDTableBuffer::DDTableBuffer | ( | ) |
Default constructor.
DDTableBuffer::~DDTableBuffer | ( | ) |
Destructor.
|
private |
Free the things initialized in init()
|
private |
Create the search and replace tuples.
std::vector< byte > DDTableBuffer::get | ( | table_id_t | id, |
uint64_t * | version | ||
) |
Get the buffered metadata for a specific table, the caller has to delete the returned std::string object by ut::delete_.
[in] | id | table id |
[out] | version | table dynamic metadata version |
|
private |
Initialize m_index, the in-memory clustered index of the table and two tuples used in this class.
Initialize the in-memory index.
|
private |
Initialize the id field of tuple.
[out] | tuple | the tuple to be initialized |
[in] | id | table id |
|
private |
Open the mysql.innodb_dynamic_metadata when DD is not fully up.
dberr_t DDTableBuffer::remove | ( | table_id_t | id | ) |
Remove the whole row for a specific table.
[in] | id | table id |
dberr_t DDTableBuffer::replace | ( | table_id_t | id, |
uint64_t | version, | ||
const byte * | metadata, | ||
size_t | len | ||
) |
Replace the dynamic metadata for a specific table.
[in] | id | table id |
[in] | version | table dynamic metadata version |
[in] | metadata | the metadata we want to replace |
[in] | len | the metadata length |
void DDTableBuffer::truncate | ( | void | ) |
Truncate the table.
We can call it after all the dynamic metadata has been written back to DD table
Prepare for a update on METADATA field.
[in] | entry | clustered index entry to replace rec |
[in] | rec | clustered index record |
|
private |
The heap used for dynamic allocations, which should always be freed before return.
|
private |
The heap used to create the search tuple and replace tuple.
|
private |
The clustered index of this system table.
|
private |
The heap used during replace() operation, which should always be freed before return.
|
private |
The tuple used to replace for specified table, it's protected by dict_persist->mutex.
|
private |
The tuple used to search for specified table, it's protected by dict_persist->mutex.
|
staticconstexprprivate |
Column number of mysql.innodb_dynamic_metadata.metadata.
|
staticconstexprprivate |
Clustered index field number of mysql.innodb_dynamic_metadata.metadata Plusing 2 here skips the DATA_TRX_ID and DATA_ROLL_PTR fields.
|
staticconstexprprivate |
Number of columns.
|
staticconstexprprivate |
Number of fields in the clustered index.
|
staticconstexprprivate |
Number of user columns.
|
staticconstexprprivate |
Column number of mysql.innodb_dynamic_metadata.table_id.
|
staticconstexprprivate |
Clustered index field number of mysql.innodb_dynamic_metadata.table_id.
|
staticconstexprprivate |
Column number of mysql.innodb_dynamic_metadata.version.
|
staticconstexprprivate |
Clustered index field number of mysql.innodb_dynamic_metadata.version.