MySQL 9.0.0
Source Code Documentation
dict0dd.cc File Reference

Data dictionary interface. More...

#include <auto_thd.h>
#include <current_thd.h>
#include <sql/thd_raii.h>
#include <sql_backup_lock.h>
#include <sql_class.h>
#include <sql_thd_internal_api.h>
#include "item.h"
#include <dd/properties.h>
#include "dict0crea.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "dict0mem.h"
#include "dict0priv.h"
#include "sql/dd/impl/types/column_impl.h"
#include "sql/dd/types/column_type_element.h"
#include "dict0stats.h"
#include "data0type.h"
#include "fil0fil.h"
#include "mach0data.h"
#include "rem0rec.h"
#include "fts0priv.h"
#include "gis/rtree_support.h"
#include "srv0start.h"
#include "ut0crc32.h"
#include "btr0sea.h"
#include "derror.h"
#include "fts0plugin.h"
#include "ha_innodb.h"
#include "ha_innopart.h"
#include "ha_prototypes.h"
#include "mysql/plugin.h"
#include "mysql/strings/m_ctype.h"
#include "query_options.h"
#include "sql/create_field.h"
#include "sql/mysqld.h"
#include "sql_base.h"
#include "sql_table.h"
#include "univ.i"

Namespaces

namespace  dict_name
 Innodb data dictionary name.
 

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...
 
template<typename Index >
static bool dd_index_match (const dict_index_t *index, const Index *dd_index)
 Check if the InnoDB index is consistent with dd::Index. 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...
 
template bool dd_table_match< dd::Table > (const dict_table_t *, const dd::Table *)
 
template bool dd_table_match< dd::Partition > (const dict_table_t *, const dd::Partition *)
 
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...
 
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...
 
static dict_table_tdd_table_open_on_id_low (THD *thd, MDL_ticket **mdl, table_id_t table_id)
 Load an InnoDB table definition by InnoDB table ID. More...
 
static int dd_check_corrupted (dict_table_t *&table)
 Check if access to a table should be refused. 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...
 
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)
 Open an internal handle to a persistent InnoDB table by name. More...
 
void dd_table_close (dict_table_t *table, THD *thd, MDL_ticket **mdl, bool dict_locked)
 Close an internal InnoDB table handle. More...
 
static void replace_space_name_in_file_name (dd::Tablespace_file *dd_file, dd::String_type new_space_name)
 Replace the tablespace name in the file name. More...
 
static void to_lower (std::string &name)
 Convert string to lower case. More...
 
dberr_t dd_update_table_and_partitions_after_dir_change (dd::Object_id object_id, std::string path)
 Update the data directory flag in dd::Table key strings. 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...
 
static bool format_validate (THD *thd, const TABLE *form, row_type real_type, bool zip_allowed, bool strict, bool *is_redundant, bool *blob_prefix, ulint *zip_ssize, bool is_implicit)
 Validate the table format options. More...
 
void dd_set_autoinc (dd::Properties &se_private_data, uint64_t autoinc)
 Set the AUTO_INCREMENT 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...
 
template void dd_copy_private< dd::Table > (dd::Table &, const dd::Table &)
 
template void dd_copy_private< dd::Partition > (dd::Partition &, const dd::Partition &)
 
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 dd_copy_table_columns (const Alter_inplace_info *ha_alter_info, dd::Table &new_table, const dd::Table &old_table, dict_table_t *old_dict_table)
 Copy the engine-private parts of column definitions of a table. More...
 
void dd_part_adjust_table_id (dd::Table *new_table)
 Adjust TABLE_ID for partitioned table after ALTER TABLE ... PARTITION. 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_instant_columns_consistent (const dd::Table &dd_table)
 Check if the instant columns are consistent with the se_private_data in dd::Table. More...
 
void dd_visit_keys_with_too_long_parts (const TABLE *table, const size_t max_part_len, std::function< void(const KEY &)> visitor)
 Scan through all the keys to identify the key parts which are greater than the maximum size supported by the table record format. More...
 
