MySQL 8.3.0
Source Code Documentation
dict0dd.h File Reference

Data dictionary interface. More...

#include "dict0dict.h"
#include "dict0mem.h"
#include "dict0types.h"
#include "my_compiler.h"
#include "univ.i"
#include "dd/cache/dictionary_client.h"
#include "dd/dd.h"
#include "dd/dd_schema.h"
#include "dd/dd_table.h"
#include "dd/dictionary.h"
#include "dd/properties.h"
#include "dd/types/column.h"
#include "dd/types/foreign_key.h"
#include "dd/types/foreign_key_element.h"
#include "dd/types/index.h"
#include "dd/types/index_element.h"
#include "dd/types/partition.h"
#include "dd/types/partition_index.h"
#include "dd/types/table.h"
#include "dd/types/tablespace.h"
#include "dd/types/tablespace_file.h"
#include "dd_table_share.h"
#include "sess0sess.h"
#include "mysql_version.h"
#include "dict0dd.ic"

Go to the source code of this file.

Classes

struct  innodb_dd_table_t
 Hard-coded data dictionary information. More...
 
class  DD_instant_col_val_coder
 Class to decode or encode a stream of default value for instant table. More...
 

Typedefs

using Columns = std::vector< Field * >
 

Enumerations

enum  dd_table_keys {
  DD_TABLE_AUTOINC , DD_TABLE_DATA_DIRECTORY , DD_TABLE_VERSION , DD_TABLE_DISCARD ,
  DD_TABLE_INSTANT_COLS , DD_TABLE__LAST
}
 InnoDB private keys for dd::Table. More...
 
enum  dd_column_keys {
  DD_INSTANT_COLUMN_DEFAULT , DD_INSTANT_COLUMN_DEFAULT_NULL , DD_INSTANT_VERSION_ADDED , DD_INSTANT_VERSION_DROPPED ,
  DD_INSTANT_PHYSICAL_POS , DD_COLUMN__LAST
}
 InnoDB private keys for dd::Column. More...
 
enum  dd_partition_keys { DD_PARTITION_ROW_FORMAT , DD_PARTITION_INSTANT_COLS , DD_PARTITION_DISCARD , DD_PARTITION__LAST }
 InnoDB private keys for dd::Partition. More...
 
enum  dd_space_keys {
  DD_SPACE_FLAGS , DD_SPACE_ID , DD_SPACE_DISCARD , DD_SPACE_SERVER_VERSION ,
  DD_SPACE_VERSION , DD_SPACE_STATE , DD_SPACE__LAST
}
 InnoDB private keys for dd::Tablespace. More...
 
enum  dd_space_states {
  DD_SPACE_STATE_NORMAL , DD_SPACE_STATE_DISCARDED , DD_SPACE_STATE_CORRUPTED , DD_SPACE_STATE_ACTIVE ,
  DD_SPACE_STATE_INACTIVE , DD_SPACE_STATE_EMPTY , DD_SPACE_STATE__LAST
}
 Values for InnoDB private key "state" for dd::Tablespace. More...
 
enum  dd_index_keys {
  DD_INDEX_ID , DD_INDEX_SPACE_ID , DD_TABLE_ID , DD_INDEX_ROOT ,
  DD_INDEX_TRX_ID , DD_INDEX__LAST
}
 InnoDB private keys for dd::Index or dd::Partition_index. More...
 

Functions

bool dd_is_valid_row_version (uint32_t version)
 Determine if give version is a valid row version. More...
 
bool dd_column_is_added (const dd::Column *dd_col)
 Determine if column is INSTANT ADD. More...
 
bool dd_column_is_dropped (const dd::Column *dd_col)
 Determine if column is INSTANT DROP. More...
 
uint32_t dd_column_get_version_added (const dd::Column *dd_col)
 Get the row version in which column is INSTANT ADD. More...
 
uint32_t dd_column_get_version_dropped (const dd::Column *dd_col)
 Get the row version in which column is INSTANT DROP. More...
 
static const dd::String_type index_file_name_key ("index_file_name")
 dd::Partition::options() key for INDEX DIRECTORY More...
 
static const dd::String_type data_file_name_key ("data_file_name")
 dd::Partition::options() key for DATA DIRECTORY More...
 
static const dd::String_type dd_tables_name ("mysql/tables")
 Table names needed to process I_S queries. More...
 
static const dd::String_type dd_partitions_name ("mysql/table_partitions")
 
static const dd::String_type dd_tablespaces_name ("mysql/tablespaces")
 
static const dd::String_type dd_indexes_name ("mysql/indexes")
 
static const dd::String_type dd_columns_name ("mysql/columns")
 
uint32_t dd_get_total_indexes_num ()
 
bool dd_part_is_first (const dd::Partition *dd_part)
 Determine if a dd::Partition is the first leaf partition in the table. More...
 
bool dd_table_is_partitioned (const dd::Table &table)
 Determine if a dd::Table is partitioned table. More...
 
bool dd_instant_columns_consistent (const dd::Table &dd_table)
 Check if the instant columns are consistent with the se_private_data in dd::Table. More...
 
bool dd_table_is_upgraded_instant (const dd::Table &table)
 Determine if a dd::Table has any INSTANT ADD column(s) in V1. More...
 
bool dd_table_has_instant_add_cols (const dd::Table &table)
 Determine if dd::Table has INSTANT ADD columns. More...
 
bool dd_table_has_instant_drop_cols (const dd::Table &table)
 Determine if dd::Table has INSTANT DROPPED columns. More...
 
static bool is_system_column (const char *col_name)
 
void dd_table_get_column_counters (const dd::Table &table, uint32_t &i_c, uint32_t &c_c, uint32_t &t_c, uint32_t &current_row_version)
 Set different column counters. More...
 
bool dd_table_has_row_versions (const dd::Table &table)
 Determine if a dd::Table has row versions. More...
 
bool dd_table_has_instant_cols (const dd::Table &table)
 Determine if a dd::Table has any INSTANTly ADDed/DROPped column. More...
 
bool dd_part_has_instant_cols (const dd::Partition &part)
 Determine if a dd::Partition has any instant column. More...
 
bool dd_table_part_has_instant_cols (const dd::Table &table)
 Determine if any partition of the table still has instant columns. More...
 
bool dd_is_discarded (const dd::Table &table)
 Determine if dd::Table is discarded. More...
 
bool dd_is_discarded (const dd::Partition &partition)
 Determine if dd::Partition is discarded. More...
 
void dd_set_discarded (dd::Table &table, bool discard)
 Sets appropriate discard attribute of dd::Table Please note that this function must not be called on partitioned tables. More...
 
void dd_set_discarded (dd::Partition &partition, bool discard)
 Sets appropriate discard attribute of dd::Partition Please note that this function can be only called on leaf_partitions. More...
 
template<typename Table , typename Index >
const Index * dd_first (const Table *table)
 Get the first index of a table or partition. More...
 
const dd::Indexdd_first_index (const dd::Table *table)
 Get the first index of a table. More...
 
const dd::Partition_indexdd_first_index (const dd::Partition *partition)
 Get the first index of a partition. More...
 
bool dd_part_is_stored (const dd::Partition *part)
 Determine if a partition is materialized. More...
 
dd::Object_id dd_get_space_id (const dd::Table &table)
 Get the explicit dd::Tablespace::id of a table. More...
 
dd::Object_id dd_get_space_id (const dd::Partition &partition)
 Get the explicit dd::Tablespace::id of a partition. More...
 
void dd_set_autoinc (dd::Properties &se_private_data, uint64_t autoinc)
 Set the AUTO_INCREMENT attribute. More...
 
uint64_t dd_get_version (const dd::Table *dd_table)
 Get the version attribute. More...
 
void dd_copy_autoinc (const dd::Properties &src, dd::Properties &dest)
 Copy the AUTO_INCREMENT and version attribute if exist. More...
 
void dd_copy_instant_n_cols (dd::Table &new_table, const dd::Table &old_table)
 Copy the metadata of a table definition if there was an instant ADD COLUMN happened. More...
 
template<typename Table >
void dd_copy_private (Table &new_table, const Table &old_table)
 Copy the engine-private parts of a table or partition definition when the change does not affect InnoDB. More...
 
void dd_copy_table_columns (const Alter_inplace_info *ha_alter_info, dd::Table &new_table, const dd::Table &old_table, dict_table_t *dict_table)
 Copy the engine-private parts of column definitions of a table. More...
 
void dd_copy_table (const Alter_inplace_info *ha_alter_info, dd::Table &new_table, const dd::Table &old_table)
 Copy the metadata of a table definition, including the INSTANT ADD COLUMN information. More...
 
void dd_part_adjust_table_id (dd::Table *new_table)
 Adjust TABLE_ID for partitioned table after ALTER TABLE ... PARTITION. More...
 
bool dd_drop_instant_columns (const dd::Table *old_dd_table, dd::Table *new_dd_table, dict_table_t *new_table, const Columns &cols_to_drop, const Columns &cols_to_add, Alter_inplace_info *ha_alter_info)
 Drop column instantly. More...
 
bool dd_add_instant_columns (const dd::Table *old_dd_table, dd::Table *new_dd_table, dict_table_t *new_table, const Columns &cols_to_add)
 Add column default values for new instantly added columns. More...
 
dberr_t dd_clear_instant_table (dd::Table &dd_table, bool clear_version)
 Clear the instant ADD COLUMN information of a table. More...
 
void dd_clear_instant_part (dd::Partition &dd_part)
 Clear the instant ADD COLUMN information of a partition, to make it as a normal partition. More...
 
bool dd_match_default_value (const dd::Column *dd_col, const dict_col_t *col)
 Compare the default values between imported column and column defined in the server. More...
 
void dd_write_default_value (const dict_col_t *col, dd::Column *dd_col)
 Write default value of a column to dd::Column. More...
 
void dd_import_instant_add_columns (const dict_table_t *table, dd::Table *dd_table)
 Import all metadata which is related to instant ADD COLUMN of a table to dd::Table. More...
 
template<typename Table >
void dd_write_table (dd::Object_id dd_space_id, Table *dd_table, const dict_table_t *table)
 Write metadata of a table to dd::Table. More...
 
template<typename Table >
void dd_set_table_options (Table *dd_table, const dict_table_t *table)
 Set options of dd::Table according to InnoDB table object. More...
 
