MySQL 8.0.39
Source Code Documentation
|
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_t * | first_index () const |
dict_index_t * | first_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_t * | get_col (uint pos) const |
Gets the nth column of a table. More... | |
dict_col_t * | get_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_t * | get_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_t > | mutex_created |
Creation state of mutex. More... | |
table_id_t | id |
Id of the table. More... | |
mem_heap_t * | heap |
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_t * | cols |
Array of column descriptions. More... | |
dict_v_col_t * | v_cols |
Array of virtual column descriptions. More... | |
dict_s_col_list * | s_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_t * | fts_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_status > | dirty_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< ulint > | n_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_t * | fts |
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_t * | vc_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_vec * | temp_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_t > | stats_latch_created |
Statistics for query optimization. More... | |
rw_lock_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". 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_t * | autoinc_lock |
AUTOINC related members. More... | |
std::atomic< os_once::state_t > | autoinc_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... | |
Data structure for a database table.
Most fields will be initialized to 0, NULL or false in dict_mem_table_create().
|
inline |
Acquire the table handle.
|
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
|
inline |
|
inline |
|
inline |
Gets the nth column of a table.
[in] | pos | position of column |
|
inline |
Get column by name.
[in] | name | column name |
|
inline |
Returns a column's name.
[in] | col_nr | column number |
|
inline |
Get the number of user columns when the first instant ADD COLUMN happens.
|
inline |
Gets the number of all non-virtual columns (also system) in a table in the dictionary cache.
|
inline |
Get number of columns added instantly.
|
inline |
|
inline |
Get number of columns dropped instantly.
|
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.
|
inline |
Gets the number of user-defined non-virtual columns in a table in the dictionary cache.
|
inline |
Get reference count.
|
inline |
Gets the given system column of a table.
[in] | sys | DATA_ROW_ID, ... |
void dict_table_t::get_table_name | ( | std::string & | schema, |
std::string & | table | ||
) | const |
Get schema and table name in system character set.
[out] | schema | schema name |
[out] | table | table name |
|
inline |
Gets the number of all non-virtual columns in a table including columns dropped INSTANTly.
|
inline |
check if table has INSTANT ADD columns.
|
inline |
|
inline |
check if table has INSTANT DROP columns.
|
inline |
|
inline |
Check if the table is compressed.
|
inline |
Check whether the table is corrupted.
|
inline |
Determine if this is a FTS AUX table.
|
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.
|
inline |
|
inline |
Determine if this is a temporary table.
|
inline |
Checks if table is upgraded table with INSTANT ADD columns in V1.
|
inline |
Lock the table handle.
|
inline |
Release the table handle.
|
inline |
Set the number of columns when the first instant ADD COLUMN happens.
[in] | n_inst_cols | number of fields when first instant ADD COLUMN happens, without system columns |
|
inline |
Set table to be upgraded table with INSTANT ADD columns in V1.
|
inline |
|
inline |
Determine if the table can support instant ADD/DROP COLUMN.
|
inline |
Unlock the table handle.
dict_table_t::UT_LIST_BASE_NODE_T | ( | dict_index_t | , |
indexes | |||
) |
List of indexes of the table.
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.
dict_table_t::UT_LIST_NODE_T | ( | dict_table_t | ) |
Node of the LRU list of tables.
uint64_t dict_table_t::autoinc |
Autoinc counter value to give to the next inserted row.
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.
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.
ib_mutex_t* dict_table_t::autoinc_mutex |
Mutex protecting the autoincrement counter.
std::atomic<os_once::state_t> dict_table_t::autoinc_mutex_created |
Creation state of autoinc_mutex member.
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.
ib_mutex_t* dict_table_t::autoinc_persisted_mutex |
Mutex protecting the persisted autoincrement counter.
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.
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().
unsigned dict_table_t::cached |
true if the table object has been added to the dictionary cache.
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
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.
dict_col_t* dict_table_t::cols |
Array of column descriptions.
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.
uint32_t dict_table_t::current_col_count {0} |
Current non-virtual column count.
uint32_t dict_table_t::current_row_version {0} |
Current row version in case columns are added/dropped INSTANTly.
char* dict_table_t::data_dir_path |
NULL or the directory path specified by DATA DIRECTORY.
dd::Object_id dict_table_t::dd_space_id |
dd::Tablespace::id of the table
unsigned dict_table_t::ddl_not_evictable |
true if this table is not evictable(can_be_evicted) and this is because of DDL operation
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
std::atomic<table_dirty_status> dict_table_t::dirty_status |
table dynamic metadata status, protected by dict_persist->mutex
bool dict_table_t::discard_after_ddl |
remove the dict_table_t from cache after DDL operation
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.
unsigned dict_table_t::drop_aborted |
true if some indexes should be dropped after ONLINE_INDEX_ABORTED or ONLINE_INDEX_ABORTED_DROPPED.
bool dict_table_t::explicitly_non_lru |
true if this table is explicitly put to non-LRU list during table creation
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.
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.
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.
dict_foreign_set dict_table_t::foreign_set |
set of foreign key constraints which refer to this table
fts_t* dict_table_t::fts |
FTS specific state variables.
dict_index_t* dict_table_t::fts_doc_id_index |
The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist.
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.
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.
table_id_t dict_table_t::id |
Id of the table.
hash_node_t dict_table_t::id_hash |
Hash chain node.
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.
uint32_t dict_table_t::initial_col_count {0} |
Initial non-virtual column count.
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.
bool dict_table_t::is_system_table |
True if the table belongs to a system database (mysql, information_schema or performance_schema)
table_lock_list_t dict_table_t::locks |
List of locks on the table.
Protected by lock_sys shard latch.
bool dict_table_t::m_upgraded_instant {false} |
Set if table is upgraded instant table.
ulint dict_table_t::magic_n |
Magic number.
ib_mutex_t* dict_table_t::mutex |
Mutex of the table for concurrency access.
std::atomic<os_once::state_t> dict_table_t::mutex_created |
Creation state of mutex.
unsigned dict_table_t::n_cols |
Number of non-virtual columns.
unsigned dict_table_t::n_def |
Number of non-virtual columns defined so far.
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.
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.
unsigned dict_table_t::n_m_v_cols |
Number of multi-value virtual columns.
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:
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.
unsigned dict_table_t::n_t_cols |
Number of total columns (include virtual and non-virtual)
unsigned dict_table_t::n_t_def |
Number of total columns defined so far.
unsigned dict_table_t::n_v_cols |
Number of virtual columns.
unsigned dict_table_t::n_v_def |
Number of virtual columns defined so far.
table_name_t dict_table_t::name |
Table name.
hash_node_t dict_table_t::name_hash |
Hash chain node.
table_id_t dict_table_t::parent_id |
If FTS AUX table, parent table id.
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.
dict_foreign_set dict_table_t::referenced_set |
bool dict_table_t::refresh_fk |
refresh/reload FK info
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
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.
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.
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_id_t dict_table_t::space |
Space where the clustered index of the table is placed.
ulint dict_table_t::stat_clustered_index_size |
Approximate clustered index size in database pages.
unsigned dict_table_t::stat_initialized |
true if statistics have been calculated the first time after database startup or table creation.
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.
uint64_t dict_table_t::stat_n_rows |
Approximate number of rows in the table.
We periodically calculate new estimates.
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.
ulint dict_table_t::stat_sum_of_other_index_sizes |
Approximate size of other indexes in database pages.
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.
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.
std::chrono::steady_clock::time_point dict_table_t::stats_last_recalc |
Timestamp of last recalc of the stats.
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.
std::atomic<os_once::state_t> dict_table_t::stats_latch_created |
Statistics for query optimization.
Creation state of 'stats_latch'.
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.
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_vec* dict_table_t::temp_prebuilt |
multiple cursors can be active on this temporary table
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.
uint32_t dict_table_t::total_col_count {0} |
Total non-virtual column count.
table_name_t dict_table_t::trunc_name |
Truncate name.
std::atomic<std::chrono::system_clock::time_point> dict_table_t::update_time |
Timestamp of the last modification of this table.
const char* dict_table_t::v_col_names |
Virtual column names.
dict_v_col_t* dict_table_t::v_cols |
Array of virtual column descriptions.
dict_vcol_templ_t* dict_table_t::vc_templ |
mysql_row_templ_t for base columns used for compute the virtual columns
uint64_t dict_table_t::version |
metadata version number of dd::Table::se_private_data()