static void instant_update_table_cols_count (dict_table_t *dict_table, uint32_t n_added_column, uint32_t n_dropped_column)
 
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...
 
static void set_dropped_column_name (std::string &name, uint32_t version, uint32_t phy_pos)
 
bool dd_drop_instant_columns (const dd::Table *old_dd_table, dd::Table *new_dd_table, dict_table_t *new_dict_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_dict_table, const Columns &cols_to_add)
 Add column default values for new instantly added columns. 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_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...
 
static void validate_dropped_col_metadata (const dd::Table *dd_table, const dict_table_t *table)
 
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 Index >
static void dd_write_index (dd::Object_id dd_space_id, Index *dd_index, const dict_index_t *index)
 Write metadata of a index to dd::Index. More...
 
template void dd_write_index< dd::Index > (dd::Object_id, dd::Index *, const dict_index_t *)
 
template void dd_write_index< dd::Partition_index > (dd::Object_id, dd::Partition_index *, const dict_index_t *)
 
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 void dd_write_table< dd::Table > (dd::Object_id, dd::Table *, const dict_table_t *)
 
template void dd_write_table< dd::Partition > (dd::Object_id, dd::Partition *, const dict_table_t *)
 
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...
 
template void dd_set_table_options< dd::Table > (dd::Table *, const dict_table_t *)
 
template void dd_set_table_options< dd::Partition > (dd::Partition *, const dict_table_t *)
 
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 uint16_t get_index_prefix_len (const KEY &key, const KEY_PART_INFO *key_part)
 Return the prefix length of the key. More...
 
template const dict_index_tdd_find_index< dd::Index > (const dict_table_t *, dd::Index *)
 
template const dict_index_tdd_find_index< dd::Partition_index > (const dict_table_t *, dd::Partition_index *)
 
static int dd_fill_one_dict_index (const dd::Index *dd_index, dict_table_t *table, const TABLE_SHARE *form, uint key_num)
 Create an index. More...
 
static ulint dd_parse_merge_threshold (THD *thd, const char *str)
 Parse MERGE_THRESHOLD value from a comment string. More...
 
void dd_copy_from_table_share (THD *thd, dict_table_t *table, const TABLE_SHARE *table_share)
 Copy attributes from MySQL TABLE_SHARE into an InnoDB table object. More...
 
int dd_fill_dict_index (const dd::Table &dd_table, const TABLE *m_form, dict_table_t *m_table, THD *m_thd)
 Instantiate index related metadata. More...
 
bool dd_table_contains_fulltext (const dd::Table &table)
 Determine if a table contains a fulltext index. More...
 
static void dd_fill_instant_columns_default (const dd::Table &dd_table, dict_table_t *table)
 Read the metadata of default values for all columns added instantly. More...
 
static void fill_dict_dropped_column (const dd::Column *column, dict_table_t *dict_table, uint32_t &crv, mem_heap_t *heap)
 
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...
 
static void validate_index_len (dict_table_t *m_table, const TABLE *table)
 Check if the individual parts of the composite index does not exceed the limit based on the table row format. More...
 
template<typename Table >
static void fill_dict_existing_column (const Table *dd_tab, const TABLE *m_form, dict_table_t *m_table, uint32_t &crv, mem_heap_t *heap, const uint32_t pos, bool has_row_versions)
 
void fill_dict_dropped_columns (const dd::Table *dd_table, dict_table_t *dict_table, uint32_t &crv, mem_heap_t *heap)
 Add definition of INSTANT dropped column in table cache. More...
 
template<typename Table >
static void fill_dict_columns (const Table *dd_table, const TABLE *m_form, dict_table_t *dict_table, const unsigned n_mysql_cols, mem_heap_t *heap, bool add_doc_id)
 
