MySQL 8.0.39
Source Code Documentation
dict_table_t Struct Reference

Data structure for a database table. More...

#include <dict0mem.h>

Public Member Functions

bool is_compressed () const
 Check if the table is compressed. More...
 
uint64_t get_ref_count () const
 Get reference count. More...
 
void acquire ()
 Acquire the table handle. More...
 
void acquire_with_lock ()
 Acquire the table handle, with lock() and unlock() the table. More...
 
void release ()
 Release the table handle. More...
 
void lock ()
 Lock the table handle. More...
 
void unlock ()
 Unlock the table handle. More...
 
void get_table_name (std::string &schema, std::string &table) const
 Get schema and table name in system character set. More...
 
bool is_system_schema () const
 
 UT_LIST_BASE_NODE_T (dict_index_t, indexes) indexes
 List of indexes of the table. More...
 
 UT_LIST_NODE_T (dict_table_t) table_LRU
 Node of the LRU list of tables. More...
 
 UT_LIST_NODE_T (dict_table_t) dirty_dict_tables
 Node of the dirty table list of tables, which is protected by dict_persist->mutex. More...
 
const dict_index_tfirst_index () const
 
dict_index_tfirst_index ()
 
bool has_row_versions () const
 
bool has_instant_cols () const
 
void set_instant_cols (uint16_t n_inst_cols)
 Set the number of columns when the first instant ADD COLUMN happens. More...
 
uint16_t get_instant_cols () const
 Get the number of user columns when the first instant ADD COLUMN happens. More...
 
size_t get_n_instant_added_col_v1 () const
 
uint32_t get_n_instant_add_cols () const
 Get number of columns added instantly. More...
 
uint32_t get_n_instant_drop_cols () const
 Get number of columns dropped instantly. More...
 
bool has_instant_add_cols () const
 check if table has INSTANT ADD columns. More...
 
bool has_instant_drop_cols () const
 check if table has INSTANT DROP columns. More...
 
void set_upgraded_instant ()
 Set table to be upgraded table with INSTANT ADD columns in V1. More...
 
bool is_upgraded_instant () const
 Checks if table is upgraded table with INSTANT ADD columns in V1. More...
 
bool is_corrupted () const
 Check whether the table is corrupted. More...
 
const char * get_col_name (ulint col_nr) const
 Returns a column's name. More...
 
dict_col_tget_col (uint pos) const
 Gets the nth column of a table. More...
 
dict_col_tget_col_by_name (const char *name) const
 Get column by name. More...
 
uint16_t get_n_user_cols () const
 Gets the number of user-defined non-virtual columns in a table in the dictionary cache. More...
 
uint16_t get_n_sys_cols () const
 Gets the number of system columns in a table. More...
 
ulint get_n_cols () const
 Gets the number of all non-virtual columns (also system) in a table in the dictionary cache. More...
 
ulint get_total_cols () const
 Gets the number of all non-virtual columns in a table including columns dropped INSTANTly. More...
 
dict_col_tget_sys_col (ulint sys) const
 Gets the given system column of a table. More...
 
bool is_temporary () const
 Determine if this is a temporary table. More...
 
bool is_fts_aux () const
 Determine if this is a FTS AUX table. More...
 
bool is_intrinsic () const
 Determine whether the table is intrinsic. More...
 
bool skip_gap_locks () const
 
bool support_instant_add_drop () const
 Determine if the table can support instant ADD/DROP COLUMN. More...
 

Public Attributes

ib_mutex_t * mutex
 Mutex of the table for concurrency access. More...
 
std::atomic< os_once::state_tmutex_created
 Creation state of mutex. More...
 
table_id_t id
 Id of the table. More...
 
mem_heap_theap
 Memory heap. More...
 
table_name_t name
 Table name. More...
 
table_name_t trunc_name
 Truncate name. More...
 
char * data_dir_path
 NULL or the directory path specified by DATA DIRECTORY. More...
 
id_name_t tablespace
 NULL or the tablespace name that this table is assigned to, specified by the TABLESPACE option. More...
 
space_id_t space
 Space where the clustered index of the table is placed. More...
 
dd::Object_id dd_space_id
 dd::Tablespace::id of the table More...
 
unsigned flags: DICT_TF_BITS
 Stores information about: 1 row format (redundant or compact), 2 compressed page size (zip shift size), 3 whether using atomic blobs, 4 whether the table has been created with the option DATA DIRECTORY. More...
 
unsigned flags2: DICT_TF2_BITS
 Stores information about: 1 whether the table has been created using CREATE TEMPORARY TABLE, 2 whether the table has an internally defined DOC ID column, 3 whether the table has a FTS index, 4 whether DOC ID column need to be added to the FTS index, 5 whether the table is being created its own tablespace, 6 whether the table has been DISCARDed, 7 whether the aux FTS tables names are in hex. More...
 
