MySQL 8.0.39
Source Code Documentation
|
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 "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... | |
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... | |
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_t * | dd_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_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... | |
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) |
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_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 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_t * | dd_find_index< dd::Index > (const dict_table_t *, dd::Index *) |
template const dict_index_t * | dd_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_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) |
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_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. 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_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... | |
template dict_table_t * | dd_open_table< dd::Table > (dd::cache::Dictionary_client *, const TABLE *, const char *, const dd::Table *, THD *) |
template dict_table_t * | dd_open_table< dd::Partition > (dd::cache::Dictionary_client *, const TABLE *, const char *, const dd::Partition *, THD *) |
static const rec_t * | dd_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_t * | dd_getnext_system_rec (btr_pcur_t *pcur, mtr_t *mtr) |
Get next record of new DD system tables. 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... | |
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_components > | dict_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... | |
Data dictionary interface.
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 |
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 |
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 |
|
static |
Check if access to a table should be refused.
[in,out] | table | InnoDB table or partition |
0 | on success (DD_SUVCCESS) |
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.
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 |
|
inline |
Copy attributes from MySQL TABLE_SHARE into an InnoDB table object.
[in,out] | thd | thread context |
[in,out] | table | InnoDB table |
[in] | table_share | TABLE_SHARE |
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 |
template void dd_copy_private< dd::Partition > | ( | dd::Partition & | , |
const dd::Partition & | |||
) |
template void dd_copy_private< dd::Table > | ( | dd::Table & | , |
const dd::Table & | |||
) |
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 |
|
inline |
Instantiate index related metadata.
[in,out] | dd_table | Global DD table metadata |
[in] | m_form | MySQL table definition |
[in,out] | m_table | InnoDB table definition |
[in] | m_thd | THD instance |
|
inlinestatic |
Instantiate in-memory InnoDB table metadata (dict_table_t), without any indexes.
Table | dd::Table or dd::Partition |
[in] | dd_tab | Global Data Dictionary metadata, or NULL for internal temporary table |
[in] | m_form | MySQL TABLE for current table |
[in] | norm_name | normalized table name |
[in] | create_info | create info |
[in] | zip_allowed | whether ROW_FORMAT=COMPRESSED is OK |
[in] | strict | whether to use innodb_strict_mode=ON |
[in] | m_thd | thread THD |
[in] | is_implicit | if it is an implicit tablespace |
|
static |
Read the metadata of default values for all columns added instantly.
[in] | dd_table | dd::Table |
[in,out] | table | InnoDB table object |
|
static |
Create an index.
[in] | dd_index | DD Index |
[in,out] | table | InnoDB table |
[in] | form | MySQL table structure |
[in] | key_num | key_info[] offset |
0 | on success |
HA_ERR_TOO_BIG_ROW | if the record is too long |
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 |
template const dict_index_t * dd_find_index< dd::Index > | ( | const dict_table_t * | , |
dd::Index * | |||
) |
template const dict_index_t * dd_find_index< dd::Partition_index > | ( | const dict_table_t * | , |
dd::Partition_index * | |||
) |
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 |
template void dd_get_and_save_data_dir_path< dd::Partition > | ( | dict_table_t * | , |
const dd::Partition * | , | ||
bool | |||
) |
template void dd_get_and_save_data_dir_path< dd::Table > | ( | dict_table_t * | , |
const dd::Table * | , | ||
bool | |||
) |
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 |
template void dd_get_and_save_space_name< dd::Partition > | ( | dict_table_t * | , |
const dd::Partition * | , | ||
bool | |||
) |
template void dd_get_and_save_space_name< dd::Table > | ( | dict_table_t * | , |
const dd::Table * | , | ||
bool | |||
) |
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.
Table | dd::Table or dd::Partition |
[in,out] | heap | heap for store file name. |
[in] | table | dict table |
[in] | dd_table | dd table obj |
nullptr | if no mysql.tablespace_datafiles entry was found. |
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 |
|
static |
Get dd tablespace id for fts table.
[in] | parent_table | parent table of fts table |
[in] | table | fts table |
[in,out] | dd_space_id | dd table space id |
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 |
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 | ( | ) |
|
static |
Get next record from a new dd system table, like mysql.tables...
[in,out] | pcur | Persistent cursor |
[in] | mtr | Mini-transaction |
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 |
Check if the InnoDB index is consistent with dd::Index.
[in] | index | InnoDB index |
[in] | dd_index | dd::Index or dd::Partition_index |
false | if not match |
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 |
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.
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()
Table | dd::Table or dd::Partition |
[in,out] | dd_table | dd table |
[in,out] | table | A table that refers to the tablespace to open |
[in,out] | heap | A memory heap |
[in] | expected_fsp_flags | expected flags of tablespace to be loaded |
[in] | ignore_err | Whether to ignore an error. |
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 |
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 |
template dict_table_t * dd_open_table< dd::Partition > | ( | dd::cache::Dictionary_client * | , |
const TABLE * | , | ||
const char * | , | ||
const dd::Partition * | , | ||
THD * | |||
) |
template dict_table_t * dd_open_table< dd::Table > | ( | dd::cache::Dictionary_client * | , |
const TABLE * | , | ||
const char * | , | ||
const dd::Table * | , | ||
THD * | |||
) |
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.
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 |
[in,out] | fk_list | stack of table names which need to load |
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.
|
static |
Open single table with name.
[in] | name | table name |
[in] | dict_locked | dict_sys mutex is held or not |
[in,out] | fk_list | foreign key name list |
[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 |
Parse MERGE_THRESHOLD value from a comment string.
[in] | thd | connection |
[in] | str | string which might include 'MERGE_THRESHOLD=' |
dict_index_t::MERGE_THRESHOLD_DEFAULT | for missing or invalid 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 |
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 |
|
static |
Add nullability info to column se_private_data.
[in,out] | dd_col | DD table column |
[in] | col | InnoDB table column |
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.
[in,out] | dd_table | dd table instance |
[in] | table | dict table instance |
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 |
template void dd_set_table_options< dd::Partition > | ( | dd::Partition * | , |
const dict_table_t * | |||
) |
template void dd_set_table_options< dd::Table > | ( | dd::Table * | , |
const dict_table_t * | |||
) |
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. |
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.
Table | dd::Table or dd::Partition |
[in,out] | heap | heap for store file name. |
[in] | table | dict table |
[in] | dd_table | dd table obj |
nullptr | if no mysql.tablespace_datafiles entry was found. |
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 |
|
inline |
Determine if a table contains a fulltext index.
[in] | table | dd::Table |
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. |
const char * dd_table_get_space_name | ( | const Table * | dd_table | ) |
Get tablespace name of dd::Table.
Table | dd::Table or dd::Partition |
[in] | dd_table | dd table object |
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 |
template bool dd_table_match< dd::Partition > | ( | const dict_table_t * | , |
const dd::Partition * | |||
) |
template bool dd_table_match< dd::Table > | ( | const dict_table_t * | , |
const dd::Table * | |||
) |
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 |
|
static |
Load an InnoDB table definition by InnoDB table ID.
[in,out] | thd | current thread |
[in,out] | mdl | metadata lock; nullptr if we are resurrecting table IX locks in recovery |
[in] | table_id | InnoDB table or partition ID |
nullptr | if the table is not found, or there was an error |
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 |
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 |
bool dd_tablespace_is_implicit | ( | const dd::Tablespace * | dd_space, |
bool * | implicit | ||
) |
Determine if a tablespace is implicit.
[in] | dd_space | DD space object |
[out] | implicit | whether the tablespace is implicit tablespace |
false | on success |
true | on failure (corrupt 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. |
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_space_id | ( | dd::Tablespace * | dd_space, |
space_id_t | space_id | ||
) |
Set the space_id attribute in se_private_data of tablespace.
[in,out] | dd_space | dd::Tablespace object |
[in] | space_id | tablespace ID |
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 |
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 |
|
static |
Write metadata of a index to dd::Index.
[in] | dd_space_id | Tablespace id, which server allocates |
[in,out] | dd_index | dd::Index |
[in] | index | InnoDB index object |
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 * | |||
) |
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 |
template void dd_write_table< dd::Partition > | ( | dd::Object_id | , |
dd::Partition * | , | ||
const dict_table_t * | |||
) |
template void dd_write_table< dd::Table > | ( | dd::Object_id | , |
dd::Table * | , | ||
const dict_table_t * | |||
) |
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 |
|
inlinestatic |
|
static |
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 |
|
inlinestatic |
|
static |
Validate the table format options.
[in] | thd | THD instance |
[in] | form | MySQL table definition |
[in] | real_type | real row type if it's not ROW_TYPE_NOT_USED |
[in] | zip_allowed | whether ROW_FORMAT=COMPRESSED is OK |
[in] | strict | whether innodb_strict_mode=ON |
[out] | is_redundant | whether ROW_FORMAT=REDUNDANT |
[out] | blob_prefix | whether ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED |
[out] | zip_ssize | log2(compressed page size), or 0 if not ROW_FORMAT=COMPRESSED |
[out] | is_implicit | if tablespace is implicit |
true | if invalid (my_error will have been called) |
false | if valid |
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 the prefix length of the key.
[in] | key | Key information. |
[in] | key_part | Key part information. |
|
static |
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 |
void release_uncached_table | ( | TABLE_SHARE * | ts, |
TABLE * | td | ||
) |
free uncached table definition.
[in] | ts | MySQL table share |
[in] | td | MySQL table definition |
|
static |
Replace the tablespace name in the file name.
[in] | dd_file | the tablespace file object. |
[in] | new_space_name | new 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. |
|
static |
|
static |
Convert string to lower case.
[in,out] | name | name to convert |
|
inlinestatic |
|
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.
[in] | m_table | InnoDB table handle |
[in] | table | MySQL table definition |
|
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.