void dd_update_v_cols (dd::Table *dd_table, table_id_t id)
 Update virtual columns with new se_private_data, currently, only table_id is set. More...
 
void dd_write_tablespace (dd::Tablespace *dd_space, space_id_t space_id, uint32_t fsp_flags, dd_space_states state)
 Write metadata of a tablespace to dd::Tablespace. More...
 
void dd_add_fts_doc_id_index (dd::Table &new_table, const dd::Table &old_table)
 Add fts doc id column and index to new table when old table has hidden fts doc id without fulltext index. More...
 
template<typename Index >
const dict_index_tdd_find_index (const dict_table_t *table, Index *dd_index)
 Find the specified dd::Index or dd::Partition_index in an InnoDB table. More...
 
static bool dd_mdl_acquire (THD *thd, MDL_ticket **mdl, const char *db, const char *table)
 Acquire a shared metadata lock. More...
 
void dd_mdl_release (THD *thd, MDL_ticket **mdl)
 Release a metadata lock. More...
 
THDdd_thd_for_undo (const trx_t *trx)
 Returns thd associated with the trx or current_thd. More...
 
bool dd_mdl_for_undo (const trx_t *trx)
 Check if current undo needs a MDL or not. More...
 
dberr_t dd_table_load_fk_from_dd (dict_table_t *m_table, const dd::Table *dd_table, const char **col_names, dict_err_ignore_t ignore_err, bool dict_locked)
 Load foreign key constraint info for the dd::Table object. More...
 
const rec_tdd_startscan_system (THD *thd, MDL_ticket **mdl, btr_pcur_t *pcur, mtr_t *mtr, const char *system_table_name, dict_table_t **table)
 Scan a new dd system table, like mysql.tables... More...
 
const char * dd_process_dd_tables_rec_and_mtr_commit (mem_heap_t *heap, const rec_t *rec, dict_table_t **table, dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr)
 Process one mysql.tables record and get the dict_table_t. More...
 
const char * dd_process_dd_partitions_rec_and_mtr_commit (mem_heap_t *heap, const rec_t *rec, dict_table_t **table, dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr)
 Process one mysql.table_partitions record and get the dict_table_t. More...
 
bool dd_process_dd_columns_rec (mem_heap_t *heap, const rec_t *rec, dict_col_t *col, table_id_t *table_id, char **col_name, ulint *nth_v_col, const dict_table_t *dd_columns, mtr_t *mtr)
 Process one mysql.columns record and get info to dict_col_t. More...
 
bool dd_process_dd_virtual_columns_rec (mem_heap_t *heap, const rec_t *rec, table_id_t *table_id, ulint **pos, ulint **base_pos, ulint *n_row, dict_table_t *dd_columns, mtr_t *mtr)
 Process one mysql.columns record for virtual columns. More...
 
const rec_tdd_getnext_system_rec (btr_pcur_t *pcur, mtr_t *mtr)
 Get next record of new DD system tables. More...
 
bool dd_process_dd_indexes_rec (mem_heap_t *heap, const rec_t *rec, const dict_index_t **index, MDL_ticket **mdl, dict_table_t **parent, MDL_ticket **parent_mdl, dict_table_t *dd_indexes, mtr_t *mtr)
 Process one mysql.indexes record and get the dict_index_t. More...
 
bool dd_process_dd_indexes_rec_simple (mem_heap_t *heap, const rec_t *rec, space_index_t *index_id, space_id_t *space_id, dict_table_t *dd_indexes)
 Process one mysql.indexes record and get brief info to dict_index_t. More...
 
bool dd_process_dd_tablespaces_rec (mem_heap_t *heap, const rec_t *rec, space_id_t *space_id, char **name, uint32_t *flags, uint32_t *server_version, uint32_t *space_version, bool *is_encrypted, uint64_t *autoextend_size, dd::String_type *state, dict_table_t *dd_spaces)
 Process one mysql.tablespaces record and get info. More...
 
template<typename Table >
void dd_get_and_save_data_dir_path (dict_table_t *table, const Table *dd_table, bool dict_mutex_own)
 Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY was used. More...
 
template<typename Table >
void dd_get_and_save_space_name (dict_table_t *table, const Table *dd_table, bool dict_mutex_own)
 Make sure the tablespace name is saved in dict_table_t if the table uses a general tablespace. More...
 
void dd_get_meta_data_filename (dict_table_t *table, dd::Table *dd_table, char *filename, ulint max_len)
 Get the meta-data filename from the table name for a single-table tablespace. More...
 
dberr_t dd_table_load_fk (dd::cache::Dictionary_client *client, const char *tbl_name, const char **col_names, dict_table_t *m_table, const dd::Table *dd_table, THD *thd, bool dict_locked, bool check_charsets, dict_names_t *fk_tables)
 Load foreign key constraint for the table. More...
 
dberr_t dd_table_check_for_child (dd::cache::Dictionary_client *client, const char *tbl_name, const char **col_names, dict_table_t *m_table, bool check_charsets, dict_err_ignore_t ignore_err, dict_names_t *fk_tables)
 Load foreign key constraint for the table. More...
 
int acquire_uncached_table (THD *thd, dd::cache::Dictionary_client *client, const dd::Table *dd_table, const char *name, TABLE_SHARE *ts, TABLE *td)
 Open uncached table definition based on a Global DD object. More...
 
void release_uncached_table (TABLE_SHARE *ts, TABLE *td)
 free uncached table definition. More...
 
int dd_table_open_on_dd_obj (THD *thd, dd::cache::Dictionary_client *client, const dd::Table &dd_table, const dd::Partition *dd_part, const char *tbl_name, dict_table_t *&table, const TABLE *td)
 Instantiate an InnoDB in-memory table metadata (dict_table_t) based on a Global DD object or MYSQL table definition. More...
 
dict_table_tdd_table_open_on_id (table_id_t table_id, THD *thd, MDL_ticket **mdl, bool dict_locked, bool check_corruption)
 Open a persistent InnoDB table based on InnoDB table id, and hold Shared MDL lock on it. More...
 
void dd_table_close (dict_table_t *table, THD *thd, MDL_ticket **mdl, bool dict_locked)
 Close an internal InnoDB table handle. More...
 
bool dd_table_discard_tablespace (THD *thd, const dict_table_t *table, dd::Table *table_def, bool discard)
 Set the discard flag for a non-partitioned dd table. More...
 
dict_table_tdd_table_open_on_name (THD *thd, MDL_ticket **mdl, const char *name, bool dict_locked, ulint ignore_err, int *error=nullptr)
 Open an internal handle to a persistent InnoDB table by name. More...
 
static dict_table_tdd_table_open_on_id_in_mem (table_id_t table_id, bool dict_locked)
 Returns a cached table object based on table id. More...
 
static dict_table_tdd_table_open_on_name_in_mem (const char *name, bool dict_locked)
 Returns a cached table object based on table name. More...
 
template<typename Table >
dict_table_tdd_open_table (dd::cache::Dictionary_client *client, const TABLE *table, const char *norm_name, const Table *dd_table, THD *thd)
 Open or load a table definition based on a Global DD object. More...
 
void dd_open_fk_tables (dict_names_t &fk_list, bool dict_locked, THD *thd)
 Open foreign tables reference a table. More...
 
dberr_t dd_tablespace_rename (dd::Object_id dd_space_id, bool is_system_cs, const char *new_space_name, const char *new_path)
 Update the tablespace name and file name for rename operation. More...
 
bool dd_create_tablespace (dd::cache::Dictionary_client *dd_client, const char *dd_space_name, space_id_t space_id, uint32_t flags, const char *filename, bool discarded, dd::Object_id &dd_space_id)
 Create metadata for specified tablespace, acquiring exclusive MDL first. More...
 
bool dd_create_implicit_tablespace (dd::cache::Dictionary_client *dd_client, space_id_t space_id, const char *space_name, const char *filename, bool discarded, dd::Object_id &dd_space_id)
 Create metadata for implicit tablespace. More...
 
bool dd_get_tablespace_size_option (dd::cache::Dictionary_client *dd_client, const dd::Object_id dd_space_id, uint64_t *autoextend_size)
 Get the autoextend_size attribute for a tablespace. More...
 
bool dd_drop_tablespace (dd::cache::Dictionary_client *dd_client, dd::Object_id dd_space_id)
 Drop a tablespace. More...
 
innodb_session_t *& thd_to_innodb_session (THD *thd)
 Obtain the private handler of InnoDB session specific data. More...
 
static const dd::Columndd_find_column (const dd::Table *dd_table, const char *name)
 Look up a column in a table using the system_charset_info collation. More...
 
static dd::Columndd_add_hidden_column (dd::Table *dd_table, const char *name, uint length, dd::enum_column_types type)
 Add a hidden column when creating a table. More...
 
static void dd_add_hidden_element (dd::Index *index, const dd::Column *column)
 Add a hidden index element at the end. More...
 
static dd::Indexdd_set_hidden_unique_index (dd::Index *index, const char *name, const dd::Column *column)
 Initialize a hidden unique B-tree index. More...
 
static bool create_table_check_doc_id_col (THD *thd, const TABLE *form, ulint *doc_id_col)
 Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID. More...
 
static const char * get_row_format_name (enum row_type row_format)
 Return a display name for the row format. More...
 
static const char * dd_tablespace_get_filename (const dd::Tablespace *dd_space)
 Get the file name of a tablespace. More...
 
template<typename Table >
bool dd_table_match (const dict_table_t *table, const Table *dd_table)
 Check if the InnoDB table is consistent with dd::Table. More...
 
bool dd_create_fts_index_table (const dict_table_t *parent_table, dict_table_t *table, const CHARSET_INFO *charset)
 Create dd table for fts aux index table. More...
 
bool dd_create_fts_common_table (const dict_table_t *parent_table, dict_table_t *table, bool is_config)
 Create dd table for fts aux common table. More...
 
bool dd_drop_fts_table (const char *name, bool file_per_table)
 Drop dd table & tablespace for fts aux table. More...
 
bool dd_rename_fts_table (const dict_table_t *table, const char *old_name)
 Rename dd table & tablespace files for fts aux table. More...
 
