MySQL 8.0.39
Source Code Documentation
dict0dict.ic File Reference

Data dictionary system. More...

#include "data0type.h"
#include "dict0load.h"
#include "fsp0fsp.h"
#include "fsp0sysspace.h"
#include "rem0types.h"
#include "srv0srv.h"
#include "sync0rw.h"

Functions

static ulint dict_col_get_no (const dict_col_t *col)
 Gets the column number. More...
 
static ulint dict_col_get_clust_pos (const dict_col_t *col, const dict_index_t *clust_index)
 
static ulint dict_col_get_index_pos (const dict_col_t *col, const dict_index_t *index)
 Gets the column position in the given index. More...
 
static bool dict_index_has_desc (const dict_index_t *index)
 Check whether the index consists of descending columns only. More...
 
static bool dict_index_is_auto_gen_clust (const dict_index_t *index)
 Check if index is auto-generated clustered index. More...
 
static ulint dict_index_is_unique (const dict_index_t *index)
 Check whether the index is unique. More...
 
static ulint dict_index_is_spatial (const dict_index_t *index)
 Check whether the index is a Spatial Index. More...
 
static ulint dict_index_has_virtual (const dict_index_t *index)
 Check whether the index contains a virtual column. More...
 
static ulint dict_index_is_ibuf (const dict_index_t *index)
 Check whether the index is the insert buffer tree. More...
 
static ulint dict_index_is_sec_or_ibuf (const dict_index_t *index)
 Check whether the index is a secondary index or the insert buffer tree. More...
 
static ulint dict_table_get_n_tot_u_cols (const dict_table_t *table)
 Gets the number of user-defined virtual and non-virtual columns in a table in the dictionary cache. More...
 
static ulint dict_table_get_n_v_cols (const dict_table_t *table)
 Gets the number of virtual columns in a table in the dictionary cache. More...
 
static bool dict_table_has_indexed_v_cols (const dict_table_t *table)
 Check if a table has indexed virtual columns. More...
 
static uint64_t dict_table_get_n_rows (const dict_table_t *table)
 Gets the approximately estimated number of rows in the table. More...
 
static void dict_table_n_rows_inc (dict_table_t *table)
 Increment the number of rows in the table by one. More...
 
static void dict_table_n_rows_dec (dict_table_t *table)
 Decrement the number of rows in the table by one. More...
 
static dict_v_col_tdict_table_get_nth_v_col (const dict_table_t *table, ulint pos)
 Gets the nth virtual column of a table. More...
 
static ulint dict_table_get_sys_col_no (const dict_table_t *table, ulint sys)
 
static bool dict_table_is_comp (const dict_table_t *table)
 Check whether the table uses the compact page format. More...
 
static bool dict_table_has_fts_index (dict_table_t *table)
 
static bool dict_tf_is_valid (uint32_t flags)
 Validate the table flags. More...
 
static bool dict_tf2_is_valid (uint32_t flags, uint32_t flags2)
 Validate both table flags and table flags2 and make sure they are compatible. More...
 
static uint32_t dict_sys_tables_type_validate (uint32_t type, uint32_t n_cols)
 Validate a SYS_TABLES TYPE field and return it. More...
 
static rec_format_t dict_tf_get_rec_format (uint32_t flags)
 Determine the page format from dict_table_t::flags The low order bit will be zero for REDUNDANT and 1 for COMPACT. More...
 
static bool dict_table_has_atomic_blobs (const dict_table_t *table)
 Determine if a table uses atomic BLOBs (no locally stored prefix). More...
 
static void dict_tf_set (uint32_t *flags, rec_format_t format, uint32_t zip_ssize, bool use_data_dir, bool shared_space)
 Set the various values in a dict_table_t::flags pointer. More...
 
static uint32_t dict_tf_init (bool compact, ulint zip_ssize, bool atomic_blobs, bool data_dir, bool shared_space)
 Initialize a dict_table_t::flags pointer. More...
 
static uint32_t dict_sys_tables_type_to_tf (uint32_t type, uint32_t n_cols)
 Convert a 32 bit integer from SYS_TABLES.TYPE to dict_table_t::flags The following chart shows the translation of the low order bit. More...
 
static ulint dict_tf_to_sys_tables_type (uint32_t flags)
 Convert a 32 bit integer table flags to the 32bit integer that is written to a SYS_TABLES.TYPE field. More...
 
static const page_size_t dict_tf_get_page_size (uint32_t flags)
 Extract the page size info from table flags. More...
 