template<typename Table >
static dict_table_tdd_fill_dict_table (const Table *dd_tab, const TABLE *m_form, const char *norm_name, HA_CREATE_INFO *create_info, bool zip_allowed, bool strict, THD *m_thd, bool is_implicit)
 Instantiate in-memory InnoDB table metadata (dict_table_t), without any indexes. 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_drop_tablespace (dd::cache::Dictionary_client *dd_client, dd::Object_id dd_space_id)
 Drop a tablespace. More...
 
bool dd_tablespace_is_implicit (const dd::Tablespace *dd_space, bool *implicit)
 Determine if a tablespace is implicit. 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_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_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...
 
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...
 
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...
 
template<typename Table >
const char * dd_table_get_space_name (const Table *dd_table)
 Get tablespace name of dd::Table. More...
 
template<typename Table >
char * dd_get_first_path (mem_heap_t *heap, dict_table_t *table, Table *dd_table)
 Get the first filepath from mysql.tablespace_datafiles for a given space_id. 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 void dd_get_and_save_data_dir_path< dd::Table > (dict_table_t *, const dd::Table *, bool)
 
template void dd_get_and_save_data_dir_path< dd::Partition > (dict_table_t *, const dd::Partition *, bool)
 
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...
 
template<typename Table >
void dd_load_tablespace (const Table *dd_table, dict_table_t *table, mem_heap_t *heap, dict_err_ignore_t ignore_err, uint32_t expected_fsp_flags)
 Opens a tablespace for dd_load_table_one() More...
 
template<typename Table >
char * dd_space_get_name (mem_heap_t *heap, dict_table_t *table, Table *dd_table)
 Get the space name from mysql.tablespaces for a given space_id. 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...
 
template void dd_get_and_save_space_name< dd::Table > (dict_table_t *, const dd::Table *, bool)
 
template void dd_get_and_save_space_name< dd::Partition > (dict_table_t *, const dd::Partition *, bool)
 
template<typename Table >
dict_table_tdd_open_table_one (dd::cache::Dictionary_client *client, const TABLE *table, const char *norm_name, const Table *dd_table, THD *thd, dict_names_t &fk_list)
 Open or load a table definition based on a Global DD object. More...
 
static void dd_open_table_one_on_name (const char *name, bool dict_locked, dict_names_t &fk_list, THD *thd)
 Open single table with name. More...
 
void dd_open_fk_tables (dict_names_t &fk_list, bool dict_locked, THD *thd)
 Open foreign tables reference a table. 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...
 
template dict_table_tdd_open_table< dd::Table > (dd::cache::Dictionary_client *, const TABLE *, const char *, const dd::Table *, THD *)
 
template dict_table_tdd_open_table< dd::Partition > (dd::cache::Dictionary_client *, const TABLE *, const char *, const dd::Partition *, THD *)
 
static const rec_tdd_getnext_system_low (btr_pcur_t *pcur, mtr_t *mtr)
 Get next record from a new dd system table, like mysql.tables... More...
 
const rec_tdd_getnext_system_rec (btr_pcur_t *pcur, mtr_t *mtr)
 Get next record of new DD system tables. 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...
 
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...
 
static bool dd_get_or_assign_fts_tablespace_id (const dict_table_t *parent_table, const dict_table_t *table, dd::Object_id &dd_space_id)
 Get dd tablespace id for fts table. More...
 
void dd_set_fts_table_options (dd::Table *dd_table, const dict_table_t *table)
 Set table options for fts dd tables according to dict table. More...
 
static void dd_set_fts_nullability (dd::Column *dd_col, const dict_col_t *col)
 Add nullability info to column se_private_data. 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...
 
void dd_tablespace_set_space_id (dd::Tablespace *dd_space, space_id_t space_id)
 Set the space_id attribute in se_private_data of tablespace. More...
 
