MySQL 8.0.40
Source Code Documentation
|
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 * > |
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... | |
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... | |
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 ¤t_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::Index * | dd_first_index (const dd::Table *table) |
Get the first index of a table. More... | |
const dd::Partition_index * | dd_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_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. 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... | |
THD * | dd_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_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... 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_t * | dd_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_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. 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_t * | dd_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_t * | dd_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_t * | dd_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_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. 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... | |
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... | |
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::Column * | dd_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::Column * | dd_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::Index * | dd_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 ¤t_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... | |
Data dictionary interface.
enum 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.
enum dd_index_keys |
enum dd_partition_keys |
InnoDB private keys for dd::Partition.
enum dd_space_keys |
enum dd_space_states |
Values for InnoDB private key "state" for dd::Tablespace.
enum dd_table_keys |
InnoDB private keys for dd::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.
[in] | thd | thread THD |
[in] | client | data dictionary client |
[in] | dd_table | Global DD table object |
[in] | name | Table Name |
[out] | ts | MySQL table share |
[out] | td | MySQL table definition |
error | number on error |
0 | on success |
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
true | Failure |
false | Success |
|
inlinestatic |
Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID.
[in] | thd | MySQL thread handle |
[in] | form | information on table columns and indexes |
[out] | doc_id_col | Doc ID column number if there exist a FTS_DOC_ID column, ULINT_UNDEFINED if column is of the wrong type/name/size |
|
static |
dd::Partition::options() key for DATA DIRECTORY
Add fts doc id column and index to new table when old table has hidden fts doc id without fulltext index.
[in,out] | new_table | New dd table |
[in] | old_table | Old dd table |
|
inlinestatic |
Add a hidden column when creating a table.
[in,out] | dd_table | table containing user columns and indexes |
[in] | name | hidden column name |
[in] | length | length of the column, in bytes |
[in] | type | column type |
|
inlinestatic |
Add a hidden index element at the end.
[in,out] | index | created index metadata |
[in] | column | column of the index |
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.
[in] | old_dd_table | Old dd::Table |
[in,out] | new_dd_table | New dd::Table |
[in,out] | new_table | New InnoDB table object |
[in] | cols_to_add | columns to be added INSTANTly |
true | Failure |
false | Success |
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.
[in,out] | dd_part | dd::Partition |
Clear the instant ADD COLUMN information of a table.
[in,out] | dd_table | dd::Table |
[in] | clear_version | true if version metadata is to be cleared |
uint32_t dd_column_get_version_added | ( | const dd::Column * | dd_col | ) |
Get the row version in which column is INSTANT ADD.
uint32_t dd_column_get_version_dropped | ( | const dd::Column * | dd_col | ) |
Get the row version in which column is INSTANT DROP.
bool dd_column_is_added | ( | const dd::Column * | dd_col | ) |
Determine if column is INSTANT ADD.
bool dd_column_is_dropped | ( | const dd::Column * | dd_col | ) |
Determine if column is INSTANT DROP.
|
static |
void dd_copy_autoinc | ( | const dd::Properties & | src, |
dd::Properties & | dest | ||
) |
Copy the AUTO_INCREMENT and version attribute if exist.
[in] | src | dd::Table::se_private_data to copy from |
[out] | dest | dd::Table::se_private_data to copy to |
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.
[in,out] | new_table | New table definition |
[in] | old_table | Old table definition |
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
Table | dd::Table or dd::Partition |
[in,out] | new_table | Copy of old table or partition definition |
[in] | old_table | Old table or partition definition |
|
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.
[in] | ha_alter_info | alter info |
[in,out] | new_table | Copy of old table definition |
[in] | old_table | Old table definition |
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.
[in] | ha_alter_info | alter info |
[in,out] | new_table | Copy of old table |
[in] | old_table | Old table |
[in] | dict_table | InnoDB table cache |
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.
[in] | parent_table | parent table of fts table |
[in,out] | table | fts table |
[in] | is_config | flag whether it's fts aux configure 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.
[in] | parent_table | parent table of fts table |
[in,out] | table | fts table |
[in] | charset | fts index charset |
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.
[in,out] | dd_client | data dictionary client |
[in] | space_id | InnoDB tablespace ID |
[in] | space_name | tablespace name to be set for the newly created tablespace |
[in] | filename | tablespace filename |
[in] | discarded | true if this tablespace was discarded |
[in,out] | dd_space_id | dd tablespace id |
false | on success |
true | on failure |
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.
[in,out] | dd_client | data dictionary client |
[in,out] | dd_space_name | dd tablespace name |
[in] | space_id | InnoDB tablespace ID |
[in] | flags | InnoDB tablespace flags |
[in] | filename | filename of this tablespace |
[in] | discarded | true if this tablespace was discarded |
[in,out] | dd_space_id | dd_space_id |
false | on success |
true | on failure |
bool dd_drop_fts_table | ( | const char * | name, |
bool | file_per_table | ||
) |
Drop dd table & tablespace for fts aux table.
[in] | name | table name |
[in] | file_per_table | flag whether use file per table |
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.
[in] | old_dd_table | Old dd::Table |
[in,out] | new_dd_table | New dd::Table |
[in,out] | new_table | New InnoDB table objecta |
[in] | cols_to_drop | list of columns to be dropped |
[in] | cols_to_add | list of columns to be added |
[in] | ha_alter_info | alter info |
true | Failure |
false | Success |
bool dd_drop_tablespace | ( | dd::cache::Dictionary_client * | dd_client, |
dd::Object_id | dd_space_id | ||
) |
Drop a tablespace.
[in,out] | dd_client | data dictionary client |
[in] | dd_space_id | dd tablespace id |
false | On success |
true | On failure |
|
inlinestatic |
Look up a column in a table using the system_charset_info collation.
[in] | dd_table | data dictionary table |
[in] | name | column name |
nullptr | if not found |
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.
Index | dd::Index or dd::Partition_index |
[in] | table | InnoDB table object |
[in] | dd_index | Index to search |
|
inline |
Get the first index of a table or partition.
Table | dd::Table or dd::Partition |
Index | dd::Index or dd::Partition_index |
[in] | table | table containing user columns and indexes |
NULL | if there are no indexes |
|
inline |
Get the first index of a partition.
[in] | partition | partition or subpartition |
NULL | if there are no indexes |
Get the first index of a table.
[in] | table | table containing user columns and indexes |
NULL | if there are no indexes |
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.
Table | dd::Table or dd::Partition |
[in,out] | table | Table object |
[in] | dd_table | DD table object |
[in] | dict_mutex_own | true if dict_sys->mutex is owned already |
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.
[in] | table | Table object |
[in] | dd_table | Global DD table or partition object |
[in] | dict_mutex_own | true if dict_sys->mutex is owned already |
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.
[in,out] | table | table object |
[in] | dd_table | DD table object |
[out] | filename | filename |
[in] | max_len | filename max length |
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.
[in] | name | foreign key table name |
[in] | database_name | table db name |
[in] | database_name_len | db name length |
[in] | table_name | table db name |
[in] | table_name_len | table name length |
[in,out] | table | table object or NULL |
[in,out] | mdl | mdl on table |
[in,out] | heap | heap memory |
|
inline |
Get the explicit dd::Tablespace::id of a partition.
[in] | partition | partition or subpartition |
dd::INVALID_OBJECT_ID | if there is no explicit tablespace |
|
inline |
Get the explicit dd::Tablespace::id of a table.
[in] | table | non-partitioned table |
dd::INVALID_OBJECT_ID | if there is no explicit tablespace |
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.
[in] | dd_client | Data dictionary client |
[in] | dd_space_id | Tablespace ID |
[out] | autoextend_size | Value of autoextend_size attribute |
false | On success |
true | On failure |
uint32_t dd_get_total_indexes_num | ( | ) |
|
inline |
Get the version attribute.
[in] | dd_table | dd::Table |
const rec_t * dd_getnext_system_rec | ( | btr_pcur_t * | pcur, |
mtr_t * | mtr | ||
) |
Get next record of new DD system tables.
[in,out] | pcur | Persistent cursor |
[in] | mtr | Mini-transaction |
next | record |
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.
[in,out] | dd_client | Data dictionary client |
[in] | dd_space_id | DD tablespace id |
[in] | create_info | HA_CREATE_INFO object |
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.
[in] | table | InnoDB table object |
[in,out] | dd_table | dd::Table |
|
static |
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.
[in] | dd_table | dd::Table |
|
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.
[in] | partition | dd::Partition |
|
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
[in] | table | non-partitioned dd::Table |
bool dd_is_table_in_encrypted_tablespace | ( | const dict_table_t * | table | ) |
bool dd_is_valid_row_version | ( | uint32_t | version | ) |
Determine if give version is a valid row version.
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.
[in] | dd_col | dd::Column |
[in] | col | InnoDB column object |
false | Not match |
|
inlinestatic |
Acquire a shared metadata lock.
[in,out] | thd | current thread |
[out] | mdl | metadata lock |
[in] | db | schema name |
[in] | table | table name |
false | if acquired, or trylock timed out |
true | if failed (my_error() will have been called) |
bool dd_mdl_for_undo | ( | const trx_t * | trx | ) |
Check if current undo needs a MDL or not.
[in] | trx | transaction |
void dd_mdl_release | ( | THD * | thd, |
MDL_ticket ** | mdl | ||
) |
Release a metadata lock.
[in,out] | thd | current thread |
[in,out] | mdl | metadata lock |
void dd_open_fk_tables | ( | dict_names_t & | fk_list, |
bool | dict_locked, | ||
THD * | thd | ||
) |
Open foreign tables reference a table.
[in] | fk_list | foreign key name list |
[in] | dict_locked | dict_sys mutex is locked or not |
[in] | thd | thread THD |
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.
Table | dd::Table or dd::Partition |
[in,out] | client | data dictionary client |
[in] | table | MySQL table definition |
[in] | norm_name | Table Name |
[in] | dd_table | Global DD table or partition object |
[in] | thd | thread THD |
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.
[in] | se_private_data | dd::Column::se_private |
[in,out] | col | InnoDB column object |
[in,out] | heap | Heap to store the default value |
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
[in,out] | new_table | New dd::Table |
|
inline |
Determine if a dd::Partition has any instant column.
[in] | part | dd::Partition |
|
inline |
Determine if a dd::Partition is the first leaf partition in the table.
[in] | dd_part | dd::Partition |
False | Not the first one |
|
inline |
Determine if a partition is materialized.
[in] | part | partition |
|
static |
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.
[in,out] | heap | Temp memory heap |
[in] | rec | mysql.columns record |
[in,out] | col | dict_col_t to fill |
[in,out] | table_id | Table id |
[in,out] | col_name | Column name |
[in,out] | nth_v_col | Nth v column |
[in] | dd_columns | dict_table_t obj of mysql.columns |
[in,out] | mtr | Mini-transaction |
true | if column is filled |
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.
[in] | heap | Temp memory heap |
[in,out] | rec | mysql.indexes record |
[in,out] | index | dict_index_t to fill |
[in] | mdl | MDL on index->table |
[in,out] | parent | Parent table if it's fts aux table. |
[in,out] | parent_mdl | MDL on parent if it's fts aux table. |
[in] | dd_indexes | dict_table_t obj of mysql.indexes |
[in] | mtr | Mini-transaction |
true | if index is filled |
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.
[in] | heap | temp memory heap |
[in,out] | rec | mysql.indexes record |
[in,out] | index_id | index id |
[in,out] | space_id | space id |
[in] | dd_indexes | dict_table_t obj of mysql.indexes |
true | if index is filled |
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.
[in] | heap | Temp memory heap |
[in,out] | rec | mysql.table_partitions record |
[in,out] | table | dict_table_t to fill |
[in] | dd_tables | dict_table_t obj of dd partition table |
[in] | mdl | MDL on the table |
[in] | mtr | Mini-transaction |
error | message, or NULL on success |
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.
[in] | heap | Temp memory heap |
[in,out] | rec | mysql.tables record |
[in,out] | table | dict_table_t to fill |
[in] | dd_tables | dict_table_t obj of dd system table |
[in] | mdl | MDL on the table |
[in] | mtr | Mini-transaction |
error | message, or NULL on success |
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.
[in] | heap | temp memory heap |
[in] | rec | mysql.tablespaces record |
[out] | space_id | space id |
[out] | name | space name |
[out] | flags | space flags |
[out] | server_version | server version |
[out] | space_version | space version |
[out] | is_encrypted | true if tablespace is encrypted |
[out] | autoextend_size | autoextend_size attribute value |
[out] | state | space state |
[in] | dd_spaces | dict_table_t obj of mysql.tablespaces |
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.
[in] | heap | temp memory heap |
[in,out] | rec | mysql.columns record |
[in,out] | table_id | Table id |
[in,out] | pos | Position |
[in,out] | base_pos | Base column position |
[in,out] | n_row | Number of rows |
[in] | dd_columns | dict_table_t obj of mysql.columns |
[in] | mtr | Mini-transaction |
true | if virtual info is filled |
void dd_release_mdl | ( | MDL_ticket * | mdl_ticket | ) |
Release the MDL held by the given ticket.
[in] | mdl_ticket | tablespace MDL ticket |
bool dd_rename_fts_table | ( | const dict_table_t * | table, |
const char * | old_name | ||
) |
Rename dd table & tablespace files for fts aux table.
[in] | table | dict table |
[in] | old_name | old innodb table name |
void dd_set_autoinc | ( | dd::Properties & | se_private_data, |
uint64_t | autoinc | ||
) |
Set the AUTO_INCREMENT attribute.
[in,out] | se_private_data | dd::Table::se_private_data |
[in] | autoinc | the auto-increment value |
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.
[in] | partition | leaf dd::Partition |
[in] | discard | true if Table is discarded, false otherwise |
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.
[in] | table | non-partitioned dd::Table |
[in] | discard | true if Table is discarded, false otherwise |
|
inlinestatic |
Initialize a hidden unique B-tree index.
[in,out] | index | created index metadata |
[in] | name | name of the index |
[in] | column | column of the index |
void dd_set_table_options | ( | Table * | dd_table, |
const dict_table_t * | table | ||
) |
Set options of dd::Table according to InnoDB table object.
Table | dd::Table or dd::Partition |
[in,out] | dd_table | dd::Table or dd::Partition |
[in] | table | InnoDB table object |
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.
[in,out] | client | dictionary client |
[in] | algorithm | compression algorithm |
[in] | dd_space_id | DD tablespace ID. |
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...
[in] | thd | THD |
[in,out] | mdl | MDL lock |
[in,out] | pcur | Persistent cursor |
[in,out] | mtr | Mini-transaction |
[in] | system_table_name | Which dd system table to open |
[in,out] | table | dict_table_t obj of dd system table |
the | first rec of the dd system table |
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
[in,out] | client | data dictionary client |
[in] | tbl_name | Table Name |
[in] | col_names | column names, or NULL |
[out] | m_table | InnoDB table handle |
[in] | check_charsets | whether to check charset compatibility |
[in] | ignore_err | DICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE |
[in,out] | fk_tables | name list for tables that refer to this table |
void dd_table_close | ( | dict_table_t * | table, |
THD * | thd, | ||
MDL_ticket ** | mdl, | ||
bool | dict_locked | ||
) |
Close an internal InnoDB table handle.
[in,out] | table | InnoDB table handle |
[in,out] | thd | current MySQL connection (for mdl) |
[in,out] | mdl | metadata lock (will be set NULL) |
[in] | dict_locked | whether we hold dict_sys mutex |
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.
[in,out] | thd | current thread |
[in] | table | InnoDB table |
[in,out] | table_def | MySQL dd::Table to update |
[in] | discard | discard flag |
false | if fail. |
|
inline |
Set different column counters.
[in] | table | dd::Table |
[out] | i_c | initial column count |
[out] | c_c | current column count |
[out] | t_c | total column count |
[in] | current_row_version | current row version |
|
inline |
Determine if dd::Table has INSTANT ADD columns.
[in] | table | table definition |
|
inline |
Determine if a dd::Table has any INSTANTly ADDed/DROPped column.
[in] | table | dd::Table |
|
inline |
Determine if dd::Table has INSTANT DROPPED columns.
[in] | table | table definition |
|
inline |
Determine if a dd::Table has row versions.
[in] | table | dd::Table |
|
inline |
Determine if a dd::Table is partitioned table.
[in] | table | dd::Table |
False | non-partitioned table |
|
inline |
Determine if a dd::Table has any INSTANT ADD column(s) in V1.
[in] | table | dd::Table |
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
[in,out] | client | data dictionary client |
[in] | tbl_name | Table Name |
[in] | col_names | column names, or NULL |
[out] | m_table | InnoDB table handle |
[in] | dd_table | Global DD table |
[in] | thd | thread THD |
[in] | dict_locked | True if dict_sys->mutex is already held, otherwise false |
[in] | check_charsets | whether to check charset compatibility |
[in,out] | fk_tables | name list for tables that refer to this table |
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.
[out] | m_table | InnoDB table handle |
[in] | dd_table | Global DD table |
[in] | col_names | column names, or NULL |
[in] | ignore_err | DICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE |
[in] | dict_locked | True if dict_sys->mutex is already held, otherwise false |
bool dd_table_match | ( | const dict_table_t * | table, |
const Table * | dd_table | ||
) |
Check if the InnoDB table is consistent with dd::Table.
Table | dd::Table or dd::Partition |
[in] | table | InnoDB table |
[in] | dd_table | dd::Table or dd::Partition |
false | if not match |
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.
[in] | thd | thread THD |
[in,out] | client | data dictionary client |
[in] | dd_table | Global DD table object |
[in] | dd_part | Global DD partition or subpartition, or NULL |
[in] | tbl_name | table name, or NULL if not known |
[out] | table | InnoDB table (NULL if not found or loadable) |
[in] | td | MYSQL table definition |
0 | on success |
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.
[in] | table_id | table identifier |
[in,out] | thd | current MySQL connection (for mdl) |
[in,out] | mdl | metadata lock (*mdl set if table_id was found) mdl=NULL if we are resurrecting table IX locks in recovery |
[in] | dict_locked | dict_sys mutex is held |
[in] | check_corruption | check if the table is corrupted or not. |
NULL | if the table does not exist or cannot be opened |
|
inlinestatic |
Returns a cached table object based on table id.
This function does NOT move the table to the front of MRU, because currently it is called in contexts where we don't really mean to "use" the table, and believe that it would actually hurt performance if we moved it to the front, such as:
[in] | table_id | table id |
[in] | dict_locked | true=data dictionary locked |
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.
[in,out] | thd | current thread |
[out] | mdl | metadata lock |
[in] | name | InnoDB table name |
[in] | dict_locked | has dict_sys mutex locked |
[in] | ignore_err | whether to ignore err |
[out] | error | pointer to error |
NULL | if the table does not exist |
|
inlinestatic |
Returns a cached table object based on table name.
[in] | name | table name |
[in] | dict_locked | true=data dictionary locked |
|
inline |
Determine if any partition of the table still has instant columns.
[in] | table | dd::Table of the partitioned table |
|
static |
Table names needed to process I_S queries.
bool dd_tablespace_get_discard | ( | const dd::Tablespace * | dd_space | ) |
Get discard attribute value stored in se_private_dat of tablespace.
[in] | dd_space | dd::Tablespace object |
true | if Tablespace is discarded |
false | if attribute doesn't exist or if the tablespace is not discarded |
|
inlinestatic |
Get the file name of a tablespace.
[in] | dd_space | Tablespace metadata |
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.
[in] | space_name | tablespace name |
[in] | mdl_ticket | tablespace MDL ticket, default to nullptr |
[in] | foreground | true, if the caller is foreground thread. Default is true. For foreground, the lock duration is MDL_TRANSACTION. Otherwise, it is MDL_EXPLICIT. |
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.
[in] | p | dd::Properties for dd::Tablespace::se_private_data |
[in,out] | state | tablespace state attribute |
[in] | space_id | tablespace ID |
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.
[in] | dd_space | dd::Tablespace object |
[in,out] | state | tablespace state attribute |
[in] | space_id | tablespace ID |
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.
[in] | p | dd::Properties for dd::Tablespace::se_private_data |
[in] | space_id | tablespace ID |
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.
[in] | dd_space | dd::Tablespace object |
[in] | space_id | tablespace ID |
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.
[in] | p | dd::Properties for dd::Tablespace::se_private_data |
[in] | space_id | tablespace ID |
bool dd_tablespace_is_discarded | ( | const dd::Tablespace * | dd_space | ) |
Get the discarded state from se_private_data of tablespace.
[in] | dd_space | dd::Tablespace object |
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.
[in] | dd_space_id | dd tablespace id |
[in] | is_system_cs | true, 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_name | dd_tablespace name |
[in] | new_path | new data file path |
DB_SUCCESS | on success. |
void dd_tablespace_set_discard | ( | dd::Tablespace * | dd_space, |
bool | discard | ||
) |
Set discard attribute value in se_private_dat of tablespace.
[in] | dd_space | dd::Tablespace object |
[in] | discard | true if discarded, else false |
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.
[in] | space_name | tablespace name |
[in] | space_id | tablespace id |
[in] | state | value to set for key 'state' |
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.
[in,out] | dd_space | dd::Tablespace object |
[in] | state | value to set for key 'state' |
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.
[in] | thd | current thread |
[in] | dd_space_id | dd::Tablespace |
[in] | space_name | tablespace name |
[in] | state | value to set for key 'state'. |
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.
[in,out] | thd | thread handle |
true | on error |
false | on success |
|
static |
Returns thd associated with the trx or current_thd.
[in] | trx | transaction |
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.
[in] | object_id | dd tablespace object id |
[in] | path | path where the ibd file is located currently |
DB_SUCCESS | on success. |
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.
[in,out] | dd_table | dd::Table |
[in] | id | InnoDB table ID to set |
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.
table | MySQL table definition. |
max_part_len | Maximum index part length allowed. |
visitor | Function wrapper to invoke lambda expression. |
void dd_write_default_value | ( | const dict_col_t * | col, |
dd::Column * | dd_col | ||
) |
Write default value of a column to dd::Column.
[in] | col | default value of this column to write |
[in,out] | dd_col | where to store the default value |
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.
Table | dd::Table or dd::Partition |
[in] | dd_space_id | Tablespace id, which server allocates |
[in,out] | dd_table | dd::Table or dd::Partition |
[in] | table | InnoDB table object |
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.
[in,out] | dd_space | dd::Tablespace |
[in] | space_id | InnoDB tablespace ID |
[in] | fsp_flags | InnoDB tablespace flags |
[in] | state | InnoDB tablespace state |
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.
[in] | dd_table | Table definition |
[in,out] | dict_table | Table cache |
[out] | current_row_version | row_version |
[in] | heap | 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.
[in] | dd_tab | dd table definition |
[in] | m_table | innodb table cache |
[in] | field | MySQL field |
[out] | col_len | length |
[out] | mtype | mtype |
[out] | prtype | prtype |
|
inlinestatic |
Return a display name for the row format.
[in] | row_format | Row Format |
|
static |
dd::Partition::options() key for INDEX DIRECTORY
bool is_dropped | ( | const Alter_inplace_info * | ha_alter_info, |
const char * | column_name | ||
) |
Check if given column is dropped during ALTER.
[in] | ha_alter_info | alter info |
[in] | column_name | Column name |
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.
[in] | ha_alter_info | alter info |
[in] | old_name | column old name |
[out] | new_name | column new name |
|
inlinestatic |
void release_uncached_table | ( | TABLE_SHARE * | ts, |
TABLE * | td | ||
) |
free uncached table definition.
[in] | ts | MySQL table share |
[in] | td | MySQL table definition |
innodb_session_t *& thd_to_innodb_session | ( | THD * | thd | ) |
Obtain the private handler of InnoDB session specific data.
[in,out] | thd | MySQL thread handler. |
|
staticconstexpr |
String constant for AUTOEXTEND_SIZE option string.
const char* const dd_column_key_strings[DD_COLUMN__LAST] |
InnoDB private key strings for dd::Column,.
|
constexpr |
const char *const dd_index_key_strings |
InnoDB private key strings for dd::Index or dd::Partition_index.
const char* const dd_partition_key_strings[DD_PARTITION__LAST] |
InnoDB private key strings for dd::Partition.
const uint32_t DD_SPACE_CURRENT_SPACE_VERSION = 1 |
The tablespace version that the tablespace created.
const uint32_t DD_SPACE_CURRENT_SRV_VERSION = MYSQL_VERSION_ID |
Server version that the tablespace created.
const char* const dd_space_key_strings[DD_SPACE__LAST] |
InnoDB private key strings for dd::Tablespace.
const char* const dd_space_state_values[DD_SPACE_STATE__LAST+1] |
InnoDB private value strings for key string "state" in dd::Tablespace.
|
constexpr |
DD functions return false for success and true for failure because that is the way the server functions are defined.
const char* const dd_table_key_strings[DD_TABLE__LAST] |
InnoDB private key strings for dd::Table.
|
constexpr |
Maximum hardcoded data dictionary tables.
|
staticconstexpr |
Handler name for InnoDB.
|
static |
const innodb_dd_table_t innodb_dd_table[] |
The hard-coded data dictionary tables.
|
staticconstexpr |
Number of hard-coded data dictionary tables.
|
staticconstexpr |
InnoDB implicit tablespace name or prefix, which should be same to dict_sys_t::s_file_per_table_name.