static const page_size_t dict_table_page_size (const dict_table_t *table)
 Get the table page size. More...
 
static void dict_table_x_lock_indexes (dict_table_t *table)
 Obtain exclusive locks on all index trees of the table. More...
 
static void dict_table_x_unlock_indexes (dict_table_t *table)
 Release the exclusive locks on all index tree. More...
 
static ulint dict_index_get_n_fields (const dict_index_t *index)
 Gets the number of fields in the internal representation of an index, including fields added by the dictionary system. More...
 
static ulint dict_index_get_n_unique (const dict_index_t *index)
 Gets the number of fields in the internal representation of an index that uniquely determine the position of an index entry in the index, if we do not take multiversioning into account: in the B-tree use the value returned by dict_index_get_n_unique_in_tree. More...
 
static ulint dict_index_get_n_unique_in_tree (const dict_index_t *index)
 Gets the number of fields in the internal representation of an index which uniquely determine the position of an index entry in the index, if we also take multiversioning into account. More...
 
static uint16_t dict_index_get_n_unique_in_tree_nonleaf (const dict_index_t *index)
 Gets the number of fields on nonleaf page level in the internal representation of an index which uniquely determine the position of an index entry in the index, if we also take multiversioning into account. More...
 
static ulint dict_index_get_n_ordering_defined_by_user (const dict_index_t *index)
 Gets the number of user-defined ordering fields in the index. More...
 
bool dict_table_is_compressed_temporary (const dict_table_t *table)
 Check if a table is a temporary table with compressed row format, we should always expect false. More...
 
static space_id_t dict_index_get_space (const dict_index_t *index)
 Gets the space id of the root of the index tree. More...
 
static void dict_index_set_space (dict_index_t *index, space_id_t space)
 Sets the space id of the root of the index tree. More...
 
static page_no_t dict_index_get_page (const dict_index_t *index)
 Gets the page number of the root of the index tree. More...
 
static rw_lock_tdict_index_get_lock (dict_index_t *index)
 Gets the read-write lock of the index tree. More...
 
static ulint dict_index_get_space_reserve (void)
 Returns free space reserved for future updates of records. More...
 
static enum online_index_status dict_index_get_online_status (const dict_index_t *index)
 Gets the status of online index creation. More...
 
static void dict_index_set_online_status (dict_index_t *index, enum online_index_status status)
 Sets the status of online index creation. More...
 
static bool dict_index_is_online_ddl (const dict_index_t *index)
 Determines if a secondary index is being or has been created online, or if the table is being rebuilt online, allowing concurrent modifications to the table. More...
 
static ulint dict_table_is_fts_column (ib_vector_t *indexes, ulint col_no, bool is_virtual)
 
static ulint dict_max_field_len_store_undo (dict_table_t *table, const dict_col_t *col)
 
static ulint dict_max_v_field_len_store_undo (dict_table_t *table, ulint col_no)
 Determine maximum bytes of a virtual column need to be stored in the undo log. More...
 
static void dict_table_prevent_eviction (dict_table_t *table)
 Prevent table eviction by moving a table to the non-LRU list from the LRU list if it is not already there. More...
 
static void dict_table_allow_eviction (dict_table_t *table)
 Allow the table to be evicted by moving a table to the LRU list from the non-LRU list if it is not already there. More...
 
static void dict_table_ddl_acquire (dict_table_t *table)
 Move this table to non-LRU list for DDL operations if it's currently not there. More...
 
static void dict_table_ddl_release (dict_table_t *table)
 Move this table to LRU list after DDL operations if it was moved to non-LRU list. More...
 
static bool dict_table_is_discarded (const dict_table_t *table)
 Check if the tablespace for the table has been discarded. More...
 
static bool dict_table_is_table_buffer (const dict_table_t *table)
 Check whether the table is DDTableBuffer. More...
 
static bool dict_table_in_shared_tablespace (const dict_table_t *table)
 Check if the table is in a shared tablespace (System or General). More...
 
static bool dict_table_is_locking_disabled (const dict_table_t *table)
 Check whether locking is disabled for this table. More...
 
static void dict_disable_redo_if_temporary (const dict_table_t *table, mtr_t *mtr)
 Turn-off redo-logging if temporary table. More...
 
static bool dict_table_is_file_per_table (const dict_table_t *table)
 Check if the table is found is a file_per_table tablespace. More...
 