void dd_tablespace_set_state (THD *thd, dd::Object_id dd_space_id, std::string space_name, dd_space_states dd_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_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...
 
void dd_tablespace_get_state (const dd::Tablespace *dd_space, dd::String_type *state, space_id_t space_id)
 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)
 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)
 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)
 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)
 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_tablespace_get_mdl (const char *space_name, MDL_ticket **mdl_ticket, bool foreground)
 Get the MDL for the named tablespace. More...
 
void dd_release_mdl (MDL_ticket *mdl_ticket)
 Release the MDL held by the given ticket. More...
 
uint32_t dd_get_total_indexes_num ()
 
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...
 
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 dict_name::file_to_table (std::string &name, bool quiet)
 Conversion function to change for system to file name cs. More...
 
void dict_name::table_to_file (std::string &name)
 Conversion function to change for file name to system cs. More...
 
static void dict_name::get_partition_separators (bool is_57, std::string &part_sep, std::string &sub_part_sep)
 Get partition and sub-partition separator strings. More...
 
static bool dict_name::check_partition (const std::string &dict_name, bool sub_part, size_t &position)
 Check for partition and sub partition. More...
 
static bool dict_name::check_tmp (const std::string &dict_name, size_t &position)
 Check for TMP extension name. More...
 
bool dict_name::is_partition (const std::string &dict_name)
 Check if it is a table partition. More...
 
void dict_name::get_table (const std::string &dict_name, std::string &schema, std::string &table)
 Get schema and table name from dictionary table name. More...
 
void dict_name::get_table (const std::string &dict_name, bool convert, std::string &schema, std::string &table, std::string &partition, bool &is_tmp)
 Get schema, table name, partition string and temporary attribute from dictionary table name. More...
 
std::optional< table_name_componentsdict_name::parse_tablespace_path (std::string path)
 Get schema, table name, partition, subpartition and absolute directory from dictionary from filepath. More...
 
void dict_name::get_partition (const std::string &partition, bool convert, std::string &part, std::string &sub_part)
 Get partition and sub-partition name from partition string. More...
 
void dict_name::build_table (const std::string &schema, const std::string &table, const std::string &partition, bool is_tmp, bool convert, std::string &dict_name)
 
static void dict_name::build_partition_low (const std::string part, const std::string sub_part, Convert_Func conv, bool is_57, std::string &partition)
 Build partition string from partition and sub-partition name. More...
 
static void dict_name::get_part_from_dd (const dd::Partition *dd_part, bool lower_case, std::string &part_name, std::string &sub_name)
 Get partition and sub-partition name from DD. More...
 
void dict_name::build_partition (const dd::Partition *dd_part, std::string &partition)
 Build partition string from dd object. More...
 
void dict_name::build_57_partition (const dd::Partition *dd_part, std::string &partition)
 Build 5.7 style partition string from dd object. More...
 
bool dict_name::match_partition (const std::string &dict_name, const dd::Partition *dd_part)
 Check if dd partition matches with innodb dictionary table name. More...
 
static void dict_name::get_table_parts (const std::string &dict_name, std::string &schema, std::string &table, std::string &partition, bool &is_tmp)
 Get table and partition string in system cs from dictionary name. More...
 
void dict_name::convert_to_space (std::string &dict_name)
 
void dict_name::rebuild_space (const std::string &dict_name, std::string &space_name)
 
void dict_name::rebuild (std::string &dict_name)
 Rebuild table name to convert from 5.7 format to 8.0. More...
 

Variables

static const int DD_FIELD_OFFSET = 2
 All DD tables would contain DB_TRX_ID and DB_ROLL_PTR fields before other fields. More...
 

Detailed Description

Data dictionary interface.

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

◆ 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_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_check_corrupted()

static int dd_check_corrupted ( dict_table_t *&  table)
static

Check if access to a table should be refused.

Parameters
[in,out]tableInnoDB table or partition
Returns
error code
Return values
0on success (DD_SUVCCESS)

◆ 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_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_from_table_share()