char * dd_get_referenced_table (const char *name, const char *database_name, ulint database_name_len, const char *table_name, ulint table_name_len, dict_table_t **table, MDL_ticket **mdl, mem_heap_t *heap)
 Open a table from its database and table name, this is currently used by foreign constraint parser to get the referenced table. More...
 
void dd_tablespace_set_state (THD *thd, dd::Object_id dd_space_id, std::string space_name, dd_space_states state)
 Set the 'state' value in dd:tablespace::se_private_data starting with an object id and the space name. More...
 
void dd_tablespace_set_state (dd::Tablespace *dd_space, dd_space_states state)
 Set the 'state' value in dd:tablespace::se_private_data. More...
 
bool dd_tablespace_set_id_and_state (const char *space_name, space_id_t space_id, dd_space_states state)
 Set Space ID and state attribute in se_private_data of mysql.tablespaces for the named tablespace. More...
 
void dd_tablespace_get_state (const dd::Tablespace *dd_space, dd::String_type *state, space_id_t space_id=SPACE_UNKNOWN)
 Get state attribute value in dd::Tablespace::se_private_data. More...
 
void dd_tablespace_get_state (const dd::Properties *p, dd::String_type *state, space_id_t space_id=SPACE_UNKNOWN)
 Get state attribute value in dd::Tablespace::se_private_data. More...
 
dd_space_states dd_tablespace_get_state_enum (const dd::Tablespace *dd_space, space_id_t space_id=SPACE_UNKNOWN)
 Get the enum for the state of the undo tablespace from either dd::Tablespace::se_private_data or undo::Tablespace. More...
 
dd_space_states dd_tablespace_get_state_enum (const dd::Properties *p, space_id_t space_id=SPACE_UNKNOWN)
 Get the enum for the state of a tablespace from either dd::Tablespace::se_private_data or undo::Tablespace. More...
 
dd_space_states dd_tablespace_get_state_enum_legacy (const dd::Properties *p, space_id_t space_id=SPACE_UNKNOWN)
 Get the enum for the state of a tablespace. More...
 
bool dd_tablespace_is_discarded (const dd::Tablespace *dd_space)
 Get the discarded state from se_private_data of tablespace. More...
 
bool dd_implicit_alter_tablespace (dd::cache::Dictionary_client *dd_client, dd::Object_id dd_space_id, HA_CREATE_INFO *create_info)
 Set the autoextend_size attribute for an implicit tablespace. More...
 
bool dd_tablespace_get_mdl (const char *space_name, MDL_ticket **mdl_ticket=nullptr, bool foreground=true)
 Get the MDL for the named tablespace. More...
 
void dd_tablespace_set_discard (dd::Tablespace *dd_space, bool discard)
 Set discard attribute value in se_private_dat of tablespace. More...
 
bool dd_tablespace_get_discard (const dd::Tablespace *dd_space)
 Get discard attribute value stored in se_private_dat of tablespace. More...
 
void dd_release_mdl (MDL_ticket *mdl_ticket)
 Release the MDL held by the given ticket. More...
 
bool copy_dropped_columns (const dd::Table *old_dd_table, dd::Table *new_dd_table, uint32_t current_row_version)
 Copy metadata of already dropped columns from old table def to new table def. More...
 
bool dd_set_tablespace_compression (dd::cache::Dictionary_client *client, const char *algorithm, dd::Object_id dd_space_id)
 Set Innodb tablespace compression option from DD. More...
 
bool dd_tablespace_update_cache (THD *thd)
 Update all InnoDB tablespace cache objects. More...
 
bool dd_is_table_in_encrypted_tablespace (const dict_table_t *table)
 
void dd_parse_default_value (const dd::Properties &se_private_data, dict_col_t *col, mem_heap_t *heap)
 Parse the default value from dd::Column::se_private to dict_col_t. More...
 
void fill_dict_dropped_columns (const dd::Table *dd_table, dict_table_t *dict_table, uint32_t &current_row_version, mem_heap_t *heap)
 Add definition of INSTANT dropped column in table cache. More...
 
bool is_renamed (const Alter_inplace_info *ha_alter_info, const char *old_name, std::string &new_name)
 Check if given column is renamed during ALTER. More...
 
bool is_dropped (const Alter_inplace_info *ha_alter_info, const char *column_name)
 Check if given column is dropped during ALTER. More...
 
void get_field_types (const dd::Table *dd_tab, const dict_table_t *m_table, const Field *field, unsigned &col_len, ulint &mtype, ulint &prtype)
 Get the mtype, prtype and len for a field. More...
 

Variables

constexpr bool DD_SUCCESS = false
 DD functions return false for success and true for failure because that is the way the server functions are defined. More...
 
constexpr bool DD_FAILURE = true
 
static constexpr char handler_name [] = "InnoDB"
 Handler name for InnoDB. More...
 
static const char innobase_hton_name [] = "InnoDB"
 
static constexpr char autoextend_size_str [] = "autoextend_size"
 String constant for AUTOEXTEND_SIZE option string. More...
 
constexpr uint32_t DICT_MAX_DD_TABLES = 1024
 Maximum hardcoded data dictionary tables. More...
 
const uint32_t DD_SPACE_CURRENT_SRV_VERSION = MYSQL_VERSION_ID
 Server version that the tablespace created. More...
 
const uint32_t DD_SPACE_CURRENT_SPACE_VERSION = 1
 The tablespace version that the tablespace created. More...
 
static constexpr char reserved_implicit_name [] = "innodb_file_per_table"
 InnoDB implicit tablespace name or prefix, which should be same to dict_sys_t::s_file_per_table_name. More...
 
const char *const dd_space_key_strings [DD_SPACE__LAST]
 InnoDB private key strings for dd::Tablespace. More...
 
const char *const dd_space_state_values [DD_SPACE_STATE__LAST+1]
 InnoDB private value strings for key string "state" in dd::Tablespace. More...
 
const char *const dd_table_key_strings [DD_TABLE__LAST]
 InnoDB private key strings for dd::Table. More...
 
const char *const dd_column_key_strings [DD_COLUMN__LAST]
 InnoDB private key strings for dd::Column,. More...
 
const char *const dd_partition_key_strings [DD_PARTITION__LAST]
 InnoDB private key strings for dd::Partition. More...
 
const char *const dd_index_key_strings [DD_INDEX__LAST]
 InnoDB private key strings for dd::Index or dd::Partition_index. More...
 
const innodb_dd_table_t innodb_dd_table []
 The hard-coded data dictionary tables. More...
 
static constexpr size_t innodb_dd_table_size = UT_ARR_SIZE(innodb_dd_table)
 Number of hard-coded data dictionary tables. More...
 

Detailed Description

Data dictionary interface.

Typedef Documentation

◆ Columns

using Columns = std::vector<Field *>

Enumeration Type Documentation

◆ dd_column_keys

InnoDB private keys for dd::Column.

About the DD_INSTANT_COLUMN_DEFAULT*, please note that if it's a partitioned table, not every default value is needed for every partition. For example, after ALTER TABLE ... PARTITION, maybe some partitions only need part or even none of the default values. Let's say there are two partitions, p1 and p2. p1 needs 10 default values while p2 needs 2. If another ALTER ... PARTITION makes p1 a fresh new partition which doesn't need the default values any more, currently, the extra 8(10 - 2) default values are not removed form dd::Column::se_private_data.

Enumerator
DD_INSTANT_COLUMN_DEFAULT 

Default value when it was added instantly.

DD_INSTANT_COLUMN_DEFAULT_NULL 

Default value is null or not.

DD_INSTANT_VERSION_ADDED 

Row version when this column was added instantly.

DD_INSTANT_VERSION_DROPPED 

Row version when this column was dropped instantly.

DD_INSTANT_PHYSICAL_POS 

Column physical position on row when it was created.

DD_COLUMN__LAST 

Sentinel.

◆ dd_index_keys

InnoDB private keys for dd::Index or dd::Partition_index.

Enumerator
DD_INDEX_ID 

Index identifier.

DD_INDEX_SPACE_ID 

Space id.

DD_TABLE_ID 

Table id.

DD_INDEX_ROOT 

Root page number.

DD_INDEX_TRX_ID 

Creating transaction ID.

DD_INDEX__LAST 

Sentinel.

◆ dd_partition_keys

InnoDB private keys for dd::Partition.

Enumerator
DD_PARTITION_ROW_FORMAT 

Row format for this partition.

DD_PARTITION_INSTANT_COLS 

Columns before first instant ADD COLUMN.

This is necessary for each partition because different partition may have different instant column numbers, especially, for a newly truncated partition, it can have no instant columns. So partition level one should be always >= table level one.

DD_PARTITION_DISCARD 

Discard flag.

Please don't use it directly, and instead use dd_is_discarded and dd_set_discarded functions. Discard flag is defined for both dd::Table and dd::Partition and it's easy to confuse. The functions will choose right implementation for you, depending on whether the argument is dd::Table or dd::Partition.

DD_PARTITION__LAST 

Sentinel.

◆ dd_space_keys

InnoDB private keys for dd::Tablespace.

Enumerator
DD_SPACE_FLAGS 

Tablespace flags.

DD_SPACE_ID 

Tablespace identifier.

DD_SPACE_DISCARD 

Discard attribute.

DD_SPACE_SERVER_VERSION 

Server version.

DD_SPACE_VERSION 

TABLESPACE_VERSION.

DD_SPACE_STATE 

Current state attribute.

DD_SPACE__LAST 

Sentinel.

◆ dd_space_states

Values for InnoDB private key "state" for dd::Tablespace.

Enumerator
DD_SPACE_STATE_NORMAL 

Normal IBD tablespace.

DD_SPACE_STATE_DISCARDED 

Discarded IBD tablespace.

DD_SPACE_STATE_CORRUPTED 

Corrupted IBD tablespace.

DD_SPACE_STATE_ACTIVE 

Active undo tablespace.

DD_SPACE_STATE_INACTIVE 

Inactive undo tablespace being truncated, selected explicitly by ALTER UNDO TABLESPACE SET INACTIVE.

Note: the DD is not updated when an undo space is selected for truncation implicitly by the purge thread.

DD_SPACE_STATE_EMPTY 

Inactive undo tablespace being truncated, selected explicitly by ALTER UNDO TABLESPACE SET INACTIVE.

DD_SPACE_STATE__LAST 

Sentinel.

◆ dd_table_keys