static dict_index_tdict_table_get_index_on_first_col (dict_table_t *table, ulint col_index)
 Get index by first field of the index. More...
 
static row_id_t dict_table_get_next_table_sess_row_id (dict_table_t *table)
 Get table session row-id and increment the row-id counter for next use. More...
 
static trx_id_t dict_table_get_next_table_sess_trx_id (dict_table_t *table)
 Get table session trx-id and increment the trx-id counter for next use. More...
 
static trx_id_t dict_table_get_curr_table_sess_trx_id (const dict_table_t *table)
 Get current session trx-id. More...
 
void dict_table_mutex_alloc (void *table_void)
 Allocate the mutex of the given table. More...
 
bool dict_table_has_temp_general_tablespace_name (const char *tablespace_name)
 Check if tablespace name is "innodb_general". More...
 
static void dict_table_autoinc_persisted_update (dict_table_t *table, uint64_t autoinc)
 Update the persisted autoinc counter to specified one, we should hold autoinc_persisted_mutex. More...
 
static bool dict_table_has_autoinc_col (const dict_table_t *table)
 Check if a table has an autoinc counter column. More...
 
static void dict_table_autoinc_set_col_pos (dict_table_t *table, ulint pos)
 Set the column position of autoinc column in clustered index for a table. More...
 
static ulint dict_table_encode_n_col (ulint n_col, ulint n_v_col)
 Encode the number of columns and number of virtual columns in a 4 bytes value. More...
 
static void dict_table_decode_n_col (uint32_t encoded, uint32_t *n_col, uint32_t *n_v_col)
 decode number of virtual and non-virtual columns in one 4 bytes value. More...
 
static void dict_free_vc_templ (dict_vcol_templ_t *vc_templ)
 Free the virtual column template. More...
 
static bool dict_table_have_virtual_index (dict_table_t *table)
 Check whether the table have virtual index. More...
 
static void dict_allocate_mem_intrinsic_cache (dict_index_t *index)
 Allocate memory for intrinsic cache elements in the index. More...
 
static uint64_t dict_sdi_get_table_id (space_id_t space_id)
 Generate a table_id from space id for SDI Index. More...
 
static space_id_t dict_sdi_get_space_id (table_id_t table_id)
 Extract space_id from table_id for SDI Index. More...
 
static bool dict_index_is_sdi (const dict_index_t *index)
 Check if the index is SDI index. More...
 
static bool dict_table_is_sdi (table_id_t table_id)
 Check if an table id belongs SDI table. More...
 
static space_index_t dict_sdi_get_index_id ()
 Return a SDI Index id for given SDI copy. More...
 
static bool dict_table_is_partition (const dict_table_t *table)
 Check whether the dict_table_t is a partition. More...
 

Detailed Description

Data dictionary system.

Created 1/8/1996 Heikki Tuuri

Function Documentation

◆ dict_allocate_mem_intrinsic_cache()

static void dict_allocate_mem_intrinsic_cache ( dict_index_t index)
inlinestatic

Allocate memory for intrinsic cache elements in the index.

Parameters
[in]indexindex object

◆ dict_col_get_clust_pos()

static ulint dict_col_get_clust_pos ( const dict_col_t col,
const dict_index_t clust_index 
)
inlinestatic

◆ dict_col_get_index_pos()

static ulint dict_col_get_index_pos ( const dict_col_t col,
const dict_index_t index 
)
inlinestatic

Gets the column position in the given index.

Parameters
[in]coltable column
[in]indexindex to be searched for column
Returns
position of column in the given index.

◆ dict_col_get_no()

static ulint dict_col_get_no ( const dict_col_t col)
inlinestatic

Gets the column number.

Returns
col->ind, table column position (starting from 0)
Parameters
colin: column

◆ dict_disable_redo_if_temporary()

static void dict_disable_redo_if_temporary ( const dict_table_t table,
mtr_t mtr 
)
inlinestatic

Turn-off redo-logging if temporary table.

Parameters
tablein: table to check
mtrout: mini-transaction

◆ dict_free_vc_templ()

static void dict_free_vc_templ ( dict_vcol_templ_t vc_templ)
inlinestatic

Free the virtual column template.

Parameters
[in,out]vc_templvirtual column template

◆ dict_index_get_lock()

static rw_lock_t * dict_index_get_lock ( dict_index_t index)
inlinestatic

Gets the read-write lock of the index tree.

Returns
read-write lock
Parameters
indexin: index

◆ dict_index_get_n_fields()