unsigned skip_alter_undo: 1
 true if the table is an intermediate table during copy alter operation or a partition/subpartition which is required for copying data and skip the undo log for insertion of row in the table. More...
 
unsigned ibd_file_missing: 1
 true if this is in a single-table tablespace and the .ibd file is missing. More...
 
unsigned cached: 1
 true if the table object has been added to the dictionary cache. More...
 
unsigned to_be_dropped: 1
 true if the table is to be dropped, but not yet actually dropped (could in the background drop list). More...
 
unsigned n_def: 10
 Number of non-virtual columns defined so far. More...
 
unsigned n_cols: 10
 Number of non-virtual columns. More...
 
unsigned n_instant_cols: 10
 Number of non-virtual columns before first instant ADD COLUMN, including the system columns like n_cols. More...
 
unsigned n_t_cols: 10
 Number of total columns (include virtual and non-virtual) More...
 
unsigned n_t_def: 10
 Number of total columns defined so far. More...
 
unsigned n_v_def: 10
 Number of virtual columns defined so far. More...
 
unsigned n_v_cols: 10
 Number of virtual columns. More...
 
unsigned n_m_v_cols: 10
 Number of multi-value virtual columns. More...
 
bool can_be_evicted: 1
 true if this table is expected to be kept in memory. More...
 
unsigned ddl_not_evictable: 1
 true if this table is not evictable(can_be_evicted) and this is because of DDL operation More...
 
unsigned drop_aborted: 1
 true if some indexes should be dropped after ONLINE_INDEX_ABORTED or ONLINE_INDEX_ABORTED_DROPPED. More...
 
dict_col_tcols
 Array of column descriptions. More...
 
dict_v_col_tv_cols
 Array of virtual column descriptions. More...
 
dict_s_col_lists_cols
 List of stored column descriptions. More...
 
const char * col_names
 Column names packed in a character string "name1\0name2\0...nameN\0". More...
 
const char * v_col_names
 Virtual column names. More...
 
bool is_system_table
 True if the table belongs to a system database (mysql, information_schema or performance_schema) More...
 
hash_node_t name_hash
 Hash chain node. More...
 
hash_node_t id_hash
 Hash chain node. More...
 
dict_index_tfts_doc_id_index
 The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist. More...
 
uint64_t version
 metadata version number of dd::Table::se_private_data() More...
 
uint32_t current_row_version {0}
 Current row version in case columns are added/dropped INSTANTly. More...
 
uint32_t initial_col_count {0}
 Initial non-virtual column count. More...
 
uint32_t current_col_count {0}
 Current non-virtual column count. More...
 
uint32_t total_col_count {0}
 Total non-virtual column count. More...
 
bool m_upgraded_instant {false}
 Set if table is upgraded instant table. More...
 
std::atomic< table_dirty_statusdirty_status
 table dynamic metadata status, protected by dict_persist->mutex More...
 
bool in_dirty_dict_tables_list
 This field is used to mark if a table is in the dirty_dict_tables_list. More...
 
unsigned fk_max_recusive_level: 8
 Maximum recursive level we support when loading tables chained together with FK constraints. More...
 
std::atomic< ulintn_foreign_key_checks_running
 Count of how many foreign key check operations are currently being performed on the table. More...
 
trx_id_t def_trx_id
 Transaction id that last touched the table definition. More...
 
dict_foreign_set foreign_set
 set of foreign key constraints which refer to this table More...
 
dict_foreign_set referenced_set
 
bool does_not_fit_in_memory
 This field is used to specify in simulations tables which are so big that disk should be accessed. More...
 
unsigned big_rows: 1
 true if the maximum length of a single row exceeds BIG_ROW_SIZE. More...
 
fts_tfts
 FTS specific state variables. More...
 
ib_quiesce_t quiesce
 Quiescing states, protected by the dict_index_t::lock. More...
 
std::atomic< size_t > n_rec_locks
 Count of the number of record locks on this table. More...
 
std::atomic< uint64_t > n_ref_count
 Count of how many handles are opened to this table. More...
 
table_lock_list_t locks
 List of locks on the table. More...
 
ulong count_by_mode [LOCK_NUM]
 count_by_mode[M] = number of locks in this->locks with lock->type_mode&LOCK_MODE_MASK == M. More...
 
std::atomic< std::chrono::system_clock::time_point > update_time
 Timestamp of the last modification of this table. More...
 
uint64_t sess_row_id
 row-id counter for use by intrinsic table for getting row-id. More...
 