void dd_copy_from_table_share ( THD thd,
dict_table_t table,
const TABLE_SHARE table_share 
)
inline

Copy attributes from MySQL TABLE_SHARE into an InnoDB table object.

Parameters
[in,out]thdthread context
[in,out]tableInnoDB table
[in]table_shareTABLE_SHARE

◆ 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_private< dd::Partition >()

template void dd_copy_private< dd::Partition > ( dd::Partition ,
const dd::Partition  
)

◆ dd_copy_private< dd::Table >()

template void dd_copy_private< dd::Table > ( dd::Table ,
const dd::Table  
)

◆ 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_fill_dict_index()

int dd_fill_dict_index ( const dd::Table dd_table,
const TABLE m_form,
dict_table_t m_table,
THD m_thd 
)
inline

Instantiate index related metadata.

Parameters
[in,out]dd_tableGlobal DD table metadata
[in]m_formMySQL table definition
[in,out]m_tableInnoDB table definition
[in]m_thdTHD instance
Returns
0 if successful, otherwise error number

◆ dd_fill_dict_table()

template<typename Table >
static dict_table_t * dd_fill_dict_table ( const Table *  dd_tab,
const TABLE m_form,
const char *  norm_name,
HA_CREATE_INFO create_info,
bool  zip_allowed,
bool  strict,
THD m_thd,
bool  is_implicit 
)
inlinestatic

Instantiate in-memory InnoDB table metadata (dict_table_t), without any indexes.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in]dd_tabGlobal Data Dictionary metadata, or NULL for internal temporary table
[in]m_formMySQL TABLE for current table
[in]norm_namenormalized table name
[in]create_infocreate info
[in]zip_allowedwhether ROW_FORMAT=COMPRESSED is OK
[in]strictwhether to use innodb_strict_mode=ON
[in]m_thdthread THD
[in]is_implicitif it is an implicit tablespace
Returns
created dict_table_t on success or nullptr

◆ dd_fill_instant_columns_default()

static void dd_fill_instant_columns_default ( const dd::Table dd_table,
dict_table_t table 
)
static

Read the metadata of default values for all columns added instantly.

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

◆ dd_fill_one_dict_index()

static int dd_fill_one_dict_index ( const dd::Index dd_index,
dict_table_t table,
const TABLE_SHARE form,
uint  key_num 
)
static

Create an index.

Parameters
[in]dd_indexDD Index
[in,out]tableInnoDB table
[in]formMySQL table structure
[in]key_numkey_info[] offset
Returns
error code
Return values
0on success
HA_ERR_TOO_BIG_ROWif the record is too long

◆ 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_find_index< dd::Index >()

template const dict_index_t * dd_find_index< dd::Index > ( const dict_table_t ,
dd::Index  
)

◆ dd_find_index< dd::Partition_index >()

◆ 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_data_dir_path< dd::Partition >()

template void dd_get_and_save_data_dir_path< dd::Partition > ( dict_table_t ,
const dd::Partition ,
bool   
)

◆ dd_get_and_save_data_dir_path< dd::Table >()

template void dd_get_and_save_data_dir_path< dd::Table > ( dict_table_t ,
const dd::Table ,
bool   
)

◆ 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_and_save_space_name< dd::Partition >()

template void dd_get_and_save_space_name< dd::Partition > ( dict_table_t ,
const dd::Partition ,
bool   
)

◆ dd_get_and_save_space_name< dd::Table >()

template void dd_get_and_save_space_name< dd::Table > ( dict_table_t ,
const dd::Table ,
bool   
)

◆ dd_get_first_path()

template<typename Table >
char * dd_get_first_path ( mem_heap_t heap,
dict_table_t table,
Table *  dd_table 
)

Get the first filepath from mysql.tablespace_datafiles for a given space_id.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]heapheap for store file name.
[in]tabledict table
[in]dd_tabledd table obj
Returns
First filepath (caller must invoke ut::free() on it)
Return values
nullptrif no mysql.tablespace_datafiles entry was found.