InnoDB private keys for dd::Table.

Enumerator
DD_TABLE_AUTOINC 

Auto-increment counter.

DD_TABLE_DATA_DIRECTORY 

DATA DIRECTORY (static metadata)

DD_TABLE_VERSION 

Dynamic metadata version.

DD_TABLE_DISCARD 

Discard flag.

Please don't use it directly, and instead use dd_is_discarded and dd_set_discarded functions. Discard flag is defined for both dd::Table and dd::Partition and it's easy to confuse. The functions will choose right implementation for you, depending on whether the argument is dd::Table or dd::Partition.

DD_TABLE_INSTANT_COLS 

Columns before first instant ADD COLUMN, used only for V1.

DD_TABLE__LAST 

Sentinel.

Function Documentation

◆ acquire_uncached_table()

int acquire_uncached_table ( THD thd,
dd::cache::Dictionary_client client,
const dd::Table dd_table,
const char *  name,
TABLE_SHARE ts,
TABLE td 
)

Open uncached table definition based on a Global DD object.

Parameters
[in]thdthread THD
[in]clientdata dictionary client
[in]dd_tableGlobal DD table object
[in]nameTable Name
[out]tsMySQL table share
[out]tdMySQL table definition
Return values
errornumber on error
0on success

◆ copy_dropped_columns()

bool copy_dropped_columns ( const dd::Table old_dd_table,
dd::Table new_dd_table,
uint32_t  current_row_version 
)

Copy metadata of already dropped columns from old table def to new table def.

param[in] old_dd_table old table definition param[in,out] new_dd_table new table definition

Return values
trueFailure
falseSuccess

◆ create_table_check_doc_id_col()

static bool create_table_check_doc_id_col ( THD thd,
const TABLE form,
ulint doc_id_col 
)
inlinestatic

Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID.

Parameters
[in]thdMySQL thread handle
[in]forminformation on table columns and indexes
[out]doc_id_colDoc ID column number if there exist a FTS_DOC_ID column, ULINT_UNDEFINED if column is of the wrong type/name/size
Returns
true if there exist a "FTS_DOC_ID" column

◆ data_file_name_key()

static const dd::String_type data_file_name_key ( "data_file_name"  )
static

dd::Partition::options() key for DATA DIRECTORY

◆ dd_add_fts_doc_id_index()

void dd_add_fts_doc_id_index ( dd::Table new_table,
const dd::Table old_table 
)

Add fts doc id column and index to new table when old table has hidden fts doc id without fulltext index.

Parameters
[in,out]new_tableNew dd table
[in]old_tableOld dd table

◆ dd_add_hidden_column()

static dd::Column * dd_add_hidden_column ( dd::Table dd_table,
const char *  name,
uint  length,
dd::enum_column_types  type 
)
inlinestatic

Add a hidden column when creating a table.

Parameters
[in,out]dd_tabletable containing user columns and indexes
[in]namehidden column name
[in]lengthlength of the column, in bytes
[in]typecolumn type
Returns
the added column, or NULL if there already was a column by that name

◆ dd_add_hidden_element()

static void dd_add_hidden_element ( dd::Index index,
const dd::Column column 
)
inlinestatic

Add a hidden index element at the end.

Parameters
[in,out]indexcreated index metadata
[in]columncolumn of the index

◆ dd_add_instant_columns()

bool dd_add_instant_columns ( const dd::Table old_dd_table,
dd::Table new_dd_table,
dict_table_t new_table,
const Columns cols_to_add 
)

Add column default values for new instantly added columns.

Parameters
[in]old_dd_tableOld dd::Table
[in,out]new_dd_tableNew dd::Table
[in,out]new_tableNew InnoDB table object
[in]cols_to_addcolumns to be added INSTANTly
Return values
trueFailure
falseSuccess

◆ dd_clear_instant_part()

void dd_clear_instant_part ( dd::Partition dd_part)

Clear the instant ADD COLUMN information of a partition, to make it as a normal partition.

Parameters
[in,out]dd_partdd::Partition

◆ dd_clear_instant_table()

dberr_t dd_clear_instant_table ( dd::Table dd_table,
bool  clear_version 
)

Clear the instant ADD COLUMN information of a table.

Parameters
[in,out]dd_tabledd::Table
[in]clear_versiontrue if version metadata is to be cleared
Returns
DB_SUCCESS or error code

◆ dd_column_get_version_added()

uint32_t dd_column_get_version_added ( const dd::Column dd_col)

Get the row version in which column is INSTANT ADD.

◆ dd_column_get_version_dropped()

uint32_t dd_column_get_version_dropped ( const dd::Column dd_col)

Get the row version in which column is INSTANT DROP.

◆ dd_column_is_added()

bool dd_column_is_added ( const dd::Column dd_col)

Determine if column is INSTANT ADD.

◆ dd_column_is_dropped()

bool dd_column_is_dropped ( const dd::Column dd_col)

Determine if column is INSTANT DROP.

◆ dd_columns_name()

static const dd::String_type dd_columns_name ( "mysql/columns"  )
static

◆ dd_copy_autoinc()

void dd_copy_autoinc ( const dd::Properties src,
dd::Properties dest 
)

Copy the AUTO_INCREMENT and version attribute if exist.

Parameters
[in]srcdd::Table::se_private_data to copy from
[out]destdd::Table::se_private_data to copy to

◆ dd_copy_instant_n_cols()

void dd_copy_instant_n_cols ( dd::Table new_table,
const dd::Table old_table 
)

Copy the metadata of a table definition if there was an instant ADD COLUMN happened.

This should be done when it's not an ALTER TABLE with rebuild.

Parameters
[in,out]new_tableNew table definition
[in]old_tableOld table definition

◆ dd_copy_private()

template<typename Table >
void dd_copy_private ( Table &  new_table,
const Table &  old_table 
)

Copy the engine-private parts of a table or partition definition when the change does not affect InnoDB.

This mainly copies the common private data between dd::Table and dd::Partition

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]new_tableCopy of old table or partition definition
[in]old_tableOld table or partition definition

◆ dd_copy_table()

void dd_copy_table ( const Alter_inplace_info ha_alter_info,
dd::Table new_table,
const dd::Table old_table 
)
inline

Copy the metadata of a table definition, including the INSTANT ADD COLUMN information.

This should be done when it's not an ALTER TABLE with rebuild. Basically, check dd::Table::se_private_data and dd::Column::se_private_data.

Parameters
[in]ha_alter_infoalter info
[in,out]new_tableCopy of old table definition
[in]old_tableOld table definition

◆ dd_copy_table_columns()

void dd_copy_table_columns ( const Alter_inplace_info ha_alter_info,
dd::Table new_table,
const dd::Table old_table,
dict_table_t dict_table 
)

Copy the engine-private parts of column definitions of a table.

Parameters
[in]ha_alter_infoalter info
[in,out]new_tableCopy of old table
[in]old_tableOld table
[in]dict_tableInnoDB table cache

◆ dd_create_fts_common_table()

bool dd_create_fts_common_table ( const dict_table_t parent_table,
dict_table_t table,
bool  is_config 
)

Create dd table for fts aux common table.

Parameters
[in]parent_tableparent table of fts table
[in,out]tablefts table
[in]is_configflag whether it's fts aux configure table
Returns
true on success, false on failure

◆ dd_create_fts_index_table()

bool dd_create_fts_index_table ( const dict_table_t parent_table,
dict_table_t table,
const CHARSET_INFO charset 
)

Create dd table for fts aux index table.

Parameters
[in]parent_tableparent table of fts table
[in,out]tablefts table
[in]charsetfts index charset
Returns
true on success, false on failure

◆ dd_create_implicit_tablespace()

bool dd_create_implicit_tablespace ( dd::cache::Dictionary_client dd_client,
space_id_t  space_id,
const char *  space_name,
const char *  filename,
bool  discarded,
dd::Object_id dd_space_id 
)

Create metadata for implicit tablespace.

Parameters
[in,out]dd_clientdata dictionary client
[in]space_idInnoDB tablespace ID
[in]space_nametablespace name to be set for the newly created tablespace
[in]filenametablespace filename
[in]discardedtrue if this tablespace was discarded
[in,out]dd_space_iddd tablespace id
Return values
falseon success
trueon failure

◆ dd_create_tablespace()

bool dd_create_tablespace ( dd::cache::Dictionary_client dd_client,
const char *  dd_space_name,
space_id_t  space_id,
uint32_t  flags,
const char *  filename,
bool  discarded,
dd::Object_id dd_space_id 
)

Create metadata for specified tablespace, acquiring exclusive MDL first.

Parameters
[in,out]dd_clientdata dictionary client
[in,out]dd_space_namedd tablespace name
[in]space_idInnoDB tablespace ID
[in]flagsInnoDB tablespace flags
[in]filenamefilename of this tablespace
[in]discardedtrue if this tablespace was discarded
[in,out]dd_space_iddd_space_id
Return values
falseon success
trueon failure

◆ dd_drop_fts_table()

bool dd_drop_fts_table ( const char *  name,
bool  file_per_table 
)

Drop dd table & tablespace for fts aux table.

Parameters
[in]nametable name
[in]file_per_tableflag whether use file per table
Returns
true on success, false on failure.

◆ dd_drop_instant_columns()

bool dd_drop_instant_columns ( const dd::Table old_dd_table,
dd::Table new_dd_table,
dict_table_t new_table,
const Columns cols_to_drop,
const Columns cols_to_add,
Alter_inplace_info ha_alter_info 
)

Drop column instantly.

It actually updates dropped columns metadata.

Parameters
[in]old_dd_tableOld dd::Table
[in,out]new_dd_tableNew dd::Table
[in,out]new_tableNew InnoDB table objecta
[in]cols_to_droplist of columns to be dropped
[in]cols_to_addlist of columns to be added
[in]ha_alter_infoalter info
Return values
trueFailure
falseSuccess

◆ dd_drop_tablespace()

bool dd_drop_tablespace ( dd::cache::Dictionary_client dd_client,
dd::Object_id  dd_space_id 
)

Drop a tablespace.

Parameters
[in,out]dd_clientdata dictionary client
[in]dd_space_iddd tablespace id
Return values
falseOn success
trueOn failure

◆ dd_find_column()

static const dd::Column * dd_find_column ( const dd::Table dd_table,
const char *  name 
)
inlinestatic