uint64_t sess_trx_id
 trx_id counter for use by intrinsic table for getting trx-id. More...
 
ulint magic_n
 Magic number. More...
 
dict_vcol_templ_tvc_templ
 mysql_row_templ_t for base columns used for compute the virtual columns More...
 
bool discard_after_ddl
 remove the dict_table_t from cache after DDL operation More...
 
bool refresh_fk
 refresh/reload FK info More...
 
temp_prebuilt_vectemp_prebuilt
 multiple cursors can be active on this temporary table More...
 
bool is_dd_table
 true only for dictionary tables like mysql/tables, mysql/columns, mysql/tablespaces, etc. More...
 
bool explicitly_non_lru
 true if this table is explicitly put to non-LRU list during table creation More...
 
std::atomic< os_once::state_tstats_latch_created
 Statistics for query optimization. More...
 
rw_lock_tstats_latch
 This latch protects: "dict_table_t::stat_initialized", "dict_table_t::stat_n_rows (*)", "dict_table_t::stat_clustered_index_size", "dict_table_t::stat_sum_of_other_index_sizes", "dict_table_t::stat_modified_counter (*)", "dict_table_t::indexes*::stat_n_diff_key_vals[]", "dict_table_t::indexes*::stat_index_size", "dict_table_t::indexes*::stat_n_leaf_pages". More...
 
unsigned stat_initialized: 1
 true if statistics have been calculated the first time after database startup or table creation. More...
 
std::chrono::steady_clock::time_point stats_last_recalc
 Timestamp of last recalc of the stats. More...
 
uint32_t stat_persistent
 Indicates whether the table uses persistent stats or not. More...
 
uint32_t stats_auto_recalc
 Indicates whether the table uses automatic recalc for persistent stats or not. More...
 
ulint stats_sample_pages
 The number of pages to sample for this table during persistent stats estimation. More...
 
uint64_t stat_n_rows
 Approximate number of rows in the table. More...
 
ulint stat_clustered_index_size
 Approximate clustered index size in database pages. More...
 
ulint stat_sum_of_other_index_sizes
 Approximate size of other indexes in database pages. More...
 
table_id_t parent_id
 If FTS AUX table, parent table id. More...
 
uint64_t stat_modified_counter
 How many rows are modified since last stats recalc. More...
 
byte stats_bg_flag
 The state of the background stats thread wrt this table. More...
 
lock_tautoinc_lock
 AUTOINC related members. More...
 
std::atomic< os_once::state_tautoinc_mutex_created
 Creation state of autoinc_mutex member. More...
 
ib_mutex_t * autoinc_mutex
 Mutex protecting the autoincrement counter. More...
 
uint64_t autoinc
 Autoinc counter value to give to the next inserted row. More...
 
ib_mutex_t * autoinc_persisted_mutex
 Mutex protecting the persisted autoincrement counter. More...
 
uint64_t autoinc_persisted
 Autoinc counter value that has been persisted in redo logs or DDTableBuffer. More...
 
ulint autoinc_field_no
 The position of autoinc counter field in clustered index. More...
 
std::atomic< const trx_t * > autoinc_trx
 The transaction that currently holds the the AUTOINC lock on this table. More...
 

Detailed Description

Data structure for a database table.

Most fields will be initialized to 0, NULL or false in dict_mem_table_create().

Member Function Documentation

◆ acquire()

void dict_table_t::acquire ( )
inline

Acquire the table handle.

◆ acquire_with_lock()

void dict_table_t::acquire_with_lock ( )
inline

Acquire the table handle, with lock() and unlock() the table.

This function needs to be called for opening table when the table is in memory and later the stats information would be initialized

◆ first_index() [1/2]

dict_index_t * dict_table_t::first_index ( )
inline
Returns
the clustered index

◆ first_index() [2/2]

const dict_index_t * dict_table_t::first_index ( ) const
inline
Returns
the clustered index

◆ get_col()

dict_col_t * dict_table_t::get_col ( uint  pos) const
inline

Gets the nth column of a table.

Parameters
[in]posposition of column
Returns
pointer to column object

◆ get_col_by_name()

dict_col_t * dict_table_t::get_col_by_name ( const char *  name) const
inline

Get column by name.

Parameters
[in]namecolumn name
Returns
column name if found, null otherwise

◆ get_col_name()

const char * dict_table_t::get_col_name ( ulint  col_nr) const
inline

Returns a column's name.

Parameters
[in]col_nrcolumn number
Returns
column name. NOTE: not guaranteed to stay valid if table is modified in any way (columns added, etc.).

◆ get_instant_cols()

uint16_t dict_table_t::get_instant_cols ( ) const
inline

