MySQL 9.0.0
Source Code Documentation
DDTableBuffer Class Reference

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< byteget (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_tupdate_set_metadata (const dtuple_t *entry, const rec_t *rec)
 Prepare for a update on METADATA field. More...
 

Private Attributes

dict_index_tm_index
 The clustered index of this system table. More...
 
mem_heap_tm_dynamic_heap
 The heap used for dynamic allocations, which should always be freed before return. More...
 
mem_heap_tm_replace_heap
 The heap used during replace() operation, which should always be freed before return. More...
 
mem_heap_tm_heap
 The heap used to create the search tuple and replace tuple. More...
 
dtuple_tm_search_tuple
 The tuple used to search for specified table, it's protected by dict_persist->mutex. More...
 
dtuple_tm_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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DDTableBuffer()

DDTableBuffer::DDTableBuffer ( )

Default constructor.

◆ ~DDTableBuffer()

DDTableBuffer::~DDTableBuffer ( )

Destructor.

Member Function Documentation

◆ close()

void DDTableBuffer::close ( void  )
private

Free the things initialized in init()

◆ create_tuples()

void DDTableBuffer::create_tuples ( )
private

Create the search and replace tuples.

◆ get()

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_.

Parameters
[in]idtable id
[out]versiontable dynamic metadata version
Returns
the metadata saved in a vector object, if nothing, the vector would be empty

◆ init()

void DDTableBuffer::init ( void  )
private

Initialize m_index, the in-memory clustered index of the table and two tuples used in this class.

Initialize the in-memory index.

◆ init_tuple_with_id()

void DDTableBuffer::init_tuple_with_id ( dtuple_t tuple,
table_id_t  id 
)
private

Initialize the id field of tuple.

Parameters
[out]tuplethe tuple to be initialized
[in]idtable id

◆ open()

void DDTableBuffer::open ( )
private

Open the mysql.innodb_dynamic_metadata when DD is not fully up.

◆ remove()

dberr_t DDTableBuffer::remove ( table_id_t  id)

Remove the whole row for a specific table.

Parameters
[in]idtable id
Returns
DB_SUCCESS or error code

◆ replace()

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.

Parameters
[in]idtable id
[in]versiontable dynamic metadata version
[in]metadatathe metadata we want to replace
[in]lenthe metadata length
Returns
DB_SUCCESS or error code

◆ truncate()

void DDTableBuffer::truncate ( void  )

Truncate the table.

We can call it after all the dynamic metadata has been written back to DD table

◆ update_set_metadata()

upd_t * DDTableBuffer::update_set_metadata ( const dtuple_t entry,
const rec_t rec 
)
private

Prepare for a update on METADATA field.

Parameters
[in]entryclustered index entry to replace rec
[in]recclustered index record
Returns
update vector of differing fields without system columns, or NULL if there isn't any different field

Member Data Documentation

◆ m_dynamic_heap

mem_heap_t* DDTableBuffer::m_dynamic_heap
private

The heap used for dynamic allocations, which should always be freed before return.

◆ m_heap

mem_heap_t* DDTableBuffer::m_heap
private

The heap used to create the search tuple and replace tuple.

◆ m_index

dict_index_t* DDTableBuffer::m_index
private

The clustered index of this system table.

◆ m_replace_heap

mem_heap_t* DDTableBuffer::m_replace_heap
private

The heap used during replace() operation, which should always be freed before return.

◆ m_replace_tuple

dtuple_t* DDTableBuffer::m_replace_tuple
private

The tuple used to replace for specified table, it's protected by dict_persist->mutex.

◆ m_search_tuple

dtuple_t* DDTableBuffer::m_search_tuple
private

The tuple used to search for specified table, it's protected by dict_persist->mutex.

◆ METADATA_COL_NO

constexpr unsigned DDTableBuffer::METADATA_COL_NO = 2
staticconstexprprivate

Column number of mysql.innodb_dynamic_metadata.metadata.

◆ METADATA_FIELD_NO

constexpr unsigned DDTableBuffer::METADATA_FIELD_NO = METADATA_COL_NO + 2
staticconstexprprivate

Clustered index field number of mysql.innodb_dynamic_metadata.metadata Plusing 2 here skips the DATA_TRX_ID and DATA_ROLL_PTR fields.

◆ N_COLS

constexpr unsigned DDTableBuffer::N_COLS = N_USER_COLS + DATA_N_SYS_COLS
staticconstexprprivate

Number of columns.

◆ N_FIELDS

constexpr unsigned DDTableBuffer::N_FIELDS = METADATA_FIELD_NO + 1
staticconstexprprivate

Number of fields in the clustered index.

◆ N_USER_COLS

constexpr unsigned DDTableBuffer::N_USER_COLS = METADATA_COL_NO + 1
staticconstexprprivate

Number of user columns.

◆ TABLE_ID_COL_NO

constexpr unsigned DDTableBuffer::TABLE_ID_COL_NO = 0
staticconstexprprivate

Column number of mysql.innodb_dynamic_metadata.table_id.

◆ TABLE_ID_FIELD_NO

constexpr unsigned DDTableBuffer::TABLE_ID_FIELD_NO = TABLE_ID_COL_NO
staticconstexprprivate

Clustered index field number of mysql.innodb_dynamic_metadata.table_id.

◆ VERSION_COL_NO

constexpr unsigned DDTableBuffer::VERSION_COL_NO = 1
staticconstexprprivate

Column number of mysql.innodb_dynamic_metadata.version.

◆ VERSION_FIELD_NO

constexpr unsigned DDTableBuffer::VERSION_FIELD_NO = VERSION_COL_NO + 2
staticconstexprprivate

Clustered index field number of mysql.innodb_dynamic_metadata.version.


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