Look up a column in a table using the system_charset_info collation.

Parameters
[in]dd_tabledata dictionary table
[in]namecolumn name
Returns
the column
Return values
nullptrif not found

◆ dd_find_index()

template<typename Index >
const dict_index_t * dd_find_index ( const dict_table_t table,
Index *  dd_index 
)

Find the specified dd::Index or dd::Partition_index in an InnoDB table.

Template Parameters
Indexdd::Index or dd::Partition_index
Parameters
[in]tableInnoDB table object
[in]dd_indexIndex to search
Returns
the dict_index_t object related to the index

◆ dd_first()

template<typename Table , typename Index >
const Index * dd_first ( const Table *  table)
inline

Get the first index of a table or partition.

Template Parameters
Tabledd::Table or dd::Partition
Indexdd::Index or dd::Partition_index
Parameters
[in]tabletable containing user columns and indexes
Returns
the first index
Return values
NULLif there are no indexes

◆ dd_first_index() [1/2]

const dd::Partition_index * dd_first_index ( const dd::Partition partition)
inline

Get the first index of a partition.

Parameters
[in]partitionpartition or subpartition
Returns
the first index
Return values
NULLif there are no indexes

◆ dd_first_index() [2/2]

const dd::Index * dd_first_index ( const dd::Table table)
inline

Get the first index of a table.

Parameters
[in]tabletable containing user columns and indexes
Returns
the first index
Return values
NULLif there are no indexes

◆ dd_get_and_save_data_dir_path()

template<typename Table >
void dd_get_and_save_data_dir_path ( dict_table_t table,
const Table *  dd_table,
bool  dict_mutex_own 
)

Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY was used.

Try to read it from the fil_system first, then from new dd.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]tableTable object
[in]dd_tableDD table object
[in]dict_mutex_owntrue if dict_sys->mutex is owned already

◆ dd_get_and_save_space_name()

template<typename Table >
void dd_get_and_save_space_name ( dict_table_t table,
const Table *  dd_table,
bool  dict_mutex_own 
)

Make sure the tablespace name is saved in dict_table_t if the table uses a general tablespace.

Try to read it from the fil_system_t first, then from DD.

Parameters
[in]tableTable object
[in]dd_tableGlobal DD table or partition object
[in]dict_mutex_owntrue if dict_sys->mutex is owned already

◆ dd_get_meta_data_filename()

void dd_get_meta_data_filename ( dict_table_t table,
dd::Table dd_table,
char *  filename,
ulint  max_len 
)

Get the meta-data filename from the table name for a single-table tablespace.

Parameters
[in,out]tabletable object
[in]dd_tableDD table object
[out]filenamefilename
[in]max_lenfilename max length

◆ dd_get_referenced_table()

char * dd_get_referenced_table ( const char *  name,
const char *  database_name,
ulint  database_name_len,
const char *  table_name,
ulint  table_name_len,
dict_table_t **  table,
MDL_ticket **  mdl,
mem_heap_t heap 
)

Open a table from its database and table name, this is currently used by foreign constraint parser to get the referenced table.

Parameters
[in]nameforeign key table name
[in]database_nametable db name
[in]database_name_lendb name length
[in]table_nametable db name
[in]table_name_lentable name length
[in,out]tabletable object or NULL
[in,out]mdlmdl on table
[in,out]heapheap memory
Returns
complete table name with database and table name, allocated from heap memory passed in

◆ dd_get_space_id() [1/2]

dd::Object_id dd_get_space_id ( const dd::Partition partition)
inline

Get the explicit dd::Tablespace::id of a partition.

Parameters
[in]partitionpartition or subpartition
Returns
the explicit dd::Tablespace::id
Return values
dd::INVALID_OBJECT_IDif there is no explicit tablespace

◆ dd_get_space_id() [2/2]

dd::Object_id dd_get_space_id ( const dd::Table table)
inline

Get the explicit dd::Tablespace::id of a table.

Parameters
[in]tablenon-partitioned table
Returns
the explicit dd::Tablespace::id
Return values
dd::INVALID_OBJECT_IDif there is no explicit tablespace

◆ dd_get_tablespace_size_option()

bool dd_get_tablespace_size_option ( dd::cache::Dictionary_client dd_client,
const dd::Object_id  dd_space_id,
uint64_t *  autoextend_size 
)

Get the autoextend_size attribute for a tablespace.

Parameters
[in]dd_clientData dictionary client
[in]dd_space_idTablespace ID
[out]autoextend_sizeValue of autoextend_size attribute
Return values
falseOn success
trueOn failure

◆ dd_get_total_indexes_num()

uint32_t dd_get_total_indexes_num ( )
Returns
total number of indexes of all DD Tables.
total number of indexes of all DD tables

◆ dd_get_version()

uint64_t dd_get_version ( const dd::Table dd_table)
inline

Get the version attribute.

Parameters
[in]dd_tabledd::Table
Returns
table dynamic metadata version if exists, otherwise 0

◆ dd_getnext_system_rec()

const rec_t * dd_getnext_system_rec ( btr_pcur_t pcur,
mtr_t mtr 
)

Get next record of new DD system tables.

Parameters
[in,out]pcurPersistent cursor
[in]mtrMini-transaction
Return values
nextrecord

◆ dd_implicit_alter_tablespace()

bool dd_implicit_alter_tablespace ( dd::cache::Dictionary_client dd_client,
dd::Object_id  dd_space_id,
HA_CREATE_INFO create_info 
)

Set the autoextend_size attribute for an implicit tablespace.

Parameters
[in,out]dd_clientData dictionary client
[in]dd_space_idDD tablespace id
[in]create_infoHA_CREATE_INFO object
Returns
false On success
true On failure

◆ dd_import_instant_add_columns()

void dd_import_instant_add_columns ( const dict_table_t table,
dd::Table dd_table 
)

Import all metadata which is related to instant ADD COLUMN of a table to dd::Table.

This is used for IMPORT.

Parameters
[in]tableInnoDB table object
[in,out]dd_tabledd::Table

◆ dd_indexes_name()

static const dd::String_type dd_indexes_name ( "mysql/indexes"  )
static

◆ dd_instant_columns_consistent()

bool dd_instant_columns_consistent ( const dd::Table dd_table)

Check if the instant columns are consistent with the se_private_data in dd::Table.

Parameters
[in]dd_tabledd::Table
Returns
true if consistent, otherwise false

◆ dd_is_discarded() [1/2]

bool dd_is_discarded ( const dd::Partition partition)
inline

Determine if dd::Partition is discarded.

Please note that only leaf partitions can be marked as discarded (that is, if partition has subpartitions, then only subpartitions can be marked as discarded)

Function can be safely called on a partition, even if it has subpartitions - it will just return false.

Parameters
[in]partitiondd::Partition
Returns
true if partition is marked as discarded
false if partition is not marked as discarded

◆ dd_is_discarded() [2/2]

bool dd_is_discarded ( const dd::Table table)
inline

Determine if dd::Table is discarded.

Please note that in case of partitioned Table, only it's leaf partitions can be marked as discarded. However, it's fine to call this function on partitioned Table - it will just return false

Parameters
[in]tablenon-partitioned dd::Table
Returns
true if table is marked as discarded
false if table is not marked as discarded

◆ dd_is_table_in_encrypted_tablespace()

bool dd_is_table_in_encrypted_tablespace ( const dict_table_t table)

◆ dd_is_valid_row_version()

bool dd_is_valid_row_version ( uint32_t  version)

Determine if give version is a valid row version.

◆ dd_match_default_value()

bool dd_match_default_value ( const dd::Column dd_col,
const dict_col_t col 
)

Compare the default values between imported column and column defined in the server.

Note that it's absolutely OK if there is no default value in the column defined in server, since it can be filled in later.

Parameters
[in]dd_coldd::Column
[in]colInnoDB column object
Returns
true The default values match
Return values
falseNot match

◆ dd_mdl_acquire()

static bool dd_mdl_acquire ( THD thd,
MDL_ticket **  mdl,
const char *  db,
const char *  table 
)
inlinestatic

Acquire a shared metadata lock.

Parameters
[in,out]thdcurrent thread
[out]mdlmetadata lock
[in]dbschema name
[in]tabletable name
Return values
falseif acquired, or trylock timed out
trueif failed (my_error() will have been called)

◆ dd_mdl_for_undo()

bool dd_mdl_for_undo ( const trx_t trx)

Check if current undo needs a MDL or not.

Parameters
[in]trxtransaction
Returns
true if MDL is necessary, otherwise false

◆ dd_mdl_release()

void dd_mdl_release ( THD thd,
MDL_ticket **  mdl 
)

Release a metadata lock.

Parameters
[in,out]thdcurrent thread
[in,out]mdlmetadata lock

◆ dd_open_fk_tables()

void dd_open_fk_tables ( dict_names_t fk_list,
bool  dict_locked,
THD thd 
)

Open foreign tables reference a table.

Parameters
[in]fk_listforeign key name list
[in]dict_lockeddict_sys mutex is locked or not
[in]thdthread THD

◆ dd_open_table()

template<typename Table >
dict_table_t * dd_open_table ( dd::cache::Dictionary_client client,
const TABLE table,
const char *  norm_name,
const Table *  dd_table,
THD thd 
)

Open or load a table definition based on a Global DD object.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]clientdata dictionary client
[in]tableMySQL table definition
[in]norm_nameTable Name
[in]dd_tableGlobal DD table or partition object
[in]thdthread THD
Returns
ptr to dict_table_t filled, otherwise, nullptr

◆ dd_parse_default_value()

void dd_parse_default_value ( const dd::Properties se_private_data,
dict_col_t col,
mem_heap_t heap 
)

Parse the default value from dd::Column::se_private to dict_col_t.

Parameters
[in]se_private_datadd::Column::se_private
[in,out]colInnoDB column object
[in,out]heapHeap to store the default value

◆ dd_part_adjust_table_id()

void dd_part_adjust_table_id ( dd::Table new_table)

Adjust TABLE_ID for partitioned table after ALTER TABLE ... PARTITION.

This makes sure that the TABLE_ID stored in dd::Column::se_private_data is correct if the first partition got changed

Parameters
[in,out]new_tableNew dd::Table

◆ dd_part_has_instant_cols()