Get the number of user columns when the first instant ADD COLUMN happens.

Returns
the number of user columns as described above

◆ get_n_cols()

ulint dict_table_t::get_n_cols ( ) const
inline

Gets the number of all non-virtual columns (also system) in a table in the dictionary cache.

Returns
number of non-virtual columns of a table

◆ get_n_instant_add_cols()

uint32_t dict_table_t::get_n_instant_add_cols ( ) const
inline

Get number of columns added instantly.

◆ get_n_instant_added_col_v1()

size_t dict_table_t::get_n_instant_added_col_v1 ( ) const
inline

◆ get_n_instant_drop_cols()

uint32_t dict_table_t::get_n_instant_drop_cols ( ) const
inline

Get number of columns dropped instantly.

◆ get_n_sys_cols()

uint16_t dict_table_t::get_n_sys_cols ( ) const
inline

Gets the number of system columns in a table.

For intrinsic table on ROW_ID column is added for all other tables TRX_ID and ROLL_PTR are all also appended.

Returns
number of system (e.g., ROW_ID) columns of a table

◆ get_n_user_cols()

uint16_t dict_table_t::get_n_user_cols ( ) const
inline

Gets the number of user-defined non-virtual columns in a table in the dictionary cache.

Returns
number of user-defined (e.g., not ROW_ID) non-virtual columns of a table

◆ get_ref_count()

uint64_t dict_table_t::get_ref_count ( ) const
inline

Get reference count.

Returns
current value of n_ref_count

◆ get_sys_col()

dict_col_t * dict_table_t::get_sys_col ( ulint  sys) const
inline

Gets the given system column of a table.

Parameters
[in]sysDATA_ROW_ID, ...
Returns
pointer to column object

◆ get_table_name()

void dict_table_t::get_table_name ( std::string &  schema,
std::string &  table 
) const

Get schema and table name in system character set.

Parameters
[out]schemaschema name
[out]tabletable name

◆ get_total_cols()

ulint dict_table_t::get_total_cols ( ) const
inline

Gets the number of all non-virtual columns in a table including columns dropped INSTANTly.

Returns
number of non-virtual columns of a table

◆ has_instant_add_cols()

bool dict_table_t::has_instant_add_cols ( ) const
inline

check if table has INSTANT ADD columns.

Returns
true if the table has INSTANT ADD columns, otherwise false

◆ has_instant_cols()

bool dict_table_t::has_instant_cols ( ) const
inline
Returns
if there was any instantly added column. This will be true after one or more instant ADD COLUMN, however, it would become false after ALTER TABLE which rebuilds or copies the old table. If this is true, all instantly added columns should have default values, and records in the table may have REC_INFO_INSTANT_FLAG set.

◆ has_instant_drop_cols()

bool dict_table_t::has_instant_drop_cols ( ) const
inline

check if table has INSTANT DROP columns.

Returns
true if the table has INSTANT DROP columns, otherwise false

◆ has_row_versions()

bool dict_table_t::has_row_versions ( ) const
inline
Returns
true if the table has row versions..

◆ is_compressed()

bool dict_table_t::is_compressed ( ) const
inline

Check if the table is compressed.

Returns
true if compressed, false otherwise.

◆ is_corrupted()

bool dict_table_t::is_corrupted ( ) const
inline

Check whether the table is corrupted.

Returns
true if the table is corrupted, otherwise false

◆ is_fts_aux()

bool dict_table_t::is_fts_aux ( ) const
inline

Determine if this is a FTS AUX table.

◆ is_intrinsic()

bool dict_table_t::is_intrinsic ( ) const
inline

Determine whether the table is intrinsic.

An intrinsic table is a special kind of temporary table that is invisible to the end user. It can be created internally by InnoDB, the MySQL server layer or other modules connected to InnoDB in order to gather and use data as part of a larger task. Since access to it must be as fast as possible, it does not need UNDO semantics, system fields DB_TRX_ID & DB_ROLL_PTR, doublewrite, checksum, insert buffer, use of the shared data dictionary, locking, or even a transaction. In short, these are not ACID tables at all, just temporary data stored and manipulated during a larger process.

◆ is_system_schema()

bool dict_table_t::is_system_schema ( ) const
inline

◆ is_temporary()

bool dict_table_t::is_temporary ( ) const
inline

Determine if this is a temporary table.

◆ is_upgraded_instant()

bool dict_table_t::is_upgraded_instant ( ) const
inline

Checks if table is upgraded table with INSTANT ADD columns in V1.

Returns
true if it is, false otherwise

◆ lock()

void dict_table_t::lock ( )
inline

Lock the table handle.

◆ release()

void dict_table_t::release ( )
inline

Release the table handle.