static ulint dict_index_get_n_fields ( const dict_index_t index)
inlinestatic

Gets the number of fields in the internal representation of an index, including fields added by the dictionary system.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)

◆ dict_index_get_n_ordering_defined_by_user()

static ulint dict_index_get_n_ordering_defined_by_user ( const dict_index_t index)
inlinestatic

Gets the number of user-defined ordering fields in the index.

In the internal representation of clustered indexes we add the row id to the ordering fields to make a clustered index unique, but this function returns the number of fields the user defined in the index as ordering fields.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)

◆ dict_index_get_n_unique()

static ulint dict_index_get_n_unique ( const dict_index_t index)
inlinestatic

Gets the number of fields in the internal representation of an index that uniquely determine the position of an index entry in the index, if we do not take multiversioning into account: in the B-tree use the value returned by dict_index_get_n_unique_in_tree.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)

◆ dict_index_get_n_unique_in_tree()

static ulint dict_index_get_n_unique_in_tree ( const dict_index_t index)
inlinestatic

Gets the number of fields in the internal representation of an index which uniquely determine the position of an index entry in the index, if we also take multiversioning into account.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)

◆ dict_index_get_n_unique_in_tree_nonleaf()

static uint16_t dict_index_get_n_unique_in_tree_nonleaf ( const dict_index_t index)
inlinestatic

Gets the number of fields on nonleaf page level in the internal representation of an index which uniquely determine the position of an index entry in the index, if we also take multiversioning into account.

Note, it doesn't include page no field.

Parameters
[in]indexindex
Returns
number of fields

◆ dict_index_get_online_status()

static enum online_index_status dict_index_get_online_status ( const dict_index_t index)
inlinestatic

Gets the status of online index creation.

Returns
the status
Parameters
indexin: secondary index

◆ dict_index_get_page()

static page_no_t dict_index_get_page ( const dict_index_t index)
inlinestatic

Gets the page number of the root of the index tree.

Returns
page number
Parameters
indexin: index

◆ dict_index_get_space()

static space_id_t dict_index_get_space ( const dict_index_t index)
inlinestatic

Gets the space id of the root of the index tree.

Returns
space id
Parameters
indexin: index

◆ dict_index_get_space_reserve()

static ulint dict_index_get_space_reserve ( void  )
inlinestatic

Returns free space reserved for future updates of records.

This is relevant only in the case of many consecutive inserts, as updates which make the records bigger might fragment the index.

Returns
number of free bytes on page, reserved for updates

◆ dict_index_has_desc()

static bool dict_index_has_desc ( const dict_index_t index)
inlinestatic

Check whether the index consists of descending columns only.

Parameters
[in]indexindex tree
Return values
trueif index has any descending column
falseif index has only ascending columns

◆ dict_index_has_virtual()

static ulint dict_index_has_virtual ( const dict_index_t index)
inlinestatic

Check whether the index contains a virtual column.

Parameters
[in]indexindex
Returns
nonzero for the index has virtual column, zero for other indexes

◆ dict_index_is_auto_gen_clust()

static bool dict_index_is_auto_gen_clust ( const dict_index_t index)
inlinestatic

Check if index is auto-generated clustered index.

Parameters
[in]indexindex
Returns
true if index is auto-generated clustered index.

◆ dict_index_is_ibuf()

static ulint dict_index_is_ibuf ( const dict_index_t index)
inlinestatic

Check whether the index is the insert buffer tree.

Returns
nonzero for insert buffer, zero for other indexes
Parameters
indexin: index

◆ dict_index_is_online_ddl()

static bool dict_index_is_online_ddl ( const dict_index_t index)
inlinestatic

Determines if a secondary index is being or has been created online, or if the table is being rebuilt online, allowing concurrent modifications to the table.

Return values
trueif the index is being or has been built online, or if this is a clustered index and the table is being or has been rebuilt online
falseif the index has been created or the table has been rebuilt completely
Parameters
indexin: index

◆ dict_index_is_sdi()

static bool dict_index_is_sdi ( const dict_index_t index)
inlinestatic

Check if the index is SDI index.

Parameters
[in]indexin-memory index structure
Returns
true if index is SDI index else false

◆ dict_index_is_sec_or_ibuf()

static ulint dict_index_is_sec_or_ibuf ( const dict_index_t index)
inlinestatic

Check whether the index is a secondary index or the insert buffer tree.

Returns
nonzero for insert buffer, zero for other indexes
Parameters
indexin: index

◆ dict_index_is_spatial()