◆ 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_or_assign_fts_tablespace_id()

static bool dd_get_or_assign_fts_tablespace_id ( const dict_table_t parent_table,
const dict_table_t table,
dd::Object_id dd_space_id 
)
static

Get dd tablespace id for fts table.

Parameters
[in]parent_tableparent table of fts table
[in]tablefts table
[in,out]dd_space_iddd table space id
Returns
true on success, false on failure.

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

◆ dd_getnext_system_low()

static const rec_t * dd_getnext_system_low ( btr_pcur_t pcur,
mtr_t mtr 
)
static

Get next record from a new dd system table, like mysql.tables...

Parameters
[in,out]pcurPersistent cursor
[in]mtrMini-transaction
Returns
the next rec of the dd system table

◆ 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_index_match()

template<typename Index >
static bool dd_index_match ( const dict_index_t index,
const Index *  dd_index 
)
static

Check if the InnoDB index is consistent with dd::Index.

Parameters
[in]indexInnoDB index
[in]dd_indexdd::Index or dd::Partition_index
Returns
true if match
Return values
falseif not match

◆ 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_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_load_tablespace()

template<typename Table >
void dd_load_tablespace ( const Table *  dd_table,
dict_table_t table,
mem_heap_t heap,
dict_err_ignore_t  ignore_err,
uint32_t  expected_fsp_flags 
)

Opens a tablespace for dd_load_table_one()

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]dd_tabledd table
[in,out]tableA table that refers to the tablespace to open
[in,out]heapA memory heap
[in]expected_fsp_flagsexpected flags of tablespace to be loaded
[in]ignore_errWhether to ignore an error.

◆ 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_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_open_table< dd::Partition >()

template dict_table_t * dd_open_table< dd::Partition > ( dd::cache::Dictionary_client ,
const TABLE ,
const char *  ,
const dd::Partition ,
THD  
)

◆ dd_open_table< dd::Table >()

template dict_table_t * dd_open_table< dd::Table > ( dd::cache::Dictionary_client ,
const TABLE ,
const char *  ,
const dd::Table ,
THD  
)

◆ dd_open_table_one()

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

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
[in,out]fk_liststack of table names which need to load
Returns
ptr to dict_table_t filled, otherwise, nullptr

Look up the spatial reference system in the dictionary. Since this may cause a table open to read the dictionary tables, it must be done while not holding &dict_sys->mutex.

◆ dd_open_table_one_on_name()

static void dd_open_table_one_on_name ( const char *  name,
bool  dict_locked,
dict_names_t fk_list,
THD thd 
)
static

Open single table with name.

Parameters
[in]nametable name
[in]dict_lockeddict_sys mutex is held or not
[in,out]fk_listforeign key name list
[in]thdthread THD

◆ 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_parse_merge_threshold()

static ulint dd_parse_merge_threshold ( THD thd,
const char *  str 
)
static

Parse MERGE_THRESHOLD value from a comment string.

Parameters
[in]thdconnection
[in]strstring which might include 'MERGE_THRESHOLD='
Returns
value parsed
Return values
dict_index_t::MERGE_THRESHOLD_DEFAULTfor missing or invalid 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_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_fts_nullability()

static void dd_set_fts_nullability ( dd::Column dd_col,
const dict_col_t col 
)
static

Add nullability info to column se_private_data.

Parameters
[in,out]dd_colDD table column
[in]colInnoDB table column

◆ dd_set_fts_table_options()

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

Set table options for fts dd tables according to dict table.

Parameters
[in,out]dd_tabledd table instance
[in]tabledict table instance

◆ 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_table_options< dd::Partition >()

template void dd_set_table_options< dd::Partition > ( dd::Partition ,
const dict_table_t  
)

◆ dd_set_table_options< dd::Table >()