◆ set_instant_cols()

void dict_table_t::set_instant_cols ( uint16_t  n_inst_cols)
inline

Set the number of columns when the first instant ADD COLUMN happens.

Parameters
[in]n_inst_colsnumber of fields when first instant ADD COLUMN happens, without system columns

◆ set_upgraded_instant()

void dict_table_t::set_upgraded_instant ( )
inline

Set table to be upgraded table with INSTANT ADD columns in V1.

◆ skip_gap_locks()

bool dict_table_t::skip_gap_locks ( ) const
inline

◆ support_instant_add_drop()

bool dict_table_t::support_instant_add_drop ( ) const
inline

Determine if the table can support instant ADD/DROP COLUMN.

◆ unlock()

void dict_table_t::unlock ( )
inline

Unlock the table handle.

◆ UT_LIST_BASE_NODE_T()

dict_table_t::UT_LIST_BASE_NODE_T ( dict_index_t  ,
indexes   
)

List of indexes of the table.

◆ UT_LIST_NODE_T() [1/2]

dict_table_t::UT_LIST_NODE_T ( dict_table_t  )

Node of the dirty table list of tables, which is protected by dict_persist->mutex.

◆ UT_LIST_NODE_T() [2/2]

dict_table_t::UT_LIST_NODE_T ( dict_table_t  )

Node of the LRU list of tables.

Member Data Documentation

◆ autoinc

uint64_t dict_table_t::autoinc

Autoinc counter value to give to the next inserted row.

◆ autoinc_field_no

ulint dict_table_t::autoinc_field_no

The position of autoinc counter field in clustered index.

This would be set when CREATE/ALTER/OPEN TABLE and IMPORT TABLESPACE, and used in modifications to clustered index, such as INSERT/UPDATE. There should be no conflict to access it, so no protection is needed.

◆ autoinc_lock

lock_t* dict_table_t::autoinc_lock

AUTOINC related members.

A buffer for an AUTOINC lock for this table. We allocate the memory here so that individual transactions can get it and release it without a need to allocate space from the lock heap of the trx: otherwise the lock heap would grow rapidly if we do a large insert from a select.

◆ autoinc_mutex

ib_mutex_t* dict_table_t::autoinc_mutex

Mutex protecting the autoincrement counter.

◆ autoinc_mutex_created

std::atomic<os_once::state_t> dict_table_t::autoinc_mutex_created

Creation state of autoinc_mutex member.

◆ autoinc_persisted

uint64_t dict_table_t::autoinc_persisted

Autoinc counter value that has been persisted in redo logs or DDTableBuffer.

It's mainly used when we want to write counter back to DDTableBuffer. This is different from the 'autoinc' above, which could be bigger than this one, because 'autoinc' will get updated right after some counters are allocated, but we will write the counter to redo logs and update this counter later. Once all allocated counters have been written to redo logs, 'autoinc' should be exact the next counter of this persisted one. We want this counter because when we need to write the counter back to DDTableBuffer, we had better keep it consistency with the counter that has been written to redo logs. Besides, we can't read the 'autoinc' directly easily, because the autoinc_lock is required and there could be a deadlock. This variable is protected by autoinc_persisted_mutex.

◆ autoinc_persisted_mutex

ib_mutex_t* dict_table_t::autoinc_persisted_mutex

Mutex protecting the persisted autoincrement counter.

◆ autoinc_trx

std::atomic<const trx_t *> dict_table_t::autoinc_trx

The transaction that currently holds the the AUTOINC lock on this table.

Protected by lock_sys table shard latch. To "peek" the current value one can read it without any latch, understanding that in general it may change. Such access pattern is correct if trx thread wants to check if it has the lock granted, as the field can only change to other value when lock is released, which can not happen concurrently to thread executing the trx.

◆ big_rows

unsigned dict_table_t::big_rows

true if the maximum length of a single row exceeds BIG_ROW_SIZE.

Initialized in dict_table_add_to_cache().

◆ cached

unsigned dict_table_t::cached

true if the table object has been added to the dictionary cache.

◆ can_be_evicted

bool dict_table_t::can_be_evicted

true if this table is expected to be kept in memory.

This table could be a table that has FK relationships or is undergoing DDL

◆ col_names

const char* dict_table_t::col_names

Column names packed in a character string "name1\0name2\0...nameN\0".

Until the string contains n_cols, it will be allocated from a temporary heap. The final string will be allocated from table->heap.

◆ cols

dict_col_t* dict_table_t::cols

Array of column descriptions.

◆ count_by_mode

ulong dict_table_t::count_by_mode[LOCK_NUM]

count_by_mode[M] = number of locks in this->locks with lock->type_mode&LOCK_MODE_MASK == M.