static ulint dict_index_is_spatial ( const dict_index_t index)
inlinestatic

Check whether the index is a Spatial Index.

Returns
nonzero for Spatial Index, zero for other indexes
Parameters
indexin: index

◆ dict_index_is_unique()

static ulint dict_index_is_unique ( const dict_index_t index)
inlinestatic

Check whether the index is unique.

Returns
nonzero for unique index, zero for other indexes
Parameters
indexin: index

◆ dict_index_set_online_status()

static void dict_index_set_online_status ( dict_index_t index,
enum online_index_status  status 
)
inlinestatic

Sets the status of online index creation.

Parameters
indexin/out: index
statusin: status

◆ dict_index_set_space()

static void dict_index_set_space ( dict_index_t index,
space_id_t  space 
)
inlinestatic

Sets the space id of the root of the index tree.

Parameters
indexin/out: index
spacein: space id

◆ dict_max_field_len_store_undo()

static ulint dict_max_field_len_store_undo ( dict_table_t table,
const dict_col_t col 
)
inlinestatic

◆ dict_max_v_field_len_store_undo()

static ulint dict_max_v_field_len_store_undo ( dict_table_t table,
ulint  col_no 
)
inlinestatic

Determine maximum bytes of a virtual column need to be stored in the undo log.

Parameters
[in]tabledict_table_t for the table
[in]col_novirtual column number
Returns
maximum bytes of virtual column to be stored in the undo log

◆ dict_sdi_get_index_id()

static space_index_t dict_sdi_get_index_id ( )
inlinestatic

Return a SDI Index id for given SDI copy.

Returns
index_id for SDI copy

◆ dict_sdi_get_space_id()

static space_id_t dict_sdi_get_space_id ( table_id_t  table_id)
inlinestatic

Extract space_id from table_id for SDI Index.

Parameters
[in]table_idInnoDB table id
Returns
space_id

◆ dict_sdi_get_table_id()

static uint64_t dict_sdi_get_table_id ( space_id_t  space_id)
inlinestatic

Generate a table_id from space id for SDI Index.

Parameters
[in]space_idInnoDB tablespace id
Returns
table_id

◆ dict_sys_tables_type_to_tf()

static uint32_t dict_sys_tables_type_to_tf ( uint32_t  type,
uint32_t  n_cols 
)
inlinestatic

Convert a 32 bit integer from SYS_TABLES.TYPE to dict_table_t::flags The following chart shows the translation of the low order bit.

Other bits are the same. ========================= Low order bit ========================== | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC SYS_TABLES.TYPE | 1 | 1 | 1

dict_table_t::flags | 0 | 1 | 1

Returns
ulint containing SYS_TABLES.TYPE
Parameters
typein: SYS_TABLES.TYPE field
n_colsin: SYS_TABLES.N_COLS field

◆ dict_sys_tables_type_validate()

static uint32_t dict_sys_tables_type_validate ( uint32_t  type,
uint32_t  n_cols 
)
inlinestatic

Validate a SYS_TABLES TYPE field and return it.

Returns
Same as input after validating it as a SYS_TABLES TYPE field. If there is an error, return ULINT_UNDEFINED.
Parameters
typein: SYS_TABLES.TYPE
n_colsin: SYS_TABLES.N_COLS

◆ dict_table_allow_eviction()

static void dict_table_allow_eviction ( dict_table_t table)
inlinestatic

Allow the table to be evicted by moving a table to the LRU list from the non-LRU list if it is not already there.

Parameters
[in]tableInnoDB table object can be evicted

◆ dict_table_autoinc_persisted_update()

static void dict_table_autoinc_persisted_update ( dict_table_t table,
uint64_t  autoinc 
)
inlinestatic

Update the persisted autoinc counter to specified one, we should hold autoinc_persisted_mutex.

Parameters
[in,out]tabletable
[in]autoincset autoinc_persisted to this value

◆ dict_table_autoinc_set_col_pos()

static void dict_table_autoinc_set_col_pos ( dict_table_t table,
ulint  pos 
)
inlinestatic

Set the column position of autoinc column in clustered index for a table.

Parameters
[in]tabletable
[in]poscolumn position in table definition

◆ dict_table_ddl_acquire()

static void dict_table_ddl_acquire ( dict_table_t table)
inlinestatic

Move this table to non-LRU list for DDL operations if it's currently not there.

This also prevents later opening table via DD objects, when the table name in InnoDB doesn't match with DD object.