template void dd_set_table_options< dd::Table > ( dd::Table ,
const dict_table_t  
)

◆ 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_space_get_name()

template<typename Table >
char * dd_space_get_name ( mem_heap_t heap,
dict_table_t table,
Table *  dd_table 
)

Get the space name from mysql.tablespaces for a given space_id.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in,out]heapheap for store file name.
[in]tabledict table
[in]dd_tabledd table obj
Returns
First filepath (caller must invoke ut::free() on it)
Return values
nullptrif no mysql.tablespace_datafiles entry was found.

◆ 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_contains_fulltext()

bool dd_table_contains_fulltext ( const dd::Table table)
inline

Determine if a table contains a fulltext index.

Parameters
[in]tabledd::Table
Returns
whether the table contains any fulltext index

◆ 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_space_name()

template<typename Table >
const char * dd_table_get_space_name ( const Table *  dd_table)

Get tablespace name of dd::Table.

Template Parameters
Tabledd::Table or dd::Partition
Parameters
[in]dd_tabledd table object
Returns
the tablespace name or nullptr if failed

◆ 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_match< dd::Partition >()

template bool dd_table_match< dd::Partition > ( const dict_table_t ,
const dd::Partition  
)

◆ dd_table_match< dd::Table >()

template bool dd_table_match< dd::Table > ( const dict_table_t ,
const dd::Table  
)

◆ 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_low()

static dict_table_t * dd_table_open_on_id_low ( THD thd,
MDL_ticket **  mdl,
table_id_t  table_id 
)
static

Load an InnoDB table definition by InnoDB table ID.

Parameters
[in,out]thdcurrent thread
[in,out]mdlmetadata lock; nullptr if we are resurrecting table IX locks in recovery
[in]table_idInnoDB table or partition ID
Returns
InnoDB table
Return values
nullptrif the table is not found, or there was an error

◆ 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_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_is_implicit()

bool dd_tablespace_is_implicit ( const dd::Tablespace dd_space,
bool *  implicit 
)

Determine if a tablespace is implicit.