Used to quickly verify that there are no LOCK_S or LOCK_X, which are the only modes incompatible with LOCK_IS and LOCK_IX, to avoid costly iteration over this->locks when adding LOCK_IS or LOCK_IX. We use count_by_mode[LOCK_AUTO_INC] to track the number of granted and pending autoinc locks on this table. This value is set after acquiring the lock_sys table shard latch, but we peek the contents to determine whether other transactions have acquired the AUTOINC lock or not. Of course only one transaction can be granted the lock but there can be multiple waiters. Protected by lock_sys table shard latch.

◆ current_col_count

uint32_t dict_table_t::current_col_count {0}

Current non-virtual column count.

◆ current_row_version

uint32_t dict_table_t::current_row_version {0}

Current row version in case columns are added/dropped INSTANTly.

◆ data_dir_path

char* dict_table_t::data_dir_path

NULL or the directory path specified by DATA DIRECTORY.

◆ dd_space_id

dd::Object_id dict_table_t::dd_space_id

dd::Tablespace::id of the table

◆ ddl_not_evictable

unsigned dict_table_t::ddl_not_evictable

true if this table is not evictable(can_be_evicted) and this is because of DDL operation

◆ def_trx_id

trx_id_t dict_table_t::def_trx_id

Transaction id that last touched the table definition.

Either when loading the definition or CREATE TABLE, or ALTER TABLE (prepare, commit, and rollback phases). set of foreign key constraints in the table; these refer to columns in other tables

◆ dirty_status

std::atomic<table_dirty_status> dict_table_t::dirty_status

table dynamic metadata status, protected by dict_persist->mutex

◆ discard_after_ddl

bool dict_table_t::discard_after_ddl

remove the dict_table_t from cache after DDL operation

◆ does_not_fit_in_memory

bool dict_table_t::does_not_fit_in_memory

This field is used to specify in simulations tables which are so big that disk should be accessed.

Disk access is simulated by putting the thread to sleep for a while. NOTE that this flag is not stored to the data dictionary on disk, and the database will forget about value true if it has to reload the table definition from disk.

◆ drop_aborted

unsigned dict_table_t::drop_aborted

true if some indexes should be dropped after ONLINE_INDEX_ABORTED or ONLINE_INDEX_ABORTED_DROPPED.

◆ explicitly_non_lru

bool dict_table_t::explicitly_non_lru

true if this table is explicitly put to non-LRU list during table creation

◆ fk_max_recusive_level

unsigned dict_table_t::fk_max_recusive_level

Maximum recursive level we support when loading tables chained together with FK constraints.

If exceeds this level, we will stop loading child table into memory along with its parent table.

◆ flags

unsigned dict_table_t::flags

Stores information about: 1 row format (redundant or compact), 2 compressed page size (zip shift size), 3 whether using atomic blobs, 4 whether the table has been created with the option DATA DIRECTORY.

Use DICT_TF_GET_COMPACT(), DICT_TF_GET_ZIP_SSIZE(), DICT_TF_HAS_ATOMIC_BLOBS() and DICT_TF_HAS_DATA_DIR() to parse this flag.

◆ flags2

unsigned dict_table_t::flags2

Stores information about: 1 whether the table has been created using CREATE TEMPORARY TABLE, 2 whether the table has an internally defined DOC ID column, 3 whether the table has a FTS index, 4 whether DOC ID column need to be added to the FTS index, 5 whether the table is being created its own tablespace, 6 whether the table has been DISCARDed, 7 whether the aux FTS tables names are in hex.

8 whether the table is instinc table. 9 whether the table has encryption setting. Use DICT_TF2_FLAG_IS_SET() to parse this flag.

◆ foreign_set

dict_foreign_set dict_table_t::foreign_set

set of foreign key constraints which refer to this table

◆ fts

fts_t* dict_table_t::fts

FTS specific state variables.

◆ fts_doc_id_index

dict_index_t* dict_table_t::fts_doc_id_index

The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist.

◆ heap

mem_heap_t* dict_table_t::heap

Memory heap.

If you allocate from this heap after the table has been created then be sure to account the allocation into dict_sys->size. When closing the table we do something like dict_sys->size -= mem_heap_get_size(table->heap) and if that is going to become negative then we would assert. Something like this should do: old_size = mem_heap_get_size() mem_heap_alloc() new_size = mem_heap_get_size() dict_sys->size += new_size - old_size.

◆ ibd_file_missing

unsigned dict_table_t::ibd_file_missing

true if this is in a single-table tablespace and the .ibd file is missing.

Then we must return in ha_innodb.cc an error if the user tries to query such an orphaned table.

◆ id