Parameters
[in,out]tableTable to put in non-LRU list

◆ dict_table_ddl_release()

static void dict_table_ddl_release ( dict_table_t table)
inlinestatic

Move this table to LRU list after DDL operations if it was moved to non-LRU list.

Parameters
[in,out]tableTable to put in LRU list

◆ dict_table_decode_n_col()

static void dict_table_decode_n_col ( uint32_t  encoded,
uint32_t *  n_col,
uint32_t *  n_v_col 
)
inlinestatic

decode number of virtual and non-virtual columns in one 4 bytes value.

Parameters
[in]encodedencoded value
[in,out]n_colnumber of non-virtual column
[in,out]n_v_colnumber of virtual column

◆ dict_table_encode_n_col()

static ulint dict_table_encode_n_col ( ulint  n_col,
ulint  n_v_col 
)
inlinestatic

Encode the number of columns and number of virtual columns in a 4 bytes value.

We could do this because the number of columns in InnoDB is limited to 1017

Parameters
[in]n_colnumber of non-virtual column
[in]n_v_colnumber of virtual column
Returns
encoded value

◆ dict_table_get_curr_table_sess_trx_id()

static trx_id_t dict_table_get_curr_table_sess_trx_id ( const dict_table_t table)
inlinestatic

Get current session trx-id.

Parameters
[in]tabletable handler
Returns
table session trx-id.

◆ dict_table_get_index_on_first_col()

static dict_index_t * dict_table_get_index_on_first_col ( dict_table_t table,
ulint  col_index 
)
inlinestatic

Get index by first field of the index.

Returns
index which is having first field matches with the field present in field_index position of table

Decrement the col_index if the virtual column encountered before the col_index of the table.

Parameters
tablein: table
col_indexin: position of column in table

◆ dict_table_get_n_rows()

static uint64_t dict_table_get_n_rows ( const dict_table_t table)
inlinestatic

Gets the approximately estimated number of rows in the table.

Returns
estimated number of rows
Parameters
tablein: table

◆ dict_table_get_n_tot_u_cols()

static ulint dict_table_get_n_tot_u_cols ( const dict_table_t table)
inlinestatic

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

Parameters
[in]tabletable
Returns
number of user-defined (e.g., not ROW_ID) columns of a table

◆ dict_table_get_n_v_cols()

static ulint dict_table_get_n_v_cols ( const dict_table_t table)
inlinestatic

Gets the number of virtual columns in a table in the dictionary cache.

Parameters
[in]tablethe table to check
Returns
number of virtual columns of a table

◆ dict_table_get_next_table_sess_row_id()

static row_id_t dict_table_get_next_table_sess_row_id ( dict_table_t table)
inlinestatic

Get table session row-id and increment the row-id counter for next use.

Parameters
[in,out]tabletable handler
Returns
next table session row-id.

◆ dict_table_get_next_table_sess_trx_id()

static trx_id_t dict_table_get_next_table_sess_trx_id ( dict_table_t table)
inlinestatic

Get table session trx-id and increment the trx-id counter for next use.

Parameters
[in,out]tabletable handler
Returns
next table session trx-id.

◆ dict_table_get_nth_v_col()

static dict_v_col_t * dict_table_get_nth_v_col ( const dict_table_t table,
ulint  pos 
)
inlinestatic

Gets the nth virtual column of a table.

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

◆ dict_table_get_sys_col_no()

static ulint dict_table_get_sys_col_no ( const dict_table_t table,
ulint  sys 
)
inlinestatic

◆ dict_table_has_atomic_blobs()

static bool dict_table_has_atomic_blobs ( const dict_table_t table)
inlinestatic

Determine if a table uses atomic BLOBs (no locally stored prefix).

Parameters
[in]tableInnoDB table
Returns
whether BLOBs are atomic

◆ dict_table_has_autoinc_col()

static bool dict_table_has_autoinc_col ( const dict_table_t table)
inlinestatic

Check if a table has an autoinc counter column.

Parameters
[in]tabletable
Returns
true if there is an autoinc column in the table, otherwise false.

◆ dict_table_has_fts_index()

static bool dict_table_has_fts_index ( dict_table_t table)
inlinestatic

◆ dict_table_has_indexed_v_cols()

static bool dict_table_has_indexed_v_cols ( const dict_table_t table)
inlinestatic

Check if a table has indexed virtual columns.

Parameters
[in]tablethe table to check
Returns
true is the table has indexed virtual columns