bool dd_part_has_instant_cols ( const dd::Partition part)
inline

Determine if a dd::Partition has any instant column.

Parameters
[in]partdd::Partition
Returns
true If it's a partitioned table with instant columns
false Not a partitioned table with instant columns

◆ dd_part_is_first()

bool dd_part_is_first ( const dd::Partition dd_part)
inline

Determine if a dd::Partition is the first leaf partition in the table.

Parameters
[in]dd_partdd::Partition
Returns
True If it's the first partition
Return values
FalseNot the first one

◆ dd_part_is_stored()

bool dd_part_is_stored ( const dd::Partition part)
inline

Determine if a partition is materialized.

Parameters
[in]partpartition
Returns
whether the partition is materialized

◆ dd_partitions_name()

static const dd::String_type dd_partitions_name ( "mysql/table_partitions"  )
static

◆ dd_process_dd_columns_rec()

bool dd_process_dd_columns_rec ( mem_heap_t heap,
const rec_t rec,
dict_col_t col,
table_id_t table_id,
char **  col_name,
ulint nth_v_col,
const dict_table_t dd_columns,
mtr_t mtr 
)

Process one mysql.columns record and get info to dict_col_t.

Parameters
[in,out]heapTemp memory heap
[in]recmysql.columns record
[in,out]coldict_col_t to fill
[in,out]table_idTable id
[in,out]col_nameColumn name
[in,out]nth_v_colNth v column
[in]dd_columnsdict_table_t obj of mysql.columns
[in,out]mtrMini-transaction
Return values
trueif column is filled

◆ dd_process_dd_indexes_rec()

bool dd_process_dd_indexes_rec ( mem_heap_t heap,
const rec_t rec,
const dict_index_t **  index,
MDL_ticket **  mdl,
dict_table_t **  parent,
MDL_ticket **  parent_mdl,
dict_table_t dd_indexes,
mtr_t mtr 
)

Process one mysql.indexes record and get the dict_index_t.

Parameters
[in]heapTemp memory heap
[in,out]recmysql.indexes record
[in,out]indexdict_index_t to fill
[in]mdlMDL on index->table
[in,out]parentParent table if it's fts aux table.
[in,out]parent_mdlMDL on parent if it's fts aux table.
[in]dd_indexesdict_table_t obj of mysql.indexes
[in]mtrMini-transaction
Return values
trueif index is filled

◆ dd_process_dd_indexes_rec_simple()

bool dd_process_dd_indexes_rec_simple ( mem_heap_t heap,
const rec_t rec,
space_index_t index_id,
space_id_t space_id,
dict_table_t dd_indexes 
)

Process one mysql.indexes record and get brief info to dict_index_t.

Parameters
[in]heaptemp memory heap
[in,out]recmysql.indexes record
[in,out]index_idindex id
[in,out]space_idspace id
[in]dd_indexesdict_table_t obj of mysql.indexes
Return values
trueif index is filled

◆ dd_process_dd_partitions_rec_and_mtr_commit()

const char * dd_process_dd_partitions_rec_and_mtr_commit ( mem_heap_t heap,
const rec_t rec,
dict_table_t **  table,
dict_table_t dd_tables,
MDL_ticket **  mdl,
mtr_t mtr 
)

Process one mysql.table_partitions record and get the dict_table_t.

Parameters
[in]heapTemp memory heap
[in,out]recmysql.table_partitions record
[in,out]tabledict_table_t to fill
[in]dd_tablesdict_table_t obj of dd partition table
[in]mdlMDL on the table
[in]mtrMini-transaction
Return values
errormessage, or NULL on success

◆ dd_process_dd_tables_rec_and_mtr_commit()

const char * dd_process_dd_tables_rec_and_mtr_commit ( mem_heap_t heap,
const rec_t rec,
dict_table_t **  table,
dict_table_t dd_tables,
MDL_ticket **  mdl,
mtr_t mtr 
)

Process one mysql.tables record and get the dict_table_t.

Parameters
[in]heapTemp memory heap
[in,out]recmysql.tables record
[in,out]tabledict_table_t to fill
[in]dd_tablesdict_table_t obj of dd system table
[in]mdlMDL on the table
[in]mtrMini-transaction
Return values
errormessage, or NULL on success

◆ dd_process_dd_tablespaces_rec()

bool dd_process_dd_tablespaces_rec ( mem_heap_t heap,
const rec_t rec,
space_id_t space_id,
char **  name,
uint32_t *  flags,
uint32_t *  server_version,
uint32_t *  space_version,
bool *  is_encrypted,
uint64_t *  autoextend_size,
dd::String_type state,
dict_table_t dd_spaces 
)

Process one mysql.tablespaces record and get info.

Parameters
[in]heaptemp memory heap
[in]recmysql.tablespaces record
[out]space_idspace id
[out]namespace name
[out]flagsspace flags
[out]server_versionserver version
[out]space_versionspace version
[out]is_encryptedtrue if tablespace is encrypted
[out]autoextend_sizeautoextend_size attribute value
[out]statespace state
[in]dd_spacesdict_table_t obj of mysql.tablespaces
Returns
true if data is retrieved

◆ dd_process_dd_virtual_columns_rec()

bool dd_process_dd_virtual_columns_rec ( mem_heap_t heap,
const rec_t rec,
table_id_t table_id,
ulint **  pos,
ulint **  base_pos,
ulint n_row,
dict_table_t dd_columns,
mtr_t mtr 
)

Process one mysql.columns record for virtual columns.

Parameters
[in]heaptemp memory heap
[in,out]recmysql.columns record
[in,out]table_idTable id
[in,out]posPosition
[in,out]base_posBase column position
[in,out]n_rowNumber of rows
[in]dd_columnsdict_table_t obj of mysql.columns
[in]mtrMini-transaction
Return values
trueif virtual info is filled

◆ dd_release_mdl()

void dd_release_mdl ( MDL_ticket mdl_ticket)

Release the MDL held by the given ticket.

Parameters
[in]mdl_tickettablespace MDL ticket

◆ dd_rename_fts_table()

bool dd_rename_fts_table ( const dict_table_t table,
const char *  old_name 
)

Rename dd table & tablespace files for fts aux table.

Parameters
[in]tabledict table
[in]old_nameold innodb table name
Returns
true on success, false on failure.

◆ dd_set_autoinc()

void dd_set_autoinc ( dd::Properties se_private_data,
uint64_t  autoinc 
)

Set the AUTO_INCREMENT attribute.

Parameters
[in,out]se_private_datadd::Table::se_private_data
[in]autoincthe auto-increment value

◆ dd_set_discarded() [1/2]

void dd_set_discarded ( dd::Partition partition,
bool  discard 
)

Sets appropriate discard attribute of dd::Partition Please note that this function can be only called on leaf_partitions.

Parameters
[in]partitionleaf dd::Partition
[in]discardtrue if Table is discarded, false otherwise

◆ dd_set_discarded() [2/2]

void dd_set_discarded ( dd::Table table,
bool  discard 
)

Sets appropriate discard attribute of dd::Table Please note that this function must not be called on partitioned tables.

Parameters
[in]tablenon-partitioned dd::Table
[in]discardtrue if Table is discarded, false otherwise

◆ dd_set_hidden_unique_index()

static dd::Index * dd_set_hidden_unique_index ( dd::Index index,
const char *  name,
const dd::Column column 
)
inlinestatic

Initialize a hidden unique B-tree index.

Parameters
[in,out]indexcreated index metadata
[in]namename of the index
[in]columncolumn of the index
Returns
the initialized index

◆ dd_set_table_options()

template<typename Table >
void dd_set_table_options ( Table *  dd_table,
const dict_table_t table 
)

Set options of dd::Table according to InnoDB table object.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]dd_tabledd::Table or dd::Partition
[in]tableInnoDB table object

◆ dd_set_tablespace_compression()

bool dd_set_tablespace_compression ( dd::cache::Dictionary_client client,
const char *  algorithm,
dd::Object_id  dd_space_id 
)

Set Innodb tablespace compression option from DD.

Parameters
[in,out]clientdictionary client
[in]algorithmcompression algorithm
[in]dd_space_idDD tablespace ID.
Returns
true, if failed to set compression.

◆ dd_startscan_system()

const rec_t * dd_startscan_system ( THD thd,
MDL_ticket **  mdl,
btr_pcur_t pcur,
mtr_t mtr,
const char *  system_table_name,
dict_table_t **  table 
)

Scan a new dd system table, like mysql.tables...

Parameters
[in]thdTHD
[in,out]mdlMDL lock
[in,out]pcurPersistent cursor
[in,out]mtrMini-transaction
[in]system_table_nameWhich dd system table to open
[in,out]tabledict_table_t obj of dd system table
Return values
thefirst rec of the dd system table

◆ dd_table_check_for_child()

dberr_t dd_table_check_for_child ( dd::cache::Dictionary_client client,
const char *  tbl_name,
const char **  col_names,
dict_table_t m_table,
bool  check_charsets,
dict_err_ignore_t  ignore_err,
dict_names_t fk_tables 
)

Load foreign key constraint for the table.

Note, it could also open the foreign table, if this table is referenced by the foreign table

Parameters
[in,out]clientdata dictionary client
[in]tbl_nameTable Name
[in]col_namescolumn names, or NULL
[out]m_tableInnoDB table handle
[in]check_charsetswhether to check charset compatibility
[in]ignore_errDICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE
[in,out]fk_tablesname list for tables that refer to this table
Returns
DB_SUCCESS if successfully load FK constraint

◆ dd_table_close()

void dd_table_close ( dict_table_t table,
THD thd,
MDL_ticket **  mdl,
bool  dict_locked 
)

Close an internal InnoDB table handle.

Parameters
[in,out]tableInnoDB table handle
[in,out]thdcurrent MySQL connection (for mdl)
[in,out]mdlmetadata lock (will be set NULL)
[in]dict_lockedwhether we hold dict_sys mutex

◆ dd_table_discard_tablespace()

bool dd_table_discard_tablespace ( THD thd,
const dict_table_t table,
dd::Table table_def,
bool  discard 
)

Set the discard flag for a non-partitioned dd table.

Parameters
[in,out]thdcurrent thread
[in]tableInnoDB table
[in,out]table_defMySQL dd::Table to update
[in]discarddiscard flag
Returns
true if success
Return values
falseif fail.