table_id_t dict_table_t::id

Id of the table.

◆ id_hash

hash_node_t dict_table_t::id_hash

Hash chain node.

◆ in_dirty_dict_tables_list

bool dict_table_t::in_dirty_dict_tables_list

This field is used to mark if a table is in the dirty_dict_tables_list.

if the dirty_status is not of METADATA_CLEAN, the table should be in the list, otherwise not. This field should be protected by dict_persist->mutex too.

◆ initial_col_count

uint32_t dict_table_t::initial_col_count {0}

Initial non-virtual column count.

◆ is_dd_table

bool dict_table_t::is_dd_table

true only for dictionary tables like mysql/tables, mysql/columns, mysql/tablespaces, etc.

This flag is used to do non-locking reads on DD tables.

◆ is_system_table

bool dict_table_t::is_system_table

True if the table belongs to a system database (mysql, information_schema or performance_schema)

◆ locks

table_lock_list_t dict_table_t::locks

List of locks on the table.

Protected by lock_sys shard latch.

◆ m_upgraded_instant

bool dict_table_t::m_upgraded_instant {false}

Set if table is upgraded instant table.

◆ magic_n

ulint dict_table_t::magic_n

Magic number.

◆ mutex

ib_mutex_t* dict_table_t::mutex

Mutex of the table for concurrency access.

◆ mutex_created

std::atomic<os_once::state_t> dict_table_t::mutex_created

Creation state of mutex.

◆ n_cols

unsigned dict_table_t::n_cols

Number of non-virtual columns.

◆ n_def

unsigned dict_table_t::n_def

Number of non-virtual columns defined so far.

◆ n_foreign_key_checks_running

std::atomic<ulint> dict_table_t::n_foreign_key_checks_running

Count of how many foreign key check operations are currently being performed on the table.

We cannot drop the table while there are foreign key checks running on it.

◆ n_instant_cols

unsigned dict_table_t::n_instant_cols

Number of non-virtual columns before first instant ADD COLUMN, including the system columns like n_cols.

This is used only when table has instant ADD clumns in V1.

◆ n_m_v_cols

unsigned dict_table_t::n_m_v_cols

Number of multi-value virtual columns.

◆ n_rec_locks

std::atomic<size_t> dict_table_t::n_rec_locks

Count of the number of record locks on this table.