◆ dict_table_has_temp_general_tablespace_name()

bool dict_table_has_temp_general_tablespace_name ( const char *  tablespace_name)
inline

Check if tablespace name is "innodb_general".

Parameters
[in]tablespace_nametablespace name
Return values
trueif name is "innodb_general"
falseif name is not "innodb_general"

◆ dict_table_have_virtual_index()

static bool dict_table_have_virtual_index ( dict_table_t table)
inlinestatic

Check whether the table have virtual index.

Parameters
[in]tableInnoDB table
Returns
true if the table have virtual index, false otherwise.

◆ dict_table_in_shared_tablespace()

static bool dict_table_in_shared_tablespace ( const dict_table_t table)
inlinestatic

Check if the table is in a shared tablespace (System or General).

Parameters
[in]tabletable to check
Returns
true if table is in shared tablespace, false if not.

◆ dict_table_is_comp()

static bool dict_table_is_comp ( const dict_table_t table)
inlinestatic

Check whether the table uses the compact page format.

Returns
true if table uses the compact page format
Parameters
tablein: table

◆ dict_table_is_compressed_temporary()

bool dict_table_is_compressed_temporary ( const dict_table_t table)
inline

Check if a table is a temporary table with compressed row format, we should always expect false.

Parameters
[in]tabletable
Returns
true if it's a compressed temporary table, false otherwise

◆ dict_table_is_discarded()

static bool dict_table_is_discarded ( const dict_table_t table)
inlinestatic

Check if the tablespace for the table has been discarded.

Returns
true if the tablespace has been discarded.
Parameters
tablein: table to check

◆ dict_table_is_file_per_table()

static bool dict_table_is_file_per_table ( const dict_table_t table)
inlinestatic

Check if the table is found is a file_per_table tablespace.

This test does not use table flags2 since some REDUNDANT tables in the system tablespace may have garbage in the MIX_LEN field where flags2 is stored. These garbage MIX_LEN fields were written before v3.23.52. A patch was added to v3.23.52 which initializes the MIX_LEN field to 0. Since file-per-table tablespaces were added in 4.1, any SYS_TABLES record with a non-zero space ID will have a reliable MIX_LEN field. However, this test does not use flags2 from SYS_TABLES.MIX_LEN. Instead, assume that if the tablespace is not a predefined system tablespace and it is not a general shared tablespace, then it must be file-per-table. Also, during ALTER TABLE, the DICT_TF2_USE_FILE_PER_TABLE flag may not be set on one of the file-per-table tablespaces. This test cannot be done on a table in the process of being created because the space_id will be zero until the tablespace is created.

Parameters
[in]tableAn existing open table to check
Returns
true if this table was created as a file-per-table tablespace.
Parameters
tablein: table to check

◆ dict_table_is_fts_column()

static ulint dict_table_is_fts_column ( ib_vector_t indexes,
ulint  col_no,
bool  is_virtual 
)
inlinestatic

◆ dict_table_is_locking_disabled()

static bool dict_table_is_locking_disabled ( const dict_table_t table)
inlinestatic

Check whether locking is disabled for this table.

Currently this is done for intrinsic table as their visibility is limited to the connection and the DDTableBuffer as it's protected by dict_persist->mutex.

Parameters
[in]tabletable to check
Returns
true if locking is disabled.

◆ dict_table_is_partition()

static bool dict_table_is_partition ( const dict_table_t table)
inlinestatic

Check whether the dict_table_t is a partition.

A partitioned table on the SQL level is composed of InnoDB tables, where each InnoDB table is a [sub]partition including its secondary indexes which belongs to the partition.

Parameters
[in]tableTable to check.
Returns
true if the dict_table_t is a partition else false.

◆ dict_table_is_sdi()

static bool dict_table_is_sdi ( table_id_t  table_id)
inlinestatic

Check if an table id belongs SDI table.

Parameters
[in]table_iddict_table_t id
Returns
true if table_id is SDI table_id else false

◆ dict_table_is_table_buffer()

static bool dict_table_is_table_buffer ( const dict_table_t table)
inlinestatic

Check whether the table is DDTableBuffer.

See class DDTableBuffer

Parameters
[in]tabletable to check
Returns
true if this is a DDTableBuffer table.

◆ dict_table_mutex_alloc()

void dict_table_mutex_alloc ( void *  table_void)
inline

Allocate the mutex of the given table.

This function must not be called concurrently on the same table object.

Parameters
[in]table_voidtable whose mutex to create