◆ dd_table_get_column_counters()

void dd_table_get_column_counters ( const dd::Table table,
uint32_t &  i_c,
uint32_t &  c_c,
uint32_t &  t_c,
uint32_t &  current_row_version 
)
inline

Set different column counters.

Parameters
[in]tabledd::Table
[out]i_cinitial column count
[out]c_ccurrent column count
[out]t_ctotal column count
[in]current_row_versioncurrent row version

◆ dd_table_has_instant_add_cols()

bool dd_table_has_instant_add_cols ( const dd::Table table)
inline

Determine if dd::Table has INSTANT ADD columns.

Parameters
[in]tabletable definition
Returns
true if table has INSTANT ADD column(s), false otherwise

◆ dd_table_has_instant_cols()

bool dd_table_has_instant_cols ( const dd::Table table)
inline

Determine if a dd::Table has any INSTANTly ADDed/DROPped column.

Parameters
[in]tabledd::Table
Returns
true if table has instant column(s), false otherwise

◆ dd_table_has_instant_drop_cols()

bool dd_table_has_instant_drop_cols ( const dd::Table table)
inline

Determine if dd::Table has INSTANT DROPPED columns.

Parameters
[in]tabletable definition
Returns
true if table has INSTANT DROP column(s), false otherwise

◆ dd_table_has_row_versions()

bool dd_table_has_row_versions ( const dd::Table table)
inline

Determine if a dd::Table has row versions.

Parameters
[in]tabledd::Table
Returns
true if table has row versions, false otherwise

◆ dd_table_is_partitioned()

bool dd_table_is_partitioned ( const dd::Table table)
inline

Determine if a dd::Table is partitioned table.

Parameters
[in]tabledd::Table
Returns
True If partitioned table
Return values
Falsenon-partitioned table

◆ dd_table_is_upgraded_instant()

bool dd_table_is_upgraded_instant ( const dd::Table table)
inline

Determine if a dd::Table has any INSTANT ADD column(s) in V1.

Parameters
[in]tabledd::Table
Returns
true if table has instant column(s) in V1, false otherwise

◆ dd_table_load_fk()

dberr_t dd_table_load_fk ( dd::cache::Dictionary_client client,
const char *  tbl_name,
const char **  col_names,
dict_table_t m_table,
const dd::Table dd_table,
THD thd,
bool  dict_locked,
bool  check_charsets,
dict_names_t fk_tables 
)

Load foreign key constraint for the table.

Note, it could also open the foreign table, if this table is referenced by the foreign table

Parameters
[in,out]clientdata dictionary client
[in]tbl_nameTable Name
[in]col_namescolumn names, or NULL
[out]m_tableInnoDB table handle
[in]dd_tableGlobal DD table
[in]thdthread THD
[in]dict_lockedTrue if dict_sys->mutex is already held, otherwise false
[in]check_charsetswhether to check charset compatibility
[in,out]fk_tablesname list for tables that refer to this table
Returns
DB_SUCCESS if successfully load FK constraint

◆ dd_table_load_fk_from_dd()

dberr_t dd_table_load_fk_from_dd ( dict_table_t m_table,
const dd::Table dd_table,
const char **  col_names,
dict_err_ignore_t  ignore_err,
bool  dict_locked 
)

Load foreign key constraint info for the dd::Table object.

Parameters
[out]m_tableInnoDB table handle
[in]dd_tableGlobal DD table
[in]col_namescolumn names, or NULL
[in]ignore_errDICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE
[in]dict_lockedTrue if dict_sys->mutex is already held, otherwise false
Returns
DB_SUCCESS if successfully load FK constraint

◆ dd_table_match()

template<typename Table >
bool dd_table_match ( const dict_table_t table,
const Table *  dd_table 
)

Check if the InnoDB table is consistent with dd::Table.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in]tableInnoDB table
[in]dd_tabledd::Table or dd::Partition
Returns
true if match
Return values
falseif not match

◆ dd_table_open_on_dd_obj()

int dd_table_open_on_dd_obj ( THD thd,
dd::cache::Dictionary_client client,
const dd::Table dd_table,
const dd::Partition dd_part,
const char *  tbl_name,
dict_table_t *&  table,
const TABLE td 
)

Instantiate an InnoDB in-memory table metadata (dict_table_t) based on a Global DD object or MYSQL table definition.

Parameters
[in]thdthread THD
[in,out]clientdata dictionary client
[in]dd_tableGlobal DD table object
[in]dd_partGlobal DD partition or subpartition, or NULL
[in]tbl_nametable name, or NULL if not known
[out]tableInnoDB table (NULL if not found or loadable)
[in]tdMYSQL table definition
Returns
error code
Return values
0on success

◆ dd_table_open_on_id()

dict_table_t * dd_table_open_on_id ( table_id_t  table_id,
THD thd,
MDL_ticket **  mdl,
bool  dict_locked,
bool  check_corruption 
)

Open a persistent InnoDB table based on InnoDB table id, and hold Shared MDL lock on it.

Parameters
[in]table_idtable identifier
[in,out]thdcurrent MySQL connection (for mdl)
[in,out]mdlmetadata lock (*mdl set if table_id was found) mdl=NULL if we are resurrecting table IX locks in recovery
[in]dict_lockeddict_sys mutex is held
[in]check_corruptioncheck if the table is corrupted or not.
Returns
table
Return values
NULLif the table does not exist or cannot be opened

◆ dd_table_open_on_id_in_mem()

static dict_table_t * dd_table_open_on_id_in_mem ( table_id_t  table_id,
bool  dict_locked 
)
inlinestatic

Returns a cached table object based on table id.

Parameters
[in]table_idtable id
[in]dict_lockedtrue=data dictionary locked
Returns
table, NULL if does not exist

◆ dd_table_open_on_name()

dict_table_t * dd_table_open_on_name ( THD thd,
MDL_ticket **  mdl,
const char *  name,
bool  dict_locked,
ulint  ignore_err,
int *  error 
)

Open an internal handle to a persistent InnoDB table by name.

Parameters
[in,out]thdcurrent thread
[out]mdlmetadata lock
[in]nameInnoDB table name
[in]dict_lockedhas dict_sys mutex locked
[in]ignore_errwhether to ignore err
[out]errorpointer to error
Returns
handle to non-partitioned table
Return values
NULLif the table does not exist

◆ dd_table_open_on_name_in_mem()

static dict_table_t * dd_table_open_on_name_in_mem ( const char *  name,
bool  dict_locked 
)
inlinestatic

Returns a cached table object based on table name.

Parameters
[in]nametable name
[in]dict_lockedtrue=data dictionary locked
Returns
table, NULL if does not exist

◆ dd_table_part_has_instant_cols()

bool dd_table_part_has_instant_cols ( const dd::Table table)
inline

Determine if any partition of the table still has instant columns.

Parameters
[in]tabledd::Table of the partitioned table
Returns
true If any partition still has instant columns
false No one has instant columns

◆ dd_tables_name()

static const dd::String_type dd_tables_name ( "mysql/tables"  )
static

Table names needed to process I_S queries.

◆ dd_tablespace_get_discard()

bool dd_tablespace_get_discard ( const dd::Tablespace dd_space)

Get discard attribute value stored in se_private_dat of tablespace.

Parameters
[in]dd_spacedd::Tablespace object
Return values
trueif Tablespace is discarded
falseif attribute doesn't exist or if the tablespace is not discarded

◆ dd_tablespace_get_filename()

static const char * dd_tablespace_get_filename ( const dd::Tablespace dd_space)
inlinestatic

Get the file name of a tablespace.

Parameters
[in]dd_spaceTablespace metadata
Returns
file name

◆ dd_tablespace_get_mdl()

bool dd_tablespace_get_mdl ( const char *  space_name,
MDL_ticket **  mdl_ticket = nullptr,
bool  foreground = true 
)

Get the MDL for the named tablespace.

The mdl_ticket pointer can be provided if it is needed by the caller. If foreground is set to false, then the caller must explicitly release that ticket with dd_release_mdl(). Otherwise, it will ne released with the transaction.

Parameters
[in]space_nametablespace name
[in]mdl_tickettablespace MDL ticket, default to nullptr
[in]foregroundtrue, if the caller is foreground thread. Default is true. For foreground, the lock duration is MDL_TRANSACTION. Otherwise, it is MDL_EXPLICIT.
Returns
DD_SUCCESS or DD_FAILURE.

◆ dd_tablespace_get_state() [1/2]

void dd_tablespace_get_state ( const dd::Properties p,
dd::String_type state,
space_id_t  space_id = SPACE_UNKNOWN 
)

Get state attribute value in dd::Tablespace::se_private_data.

Parameters
[in]pdd::Properties for dd::Tablespace::se_private_data
[in,out]statetablespace state attribute
[in]space_idtablespace ID

◆ dd_tablespace_get_state() [2/2]

void dd_tablespace_get_state ( const dd::Tablespace dd_space,
dd::String_type state,
space_id_t  space_id = SPACE_UNKNOWN 
)

Get state attribute value in dd::Tablespace::se_private_data.

Parameters
[in]dd_spacedd::Tablespace object
[in,out]statetablespace state attribute
[in]space_idtablespace ID

◆ dd_tablespace_get_state_enum() [1/2]

dd_space_states dd_tablespace_get_state_enum ( const dd::Properties p,
space_id_t  space_id = SPACE_UNKNOWN 
)

Get the enum for the state of a tablespace from either dd::Tablespace::se_private_data or undo::Tablespace.

Parameters
[in]pdd::Properties for dd::Tablespace::se_private_data
[in]space_idtablespace ID
Returns
enumerated value associated with the key 'state'

◆ dd_tablespace_get_state_enum() [2/2]

dd_space_states dd_tablespace_get_state_enum ( const dd::Tablespace dd_space,
space_id_t  space_id = SPACE_UNKNOWN 
)

Get the enum for the state of the undo tablespace from either dd::Tablespace::se_private_data or undo::Tablespace.

Parameters
[in]dd_spacedd::Tablespace object
[in]space_idtablespace ID
Returns
enumerated value associated with the key 'state'

◆ dd_tablespace_get_state_enum_legacy()

dd_space_states dd_tablespace_get_state_enum_legacy ( const dd::Properties p,
space_id_t  space_id = SPACE_UNKNOWN 
)