Parameters
[in]dd_spaceDD space object
[out]implicitwhether the tablespace is implicit tablespace
Return values
falseon success
trueon failure (corrupt 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_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_space_id()

void dd_tablespace_set_space_id ( dd::Tablespace dd_space,
space_id_t  space_id 
)

Set the space_id attribute in se_private_data of tablespace.

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

◆ 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_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_table_and_partitions_after_dir_change()

dberr_t dd_update_table_and_partitions_after_dir_change ( dd::Object_id  object_id,
std::string  path 
)

Update the data directory flag in dd::Table key strings.

Parameters
[in]object_iddd tablespace object id
[in]pathpath where the ibd file is located currently
Return values
DB_SUCCESSon success.

◆ 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_visit_keys_with_too_long_parts()

void dd_visit_keys_with_too_long_parts ( const TABLE table,
const size_t  max_part_len,
std::function< void(const KEY &)>  visitor 
)

Scan through all the keys to identify the key parts which are greater than the maximum size supported by the table record format.

Parameters
tableMySQL table definition.
max_part_lenMaximum index part length allowed.
visitorFunction wrapper to invoke lambda expression.

◆ 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_index()

template<typename Index >
static void dd_write_index ( dd::Object_id  dd_space_id,
Index *  dd_index,
const dict_index_t index 
)
static

Write metadata of a index to dd::Index.

Parameters
[in]dd_space_idTablespace id, which server allocates
[in,out]dd_indexdd::Index
[in]indexInnoDB index object

◆ dd_write_index< dd::Index >()

template void dd_write_index< dd::Index > ( dd::Object_id  ,
dd::Index ,
const dict_index_t  
)

◆ dd_write_index< dd::Partition_index >()

◆ 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_table< dd::Partition >()

template void dd_write_table< dd::Partition > ( dd::Object_id  ,
dd::Partition ,
const dict_table_t  
)

◆ dd_write_table< dd::Table >()

template void dd_write_table< dd::Table > ( dd::Object_id  ,
dd::Table ,
const dict_table_t  
)

◆ 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_columns()

template<typename Table >
static void fill_dict_columns ( const Table *  dd_table,
const TABLE m_form,
dict_table_t dict_table,
const unsigned  n_mysql_cols,
mem_heap_t heap,
bool  add_doc_id 
)
inlinestatic

◆ fill_dict_dropped_column()

static void fill_dict_dropped_column ( const dd::Column column,
dict_table_t dict_table,
uint32_t &  crv,
mem_heap_t heap 
)
static

◆ 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

◆ fill_dict_existing_column()

template<typename Table >
static void fill_dict_existing_column ( const Table *  dd_tab,
const TABLE m_form,
dict_table_t m_table,
uint32_t &  crv,
mem_heap_t heap,
const uint32_t  pos,
bool  has_row_versions 
)
inlinestatic

◆ format_validate()

static bool format_validate ( THD thd,
const TABLE form,
row_type  real_type,
bool  zip_allowed,
bool  strict,
bool *  is_redundant,
bool *  blob_prefix,
ulint zip_ssize,
bool  is_implicit 
)
static

Validate the table format options.

Parameters
[in]thdTHD instance
[in]formMySQL table definition
[in]real_typereal row type if it's not ROW_TYPE_NOT_USED
[in]zip_allowedwhether ROW_FORMAT=COMPRESSED is OK
[in]strictwhether innodb_strict_mode=ON
[out]is_redundantwhether ROW_FORMAT=REDUNDANT
[out]blob_prefixwhether ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED
[out]zip_ssizelog2(compressed page size), or 0 if not ROW_FORMAT=COMPRESSED
[out]is_implicitif tablespace is implicit
Return values
trueif invalid (my_error will have been called)
falseif valid

◆ 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_index_prefix_len()

static uint16_t get_index_prefix_len ( const KEY key,
const KEY_PART_INFO key_part 
)
inlinestatic

Return the prefix length of the key.

Parameters
[in]keyKey information.
[in]key_partKey part information.
Returns
Key prefix length or 0 if whole column is indexed.

◆ instant_update_table_cols_count()

static void instant_update_table_cols_count ( dict_table_t dict_table,
uint32_t  n_added_column,
uint32_t  n_dropped_column 
)
static

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

◆ 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

◆ replace_space_name_in_file_name()

static void replace_space_name_in_file_name ( dd::Tablespace_file dd_file,
dd::String_type  new_space_name 
)
static

Replace the tablespace name in the file name.

Parameters
[in]dd_filethe tablespace file object.
[in]new_space_namenew table space name to be updated in file name. It must have already been converted to the filename_charset such that d1/d2\d3.t3\t4/t5 should look like: d1@002fd2@005cd3/t3@005ct4@002ft5 both on Windows and on Linux.

◆ set_dropped_column_name()

static void set_dropped_column_name ( std::string &  name,
uint32_t  version,
uint32_t  phy_pos 
)
static

◆ to_lower()

static void to_lower ( std::string &  name)
static

Convert string to lower case.

Parameters
[in,out]namename to convert

◆ validate_dropped_col_metadata()

static void validate_dropped_col_metadata ( const dd::Table dd_table,
const dict_table_t table 
)
inlinestatic

◆ validate_index_len()

static void validate_index_len ( dict_table_t m_table,
const TABLE table 
)
static

Check if the individual parts of the composite index does not exceed the limit based on the table row format.

If yes, mark the index as corrupt.

Parameters
[in]m_tableInnoDB table handle
[in]tableMySQL table definition

Variable Documentation

◆ DD_FIELD_OFFSET

const int DD_FIELD_OFFSET = 2
static

All DD tables would contain DB_TRX_ID and DB_ROLL_PTR fields before other fields.

This offset indicates the position at which the first DD column is located.