◆ dict_table_n_rows_dec()

static void dict_table_n_rows_dec ( dict_table_t table)
inlinestatic

Decrement the number of rows in the table by one.

Notice that this operation is not protected by any latch, the number is approximate.

Parameters
tablein/out: table

◆ dict_table_n_rows_inc()

static void dict_table_n_rows_inc ( dict_table_t table)
inlinestatic

Increment the number of rows in the table by one.

Notice that this operation is not protected by any latch, the number is approximate.

Parameters
tablein/out: table

◆ dict_table_page_size()

static const page_size_t dict_table_page_size ( const dict_table_t table)
inlinestatic

Get the table page size.

Parameters
[in]tabletable
Returns
a structure containing the compressed and uncompressed page sizes and a boolean indicating if the page is compressed

◆ dict_table_prevent_eviction()

static void dict_table_prevent_eviction ( dict_table_t table)
inlinestatic

Prevent table eviction by moving a table to the non-LRU list from the LRU list if it is not already there.

Parameters
tablein: table to prevent eviction

◆ dict_table_x_lock_indexes()

static void dict_table_x_lock_indexes ( dict_table_t table)
inlinestatic

Obtain exclusive locks on all index trees of the table.

This is to prevent accessing index trees while InnoDB is updating internal metadata for operations such as FLUSH TABLES.

Parameters
tablein: table

◆ dict_table_x_unlock_indexes()

static void dict_table_x_unlock_indexes ( dict_table_t table)
inlinestatic

Release the exclusive locks on all index tree.

Parameters
tablein: table

◆ dict_tf2_is_valid()

static bool dict_tf2_is_valid ( uint32_t  flags,
uint32_t  flags2 
)
inlinestatic

Validate both table flags and table flags2 and make sure they are compatible.

Parameters
[in]flagsTable flags
[in]flags2Table flags2
Returns
true if valid.

◆ dict_tf_get_page_size()

static const page_size_t dict_tf_get_page_size ( uint32_t  flags)
inlinestatic

Extract the page size info from table flags.

Parameters
[in]flagsflags
Returns
a structure containing the compressed and uncompressed page sizes and a boolean indicating if the page is compressed.

◆ dict_tf_get_rec_format()

static rec_format_t dict_tf_get_rec_format ( uint32_t  flags)
inlinestatic

Determine the page format from dict_table_t::flags The low order bit will be zero for REDUNDANT and 1 for COMPACT.

For any other row_format, flags is nonzero and DICT_TF_COMPACT will also be set.

Returns
file format version
Parameters
flagsin: dict_table_t::flags

◆ dict_tf_init()

static uint32_t dict_tf_init ( bool  compact,
ulint  zip_ssize,
bool  atomic_blobs,
bool  data_dir,
bool  shared_space 
)
inlinestatic

Initialize a dict_table_t::flags pointer.

Parameters
[in]compactTable uses Compact or greater
[in]zip_ssizeZip Shift Size (log 2 minus 9)
[in]atomic_blobsTable uses Compressed or Dynamic
[in]data_dirTable uses DATA DIRECTORY
[in]shared_spaceTable uses a General Shared Tablespace

◆ dict_tf_is_valid()

static bool dict_tf_is_valid ( uint32_t  flags)
inlinestatic

Validate the table flags.

Parameters
[in]flagsTable flags
Returns
true if valid.

◆ dict_tf_set()

static void dict_tf_set ( uint32_t *  flags,
rec_format_t  format,
uint32_t  zip_ssize,
bool  use_data_dir,
bool  shared_space 
)
inlinestatic

Set the various values in a dict_table_t::flags pointer.

Parameters
[in,out]flagsPointer to a 4 byte Table Flags
[in]formatFile Format
[in]zip_ssizeZip Shift Size
[in]use_data_dirTable uses DATA DIRECTORY
[in]shared_spaceTable uses a General Shared Tablespace

◆ dict_tf_to_sys_tables_type()

static ulint dict_tf_to_sys_tables_type ( uint32_t  flags)
inlinestatic

Convert a 32 bit integer table flags to the 32bit integer that is written to a SYS_TABLES.TYPE field.

The following chart shows the translation of the low order bit. Other bits are the same. ========================= Low order bit ========================== | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC dict_table_t::flags | 0 | 1 | 1

SYS_TABLES.TYPE | 1 | 1 | 1

Returns
ulint containing SYS_TABLES.TYPE
Parameters
flagsin: dict_table_t::flags