Get the enum for the state of a tablespace.

Try the old 'discarded' key value for IBD spaces or undo::Tablespace.

Parameters
[in]pdd::Properties for dd::Tablespace::se_private_data
[in]space_idtablespace ID
Returns
enumerated value associated with the key 'state'

◆ dd_tablespace_is_discarded()

bool dd_tablespace_is_discarded ( const dd::Tablespace dd_space)

Get the discarded state from se_private_data of tablespace.

Parameters
[in]dd_spacedd::Tablespace object

◆ dd_tablespace_rename()

dberr_t dd_tablespace_rename ( dd::Object_id  dd_space_id,
bool  is_system_cs,
const char *  new_space_name,
const char *  new_path 
)

Update the tablespace name and file name for rename operation.

Parameters
[in]dd_space_iddd tablespace id
[in]is_system_cstrue, if space name is in system characters set. While renaming during bootstrap we have it in system cs. Otherwise, in file system cs.
[in]new_space_namedd_tablespace name
[in]new_pathnew data file path
Return values
DB_SUCCESSon success.

◆ dd_tablespace_set_discard()

void dd_tablespace_set_discard ( dd::Tablespace dd_space,
bool  discard 
)

Set discard attribute value in se_private_dat of tablespace.

Parameters
[in]dd_spacedd::Tablespace object
[in]discardtrue if discarded, else false

◆ dd_tablespace_set_id_and_state()

bool dd_tablespace_set_id_and_state ( const char *  space_name,
space_id_t  space_id,
dd_space_states  state 
)

Set Space ID and state attribute in se_private_data of mysql.tablespaces for the named tablespace.

Parameters
[in]space_nametablespace name
[in]space_idtablespace id
[in]statevalue to set for key 'state'
Returns
DB_SUCCESS or DD_FAILURE.

◆ dd_tablespace_set_state() [1/2]

void dd_tablespace_set_state ( dd::Tablespace dd_space,
dd_space_states  state 
)

Set the 'state' value in dd:tablespace::se_private_data.

The caller will update the transaction.

Parameters
[in,out]dd_spacedd::Tablespace object
[in]statevalue to set for key 'state'

◆ dd_tablespace_set_state() [2/2]

void dd_tablespace_set_state ( THD thd,
dd::Object_id  dd_space_id,
std::string  space_name,
dd_space_states  state 
)

Set the 'state' value in dd:tablespace::se_private_data starting with an object id and the space name.

Update the transaction when complete.

Parameters
[in]thdcurrent thread
[in]dd_space_iddd::Tablespace
[in]space_nametablespace name
[in]statevalue to set for key 'state'.

◆ dd_tablespace_update_cache()

bool dd_tablespace_update_cache ( THD thd)

Update all InnoDB tablespace cache objects.

This step is done post dictionary trx rollback, binlog recovery and DDL_LOG apply. So DD is consistent. Update the cached tablespace objects, if they differ from the dictionary.

Parameters
[in,out]thdthread handle
Return values
trueon error
falseon success

◆ dd_tablespaces_name()

static const dd::String_type dd_tablespaces_name ( "mysql/tablespaces"  )
static

◆ dd_thd_for_undo()

THD * dd_thd_for_undo ( const trx_t trx)

Returns thd associated with the trx or current_thd.

Parameters
[in]trxtransaction
Returns
trx->mysql_thd or current_thd

◆ dd_update_v_cols()

void dd_update_v_cols ( dd::Table dd_table,
table_id_t  id 
)

Update virtual columns with new se_private_data, currently, only table_id is set.

Parameters
[in,out]dd_tabledd::Table
[in]idInnoDB table ID to set

◆ dd_write_default_value()

void dd_write_default_value ( const dict_col_t col,
dd::Column dd_col 
)

Write default value of a column to dd::Column.

Parameters
[in]coldefault value of this column to write
[in,out]dd_colwhere to store the default value

◆ dd_write_table()

template<typename Table >
void dd_write_table ( dd::Object_id  dd_space_id,
Table *  dd_table,
const dict_table_t table 
)

Write metadata of a table to dd::Table.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in]dd_space_idTablespace id, which server allocates
[in,out]dd_tabledd::Table or dd::Partition
[in]tableInnoDB table object

◆ dd_write_tablespace()

void dd_write_tablespace ( dd::Tablespace dd_space,
space_id_t  space_id,
uint32_t  fsp_flags,
dd_space_states  state 
)

Write metadata of a tablespace to dd::Tablespace.

Parameters
[in,out]dd_spacedd::Tablespace
[in]space_idInnoDB tablespace ID
[in]fsp_flagsInnoDB tablespace flags
[in]stateInnoDB tablespace state

◆ fill_dict_dropped_columns()

void fill_dict_dropped_columns ( const dd::Table dd_table,
dict_table_t dict_table,
uint32_t &  current_row_version,
mem_heap_t heap 
)

Add definition of INSTANT dropped column in table cache.

Parameters
[in]dd_tableTable definition
[in,out]dict_tableTable cache
[out]current_row_versionrow_version
[in]heapheap

◆ get_field_types()

void get_field_types ( const dd::Table dd_tab,
const dict_table_t m_table,
const Field field,
unsigned &  col_len,
ulint mtype,
ulint prtype 
)

Get the mtype, prtype and len for a field.

Parameters
[in]dd_tabdd table definition
[in]m_tableinnodb table cache
[in]fieldMySQL field
[out]col_lenlength
[out]mtypemtype
[out]prtypeprtype

◆ get_row_format_name()

static const char * get_row_format_name ( enum row_type  row_format)
inlinestatic

Return a display name for the row format.

Parameters
[in]row_formatRow Format
Returns
row format name

◆ index_file_name_key()

static const dd::String_type index_file_name_key ( "index_file_name"  )
static

dd::Partition::options() key for INDEX DIRECTORY

◆ is_dropped()

bool is_dropped ( const Alter_inplace_info ha_alter_info,
const char *  column_name 
)

Check if given column is dropped during ALTER.

Parameters
[in]ha_alter_infoalter info
[in]column_nameColumn name
Returns
true if column is dropped, false otherwise.

◆ is_renamed()

bool is_renamed ( const Alter_inplace_info ha_alter_info,
const char *  old_name,
std::string &  new_name 
)

Check if given column is renamed during ALTER.

Parameters
[in]ha_alter_infoalter info
[in]old_namecolumn old name
[out]new_namecolumn new name
Returns
true if column is renamed, false otherwise.

◆ is_system_column()

static bool is_system_column ( const char *  col_name)
inlinestatic

◆ release_uncached_table()

void release_uncached_table ( TABLE_SHARE ts,
TABLE td 
)

free uncached table definition.

Parameters
[in]tsMySQL table share
[in]tdMySQL table definition

◆ thd_to_innodb_session()

innodb_session_t *& thd_to_innodb_session ( THD thd)

Obtain the private handler of InnoDB session specific data.

Parameters
[in,out]thdMySQL thread handler.
Returns
reference to private handler

Variable Documentation

◆ autoextend_size_str

constexpr char autoextend_size_str[] = "autoextend_size"
staticconstexpr

String constant for AUTOEXTEND_SIZE option string.

◆ dd_column_key_strings

const char* const dd_column_key_strings[DD_COLUMN__LAST]
Initial value:
= {
"default", "default_null", "version_added", "version_dropped",
"physical_pos"}

InnoDB private key strings for dd::Column,.

See also
dd_column_keys

◆ DD_FAILURE

constexpr bool DD_FAILURE = true
constexpr

◆ dd_index_key_strings

const char *const dd_index_key_strings
Initial value:
= {
"id", "space_id", "table_id", "root", "trx_id"}

InnoDB private key strings for dd::Index or dd::Partition_index.

See also
dd_index_keys

◆ dd_partition_key_strings

const char* const dd_partition_key_strings[DD_PARTITION__LAST]
Initial value:
= {
"format", "instant_col", "discard"}

InnoDB private key strings for dd::Partition.

See also
dd_partition_keys

◆ DD_SPACE_CURRENT_SPACE_VERSION

const uint32_t DD_SPACE_CURRENT_SPACE_VERSION = 1

The tablespace version that the tablespace created.

◆ DD_SPACE_CURRENT_SRV_VERSION

const uint32_t DD_SPACE_CURRENT_SRV_VERSION = MYSQL_VERSION_ID

Server version that the tablespace created.

◆ dd_space_key_strings

const char* const dd_space_key_strings[DD_SPACE__LAST]
Initial value:
= {
"flags", "id", "discard", "server_version", "space_version", "state"}

InnoDB private key strings for dd::Tablespace.

See also
dd_space_keys

◆ dd_space_state_values

const char* const dd_space_state_values[DD_SPACE_STATE__LAST+1]
Initial value:
= {
"normal",
"discarded",
"corrupted",
"active",
"inactive",
"empty",
"unknown"
}

InnoDB private value strings for key string "state" in dd::Tablespace.

See also
dd_space_state_values

◆ DD_SUCCESS

constexpr bool DD_SUCCESS = false
constexpr

DD functions return false for success and true for failure because that is the way the server functions are defined.

◆ dd_table_key_strings

const char* const dd_table_key_strings[DD_TABLE__LAST]
Initial value:
= {
"autoinc", "data_directory", "version", "discard", "instant_col"}

InnoDB private key strings for dd::Table.

See also
dd_table_keys

◆ DICT_MAX_DD_TABLES

constexpr uint32_t DICT_MAX_DD_TABLES = 1024
constexpr

Maximum hardcoded data dictionary tables.

◆ handler_name

constexpr char handler_name[] = "InnoDB"
staticconstexpr

Handler name for InnoDB.

◆ innobase_hton_name

const char innobase_hton_name[] = "InnoDB"
static

◆ innodb_dd_table

const innodb_dd_table_t innodb_dd_table[]

The hard-coded data dictionary tables.

◆ innodb_dd_table_size

constexpr size_t innodb_dd_table_size = UT_ARR_SIZE(innodb_dd_table)
staticconstexpr

Number of hard-coded data dictionary tables.

◆ reserved_implicit_name

constexpr char reserved_implicit_name[] = "innodb_file_per_table"
staticconstexpr

InnoDB implicit tablespace name or prefix, which should be same to dict_sys_t::s_file_per_table_name.