We use this to determine whether we can evict the table from the dictionary cache. Writes (atomic increments and decrements) are performed when holding a shared latch on lock_sys. (Note that this the table's shard latch is NOT required, as this is field counts record locks, so a page shard is latched instead) Reads should be performed when holding exclusive lock_sys latch, however:

  • Some places assert this field is zero without holding any latch.
  • Some places assert this field is positive holding only shared latch.

◆ n_ref_count

std::atomic<uint64_t> dict_table_t::n_ref_count

Count of how many handles are opened to this table.

Dropping of the table is NOT allowed until this count gets to zero. MySQL does NOT itself check the number of open handles at DROP.

◆ n_t_cols

unsigned dict_table_t::n_t_cols

Number of total columns (include virtual and non-virtual)

◆ n_t_def

unsigned dict_table_t::n_t_def

Number of total columns defined so far.

◆ n_v_cols

unsigned dict_table_t::n_v_cols

Number of virtual columns.

◆ n_v_def

unsigned dict_table_t::n_v_def

Number of virtual columns defined so far.

◆ name

table_name_t dict_table_t::name

Table name.

◆ name_hash

hash_node_t dict_table_t::name_hash

Hash chain node.

◆ parent_id

table_id_t dict_table_t::parent_id

If FTS AUX table, parent table id.

◆ quiesce

ib_quiesce_t dict_table_t::quiesce

Quiescing states, protected by the dict_index_t::lock.

ie. we can only change the state if we acquire all the latches (dict_index_t::lock) in X mode of this table's indexes.

◆ referenced_set

dict_foreign_set dict_table_t::referenced_set

◆ refresh_fk

bool dict_table_t::refresh_fk

refresh/reload FK info

◆ s_cols

dict_s_col_list* dict_table_t::s_cols

List of stored column descriptions.

It is used only for foreign key check during create table and copy alter operations. During copy alter, s_cols list is filled during create table operation and need to preserve till rename table operation. That is the reason s_cols is a part of dict_table_t

◆ sess_row_id

uint64_t dict_table_t::sess_row_id

row-id counter for use by intrinsic table for getting row-id.

Given intrinsic table semantics, row-id can be locally maintained instead of getting it from central generator which involves mutex locking.

◆ sess_trx_id

uint64_t dict_table_t::sess_trx_id

trx_id counter for use by intrinsic table for getting trx-id.

Intrinsic table are not shared so don't need a central trx-id but just need a increased counter to track consistent view while proceeding SELECT as part of UPDATE.

◆ skip_alter_undo

unsigned dict_table_t::skip_alter_undo

true if the table is an intermediate table during copy alter operation or a partition/subpartition which is required for copying data and skip the undo log for insertion of row in the table.

This variable will be set and unset during extra(), or during the process of altering partitions

◆ space

space_id_t dict_table_t::space

Space where the clustered index of the table is placed.

◆ stat_clustered_index_size

ulint dict_table_t::stat_clustered_index_size

Approximate clustered index size in database pages.

◆ stat_initialized

unsigned dict_table_t::stat_initialized

true if statistics have been calculated the first time after database startup or table creation.

◆ stat_modified_counter

uint64_t dict_table_t::stat_modified_counter

How many rows are modified since last stats recalc.

When a row is inserted, updated, or deleted, we add 1 to this number; we calculate new estimates for the table and the indexes if the table has changed too much, see row_update_statistics_if_needed(). The counter is reset to zero at statistics calculation. This counter is not protected by any latch, because this is only used for heuristics.

◆ stat_n_rows

uint64_t dict_table_t::stat_n_rows

Approximate number of rows in the table.

We periodically calculate new estimates.

◆ stat_persistent

uint32_t dict_table_t::stat_persistent

Indicates whether the table uses persistent stats or not.

See DICT_STATS_PERSISTENT_ON and DICT_STATS_PERSISTENT_OFF.

◆ stat_sum_of_other_index_sizes

ulint dict_table_t::stat_sum_of_other_index_sizes

Approximate size of other indexes in database pages.

◆ stats_auto_recalc

uint32_t dict_table_t::stats_auto_recalc

Indicates whether the table uses automatic recalc for persistent stats or not.

See DICT_STATS_AUTO_RECALC_ON and DICT_STATS_AUTO_RECALC_OFF.

◆ stats_bg_flag

byte dict_table_t::stats_bg_flag

The state of the background stats thread wrt this table.

See BG_STAT_NONE, BG_STAT_IN_PROGRESS and BG_STAT_SHOULD_QUIT. Writes are covered by dict_sys->mutex. Dirty reads are possible.

◆ stats_last_recalc

std::chrono::steady_clock::time_point dict_table_t::stats_last_recalc

Timestamp of last recalc of the stats.

◆ stats_latch

rw_lock_t* dict_table_t::stats_latch

This latch protects: "dict_table_t::stat_initialized", "dict_table_t::stat_n_rows (*)", "dict_table_t::stat_clustered_index_size", "dict_table_t::stat_sum_of_other_index_sizes", "dict_table_t::stat_modified_counter (*)", "dict_table_t::indexes*::stat_n_diff_key_vals[]", "dict_table_t::indexes*::stat_index_size", "dict_table_t::indexes*::stat_n_leaf_pages".

(*) Those are not always protected for performance reasons.

◆ stats_latch_created

std::atomic<os_once::state_t> dict_table_t::stats_latch_created

Statistics for query optimization.

Creation state of 'stats_latch'.

◆ stats_sample_pages

ulint dict_table_t::stats_sample_pages

The number of pages to sample for this table during persistent stats estimation.

If this is 0, then the value of the global srv_stats_persistent_sample_pages will be used instead.

◆ tablespace

id_name_t dict_table_t::tablespace

NULL or the tablespace name that this table is assigned to, specified by the TABLESPACE option.

◆ temp_prebuilt

temp_prebuilt_vec* dict_table_t::temp_prebuilt

multiple cursors can be active on this temporary table

◆ to_be_dropped

unsigned dict_table_t::to_be_dropped

true if the table is to be dropped, but not yet actually dropped (could in the background drop list).

It is turned on at the beginning of row_drop_table_for_mysql() and turned off just before we start to update system tables for the drop. It is protected by dict_operation_lock.

◆ total_col_count

uint32_t dict_table_t::total_col_count {0}

Total non-virtual column count.

◆ trunc_name

table_name_t dict_table_t::trunc_name

Truncate name.

◆ update_time

std::atomic<std::chrono::system_clock::time_point> dict_table_t::update_time

Timestamp of the last modification of this table.

◆ v_col_names

const char* dict_table_t::v_col_names

Virtual column names.

◆ v_cols

dict_v_col_t* dict_table_t::v_cols

Array of virtual column descriptions.

◆ vc_templ

dict_vcol_templ_t* dict_table_t::vc_templ

mysql_row_templ_t for base columns used for compute the virtual columns

◆ version

uint64_t dict_table_t::version

metadata version number of dd::Table::se_private_data()


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