MySQL 8.4.3
Source Code Documentation

The version of the current data dictionary table definitions. More...

Namespaces

namespace  anonymous_namespace{dd.cc}
 
namespace  anonymous_namespace{sdi.cc}
 
namespace  anonymous_namespace{tablespace_impl.cc}
 
namespace  bootstrap
 
namespace  cache
 
namespace  info_schema
 
namespace  ndbinfo
 
namespace  performance_schema
 
namespace  sdi
 
namespace  sdi_file
 
namespace  sdi_tablespace
 
namespace  sdi_utils
 
namespace  system_views
 
namespace  tables
 
namespace  upgrade
 

Classes

class  Abstract_table
 Abstract base class for tables and views. More...
 
class  Abstract_table_impl
 
class  Charset
 
class  Charset_impl
 
class  Check_constraint
 
class  Check_constraint_impl
 
class  Check_constraint_name_error_handler
 Error handler to convert ER_DUP_ENTRY error to more user friendly error ER_CHECK_CONSTRAINT_DUP_NAME. More...
 
struct  Check_constraint_order_comparator
 Class used to sort check constraints by name for the same table. More...
 
class  Collation
 
class  Collation_impl
 
class  Collection
 
class  Column
 
class  Column_impl
 
class  Column_statistics
 
class  Column_statistics_impl
 
class  Column_type_element
 
class  Column_type_element_impl
 
class  Composite_4char_key
 
class  Composite_char_key
 
class  Composite_obj_id_3char_key
 
class  Composite_pk
 
class  DD_kill_immunizer
 RAII class for immunizing the THD from kill operations. More...
 
class  Definer_reference_range_key
 
class  Dictionary
 Main interface class enabling users to operate on data dictionary. More...
 
class  Dictionary_impl
 
class  Entity_element
 Class to wrap an entity object. More...
 
class  Entity_object
 Base class for dictionary objects which has single column integer primary key. More...
 
class  Entity_object_impl
 
class  Entity_object_table
 This class represents DD table like mysql.schemata, mysql.tables, mysql.tablespaces and more. More...
 
class  Entity_object_table_impl
 
class  Entity_registry
 Class to represent collections of meta data for entities. More...
 
class  Event
 
class  Event_impl
 
class  Foreign_key
 
class  Foreign_key_element
 
class  Foreign_key_element_impl
 
class  Foreign_key_impl
 
class  Foreign_key_name_error_handler
 
struct  Foreign_key_order_comparator
 Class used to sort Foreign key's by name for the same table. More...
 
class  Foreign_key_parent
 
class  Function
 
class  Function_impl
 
class  Global_name_key
 
class  Index
 
class  Index_element
 
class  Index_element_impl
 
class  Index_impl
 
class  Index_stat
 
class  Index_stat_impl
 
class  Index_stat_range_key
 
class  Item_name_key
 
class  Object_key
 
class  Object_table
 This class represents all data dictionary table like mysql.tables, mysql.columns and more. More...
 
class  Object_table_definition
 The purpose of this interface is to enable retrieving the SQL statements necessary to create and populate a DD table. More...
 
class  Object_table_definition_impl
 
class  Object_table_impl
 
class  Open_dictionary_tables_ctx
 Auxiliary class for opening dictionary tables. More...
 
class  Parameter
 
class  Parameter_impl
 
class  Parameter_type_element
 
class  Parameter_type_element_impl
 
class  Parent_id_range_key
 
class  Partition
 
class  Partition_impl
 
class  Partition_index
 
class  Partition_index_impl
 
struct  Partition_index_order_comparator
 Used to sort Partition_index objects for the same partition in the same order as Index objects for the table. More...
 
struct  Partition_order_comparator
 Used to compare two partition elements. More...
 
class  Partition_value
 
class  Partition_value_impl
 
struct  Partition_value_order_comparator
 Used to sort Partition_value objects for the same partition first according to list number and then according to the column number. More...
 
class  Primary_id_key
 
class  Procedure
 
class  Procedure_impl
 
class  Properties
 The Properties class defines an interface for storing key=value pairs, where both key and value may be UTF-8 strings. More...
 
class  Properties_impl
 The Properties_impl class implements the Properties interface. More...
 
struct  Raw_key
 
class  Raw_new_record
 
class  Raw_record
 
class  Raw_record_set
 
class  Raw_table
 
class  Resource_group
 
class  Resource_group_impl
 
struct  ResultType
 Template for structs to hold results from functions. More...
 
class  Routine
 Abstract base class for functions and procedures. More...
 
class  Routine_impl
 
class  Routine_name_key
 
class  Schema
 
class  Schema_impl
 
class  Schema_MDL_locker
 RAII based class to acquire and release schema meta data locks. More...
 
class  Sdi_rcontext
 Opaque context which keeps reusable resoureces needed during deserialization. More...
 
class  Sdi_wcontext
 Opaque context which keeps reusable resources needed during serialization. More...
 
class  Se_private_id_key
 
class  Spatial_reference_system
 
class  Spatial_reference_system_impl
 
struct  String_type_alloc
 Functor class which allocates memory for String_type. More...
 
class  Sub_partition_range_key
 
class  System_tables
 Class used to represent the dictionary tables. More...
 
class  System_tablespaces
 Class used to represent the system tablespaces. More...
 
class  System_views
 Class used to represent the system views. More...
 
class  Table
 
class  Table_impl
 
class  Table_reference_range_key
 
class  Table_stat
 
class  Table_stat_impl
 
class  Tablespace
 
class  Tablespace_file
 
class  Tablespace_file_impl
 
class  Tablespace_filename_error_handler
 
class  Tablespace_impl
 
struct  Tablespace_table_ref
 Represents tables with their id, name, schema id and schema name. More...
 
class  Transaction_ro
 Implementation of read-only data-dictionary transaction. More...
 
class  Trigger
 Class representing a Trigger in DD framework. More...
 
class  Trigger_impl
 
struct  Trigger_order_comparator
 Used to sort Triggers of the same table by action timing, event type and action order. More...
 
class  Update_dictionary_tables_ctx
 Class for storing/restoring state during dictionary update operations. More...
 
class  View
 
class  View_definer_reference_range_key
 
class  View_impl
 
class  View_routine
 
class  View_routine_impl
 
class  View_table
 
class  View_table_impl
 
class  Void_key
 
class  Weak_object
 Base class for all data dictionary objects. More...
 
class  Weak_object_impl_
 

Typedefs

using Encrypt_result = ResultType< bool >
 
typedef String_type Sdi_type
 
using SdiCompatibilityChecker = std::function< bool(const RJ_Document &)>
 Type alias for std::function wrapping a callable to check if SDI, as an RJ_Document, is compatible. More...
 
using Weak_object_impl = Weak_object_impl_< true >
 
typedef unsigned long long Object_id
 
typedef rapidjson::UTF8< char > RJ_Encoding
 
typedef rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > RJ_Allocator
 
typedef rapidjson::GenericDocument< RJ_Encoding, RJ_Allocator, rapidjson::CrtAllocator > RJ_Document
 
typedef rapidjson::GenericValue< RJ_Encoding, RJ_AllocatorRJ_Value
 
typedef rapidjson::GenericStringBuffer< RJ_Encoding, rapidjson::CrtAllocator > RJ_StringBuffer
 
typedef rapidjson::PrettyWriter< RJ_StringBuffer, RJ_Encoding, RJ_Encoding, RJ_Allocator, 0 > RJ_PrettyWriter
 
using RJ_Writer = rapidjson::Writer< RJ_StringBuffer, RJ_Encoding, RJ_Encoding, RJ_Allocator, 0 >
 
using Sdi_writer = RJ_Writer
 Alias for the rapidjson Writer type to use in serialization. More...
 
typedef Stateless_allocator< char, String_type_allocString_type_allocator
 
template<class A >
using Char_string_template = std::basic_string< char, std::char_traits< char >, A >
 Template alias for char-based std::basic_string. More...
 
typedef Char_string_template< String_type_allocatorString_type
 
template<class A >
using Char_stringstream_template = std::basic_stringstream< char, std::char_traits< char >, A >
 Template alias for char-based std::basic_stringstream. More...
 
typedef Char_stringstream_template< String_type_allocatorStringstream_type
 Instantiation of std::basic_stringstream with the same allocator as String_type. More...
 
typedef std::vector< Tablespace_table_refTablespace_table_ref_vec
 

Enumerations

enum class  enum_dd_init_type {
  DD_INITIALIZE = 1 , DD_INITIALIZE_SYSTEM_VIEWS , DD_RESTART_OR_UPGRADE , DD_UPDATE_I_S_METADATA ,
  DD_INITIALIZE_NON_DD_BASED_SYSTEM_VIEWS
}
 
enum class  enum_table_type { INVALID_TABLE , BASE_TABLE , USER_VIEW , SYSTEM_VIEW }
 
enum class  enum_column_types {
  DECIMAL = 1 , TINY , SHORT , LONG ,
  FLOAT , DOUBLE , TYPE_NULL , TIMESTAMP ,
  LONGLONG , INT24 , DATE , TIME ,
  DATETIME , YEAR , NEWDATE , VARCHAR ,
  BIT , TIMESTAMP2 , DATETIME2 , TIME2 ,
  NEWDECIMAL , ENUM , SET , TINY_BLOB ,
  MEDIUM_BLOB , LONG_BLOB , BLOB , VAR_STRING ,
  STRING , GEOMETRY , JSON
}
 
enum class  enum_encryption_type { ET_NO = 1 , ET_YES }
 

Functions

template<typename T >
static bool item_compare (const T *a, const T *b)
 
bool init (enum_dd_init_type dd_init)
 Initialize data dictionary upon server startup, server startup on old data directory or install data dictionary for the first time. More...
 
bool shutdown ()
 Shuts down the data dictionary instance by deleting the instance of dd::Dictionary_impl* upon server shutdown. More...
 
class Dictionaryget_dictionary ()
 Get the data dictionary instance. More...
 
template<typename X >
Xcreate_object ()
 Create a instance of data dictionary object of type X. More...
 
int get_old_status (Event::enum_event_status event_status)
 Convert new DD Event::enum_event_status to status type used in server code. More...
 
static Event::enum_event_status get_enum_event_status (int event_status)
 Convert legacy event status to dd::Event::enum_event_status. More...
 
int get_old_on_completion (Event::enum_on_completion on_completion)
 Convert new DD Event::enum_on_completion to completion type used in server code. More...
 
static Event::enum_on_completion get_on_completion (int on_completion)
 Convert legacy event on completion behavior to dd::Event::enum_on_compeltion. More...
 
interval_type get_old_interval_type (Event::enum_interval_field interval_field)
 Convert new DD interval_field type to type interval_type used in server code. More...
 
static Event::enum_interval_field get_enum_interval_field (interval_type interval_type_val)
 Convert legacy interval type value to dd::Event::enum_interval_field. More...
 
static void set_event_attributes (THD *thd, const dd::Schema &schema, Event *event, const String_type &event_name, const String_type &event_body, const String_type &event_body_utf8, const LEX_USER *definer, Event_parse_data *event_data, bool is_update)
 Set Event attributes. More...
 
bool create_event (THD *thd, const Schema &schema, const String_type &event_name, const String_type &event_body, const String_type &event_body_utf8, const LEX_USER *definer, Event_parse_data *event_data)
 Create an event object and commit it to DD Table Events. More...
 
bool update_event (THD *thd, Event *event, const dd::Schema &schema, const dd::Schema *new_schema, const String_type &new_event_name, const String_type &new_event_body, const String_type &new_event_body_utf8, const LEX_USER *definer, Event_parse_data *event_data)
 Create or update a event object and commit it to DD Table Events. More...
 
bool update_event_time_and_status (THD *thd, Event *event, my_time_t last_executed, ulonglong status)
 Update time related fields of Event object. More...
 
bool resource_group_exists (dd::cache::Dictionary_client *dd_client, const String_type &resource_group_name, bool *exists)
 Check if resource group exists in the data dictionary. More...
 
static bool set_resource_group_attributes (dd::Resource_group *resource_group, const resourcegroups::Resource_group &res_grp_ref)
 
bool create_resource_group (THD *thd, const resourcegroups::Resource_group &res_grp_ref)
 Create a DD object and persist it to DD table resourcegroup. More...
 
bool update_resource_group (THD *thd, const String_type &resource_grp_name, const resourcegroups::Resource_group &res_grp_ref)
 Update a resource group and persist it to DD table resourcegroup. More...
 
bool drop_resource_group (THD *thd, const String_type resource_grp_name)
 Drop a resource group from DD table resourcegroup. More...
 
static void fill_dd_function_return_type (THD *thd, sp_head *sp, Function *sf)
 Helper method for create_routine() to fill return type information of stored routine from the sp_head. More...
 
static void fill_parameter_info_from_field (THD *thd, Create_field *field, dd::Parameter *param)
 Helper method for create_routine() to fill parameter information from the object of type Create_field. More...
 
static bool fill_routine_parameters_info (THD *thd, sp_head *sp, Routine *routine)
 Helper method for create_routine() to fill parameters of routine to dd::Routine object from the sp_head. More...
 
static bool fill_dd_routine_info (THD *thd, const dd::Schema &schema, sp_head *sp, Routine *routine, const LEX_USER *definer)
 Helper method for create_routine() to prepare dd::Routine object from the sp_head. More...
 
bool create_routine (THD *thd, const Schema &schema, sp_head *sp, const LEX_USER *definer)
 Prepares dd:Routine object from sp_head and updates DD tables accordingly. More...
 
bool alter_routine (THD *thd, Routine *routine, st_sp_chistics *chistics)
 Alters routine characteristics in the DD table. More...
 
bool schema_exists (THD *thd, const char *schema_name, bool *exists)
 Check if given schema exists. More...
 
bool create_schema (THD *thd, const char *schema_name, const CHARSET_INFO *charset_info, const bool default_encryption)
 Create a schema record into dd.schemata. More...
 
bool mdl_lock_schema (THD *thd, const char *schema_name, enum_mdl_duration duration, MDL_ticket **ticket=nullptr)
 Acquire MDL on schema name. More...
 
dd::enum_column_types get_new_field_type (enum_field_types type)
 Convert to and from new enum types in DD framework to current MySQL server enum types. More...
 
dd::String_type get_sql_type_by_create_field (TABLE *table, const Create_field &field)
 Function returns string representing column type by Create_field. More...
 
static void prepare_default_value_string (uchar *buf, TABLE *table, const Create_field &field, dd::Column *col_obj, String *def_value)
 Helper method to get default value of column in the string format. More...
 
bool get_field_numeric_scale (const Create_field *field, uint *scale)
 Helper method to get numeric scale for types using Create_field type object. More...
 
bool get_field_numeric_precision (const Create_field *field, uint *numeric_precision)
 Helper method to get numeric precision for types using Create_field type object. More...
 
bool get_field_datetime_precision (const Create_field *field, uint *datetime_precision)
 Helper method to get datetime precision for types using Create_field type object. More...
 
static dd::String_type now_with_opt_decimals (uint decimals)
 
bool fill_dd_columns_from_create_fields (THD *thd, dd::Abstract_table *tab_obj, const List< Create_field > &create_fields, handler *file)
 Add column objects to dd::Abstract_table according to list of Create_field objects. More...
 
static dd::Index::enum_index_algorithm dd_get_new_index_algorithm_type (enum ha_key_alg type)
 
static dd::Index::enum_index_type dd_get_new_index_type (const KEY *key)
 
static void fill_dd_index_elements_from_key_parts (const dd::Table *tab_obj, dd::Index *idx_obj, uint key_part_count, const KEY_PART_INFO *key_parts, handler *file, bool is_primary_key)
 Add dd::Index_element objects to dd::Index/Table according to KEY_PART_INFO array for the index. More...
 
static bool is_candidate_primary_key (THD *thd, const KEY *key, const List< Create_field > &create_fields)
 
static void fill_dd_indexes_from_keyinfo (THD *thd, dd::Table *tab_obj, uint key_count, const KEY *keyinfo, const List< Create_field > &create_fields, handler *file)
 Add index objects to dd::Table according to array of KEY structures. More...
 
static dd::Foreign_key::enum_rule get_fk_rule (fk_option opt)
 Translate from the old fk_option enum to the new dd::Foreign_key::enum_rule enum. More...
 
static bool fill_dd_foreign_keys_from_create_fields (dd::Table *tab_obj, uint key_count, const FOREIGN_KEY *keyinfo)
 Add foreign keys to dd::Table according to Foreign_key_spec structs. More...
 
template<typename T >
static bool fill_dd_tablespace_id_or_name (THD *thd, T *obj, handlerton *hton, const char *tablespace_name, bool is_temporary_table)
 Set dd::Tablespace object id for dd::Table and dd::Partition object during CREATE TABLE. More...
 
static bool get_field_list_str (dd::String_type &str, List< char > *name_list)
 Get a string of fields to be stores as partition_expression. More...
 
static void set_partition_options (partition_element *part_elem, dd::Properties *part_options)
 Helper function to set partition options. More...
 
static bool add_part_col_vals (partition_info *part_info, part_elem_value *list_value, uint list_index, dd::Partition *part_obj, const HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, String *part_desc_str)
 
static void collect_partition_expr (const THD *thd, List< char > &field_list, String *str)
 
static bool fill_dd_partition_from_create_info (THD *thd, dd::Table *tab_obj, const HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, partition_info *part_info)
 Fill in partitioning meta data form create_info to the table object. More...
 
bool fill_dd_check_constraints (THD *thd, dd::Table *tab_obj, const Sql_check_constraint_spec_list *check_cons_spec)
 Fill in check constraints metadata to the Table object from the list of check constraint specifications. More...
 
static Table::enum_row_format dd_get_new_row_format (row_type old_format)
 Convert old row type value to corresponding value in new row format enum used by DD framework. More...
 
static bool engine_supports_provided_srs_id (THD *thd, const dd::Table &table, const handler *handler)
 Check if the storage engine supports geographic geometry columns. More...
 
bool invalid_tablespace_usage (THD *thd, const dd::String_type &schema_name, const dd::String_type &table_name, const HA_CREATE_INFO *create_info)
 Checking if the table is being created in a restricted tablespace. More...
 
static bool fill_dd_table_from_create_info (THD *thd, dd::Table *tab_obj, const dd::String_type &table_name, const dd::String_type &schema_name, const HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, const KEY *keyinfo, uint keys, Alter_info::enum_enable_or_disable keys_onoff, const FOREIGN_KEY *fk_keyinfo, uint fk_keys, const Sql_check_constraint_spec_list *check_cons_spec, handler *file)
 Fill dd::Table object from mysql_prepare_create_table() output. More...
 
static bool get_se_private_data (THD *thd, dd::Table *tab_obj)
 Get the SE private data from the dd_properties table. More...
 
static std::unique_ptr< dd::Tablecreate_dd_system_table (THD *thd, const dd::Schema &system_schema, const dd::String_type &table_name, HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, const KEY *keyinfo, uint keys, const FOREIGN_KEY *fk_keyinfo, uint fk_keys, const Sql_check_constraint_spec_list *check_cons_spec, handler *file, const dd::Object_table &dd_table)
 
bool is_server_ps_table_name (const dd::String_type &schema_name, const dd::String_type &table_name)
 
std::unique_ptr< dd::Tablecreate_dd_user_table (THD *thd, const dd::Schema &sch_obj, const dd::String_type &table_name, HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, const KEY *keyinfo, uint keys, Alter_info::enum_enable_or_disable keys_onoff, const FOREIGN_KEY *fk_keyinfo, uint fk_keys, const Sql_check_constraint_spec_list *check_cons_spec, handler *file)
 Prepares a dd::Table object from mysql_prepare_create_table() output and return it to the caller. More...
 
std::unique_ptr< dd::Tablecreate_table (THD *thd, const dd::Schema &sch_obj, const dd::String_type &table_name, HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, const KEY *keyinfo, uint keys, Alter_info::enum_enable_or_disable keys_onoff, const FOREIGN_KEY *fk_keyinfo, uint fk_keys, const Sql_check_constraint_spec_list *check_cons_spec, handler *file)
 Prepares a dd::Table object from mysql_prepare_create_table() output and return it to the caller. More...
 
std::unique_ptr< dd::Tablecreate_tmp_table (THD *thd, const dd::Schema &sch_obj, const dd::String_type &table_name, HA_CREATE_INFO *create_info, const List< Create_field > &create_fields, const KEY *keyinfo, uint keys, Alter_info::enum_enable_or_disable keys_onoff, const Sql_check_constraint_spec_list *check_cons_spec, handler *file)
 Prepares a dd::Table object for a temporary table from mysql_prepare_create_table() output. More...
 
bool drop_table (THD *thd, const char *schema_name, const char *name, const dd::Table &table_def)
 
bool table_exists (dd::cache::Dictionary_client *client, const char *schema_name, const char *name, bool *exists)
 Check if a table or view exists. More...
 
bool is_generated_foreign_key_name (const char *table_name, size_t table_name_length, handlerton *hton, const dd::Foreign_key &fk)
 Check if foreign key name is generated one. More...
 
static bool is_foreign_key_name_locked (THD *thd, const char *db, const char *fk_name)
 
bool rename_foreign_keys (THD *thd, const char *old_db, const char *old_table_name, handlerton *hton, const char *new_db, dd::Table *new_tab)
 Rename foreign keys which have generated names to match the new name of the table. More...
 
bool table_legacy_db_type (THD *thd, const char *schema_name, const char *table_name, enum legacy_db_type *db_type)
 Get the legacy db type from the options of the given table. More...
 
template<typename T >
bool table_storage_engine (THD *thd, const T *obj, handlerton **hton)
 Get the storage engine handlerton for the given table or tablespace. More...
 
template bool table_storage_engine< dd::Table > (THD *, const dd::Table *, handlerton **)
 
template bool table_storage_engine< dd::Tablespace > (THD *, const dd::Tablespace *, handlerton **)
 
bool recreate_table (THD *thd, const char *schema_name, const char *table_name)
 Regenerate a metadata locked table. More...
 
dd::String_type get_sql_type_by_field_info (THD *thd, enum_field_types field_type, uint32 field_length, uint32 decimals, bool maybe_null, bool is_unsigned, const CHARSET_INFO *field_charset)
 Function returns string representing column type by ST_FIELD_INFO. More...
 
bool fix_row_type (THD *thd, dd::Table *table, row_type correct_row_type)
 Update row format for the table with the value value supplied by caller function. More...
 
void report_error_as_tablespace_missing (Object_id id)
 
void report_error_as_tablespace_missing (const String_type name)
 
template<typename KEY >
bool is_general_tablespace_and_encrypted (const KEY k, THD *thd, bool *is_encrypted_tablespace, bool *is_general_tablespace)
 
Encrypt_result is_tablespace_encrypted (THD *thd, const Table &t, bool *is_general_tablespace)
 Predicate to determine if a table resides in an encrypted tablespace. More...
 
bool has_primary_key (const Table &t)
 Predicate which indicates if the table has real (non-hidden) primary key. More...
 
bool is_generated_check_constraint_name (const char *table_name, size_t table_name_length, const char *cc_name, size_t cc_name_length)
 Check if name of check constraint is generated one. More...
 
bool rename_check_constraints (const char *old_table_name, dd::Table *new_tab)
 Rename generated check constraint names to match the new name of the table. More...
 
template<typename IT >
static void copy_tablespace_names (const HA_CREATE_INFO *ci, partition_info *pi, IT it)
 
Encrypt_result is_tablespace_encrypted (THD *thd, const HA_CREATE_INFO *ci, bool *is_general_tablespace)
 Predicate to determine if a table resides in an encrypted tablespace and if it a general tablespace. More...
 
bool uses_general_tablespace (const Table &t)
 Check if table uses general tablespace. More...
 
bool prefix_key_partition_exists (const char *schema_name, const char *orig_table_name, const Table *table, const bool is_upgrade)
 Check and give error if table uses prefix keys in the partitioning function. More...
 
bool get_implicit_tablespace_options (THD *thd, const Table *table, ulonglong *autoextend_size)
 Get the autoextend_size option value for implicit tablespaces. More...
 
bool check_non_standard_key_exists_in_fk (THD *thd, const Table *table)
 Validate if table uses foreign keys referring to proper index. More...
 
bool is_encrypted (const String_type &type)
 
bool is_encrypted (const LEX_STRING &type)
 
bool fill_table_and_parts_tablespace_names (THD *thd, const char *db_name, const char *table_name, Tablespace_hash_set *tablespace_set)
 Fill Tablespace_hash_set with tablespace names used by the given db_name.table_name. More...
 
template<typename T >
bool get_tablespace_name (THD *thd, const T *obj, String_type *name)
 Read tablespace name of a tablespace_id from Table or similar object. More...
 
template<typename T >
bool get_tablespace_name (THD *thd, const T *obj, const char **tablespace_name, MEM_ROOT *mem_root)
 Read tablespace name of a tablespace_id. More...
 
static Trigger::enum_event_type get_dd_event_type (const ::Trigger *new_trigger)
 Get DD API value of event type for a trigger. More...
 
static Trigger::enum_action_timing get_dd_action_timing (const ::Trigger *new_trigger)
 Get DD API value of action timing for a trigger. More...
 
static bool fill_in_dd_trigger_object (const ::Trigger *new_trigger, Trigger *dd_trig_obj)
 Fill in a dd::Trigger object based on a Trigger object supplied by sql-layer. More...
 
bool create_trigger (THD *thd, const ::Trigger *new_trigger, enum_trigger_order_type ordering_clause, const LEX_CSTRING &referenced_trigger_name)
 Create new trigger in the data dictionary. More...
 
static enum_trigger_event_type convert_event_type_from_dd (dd::Trigger::enum_event_type event_type)
 Convert event type value from DD presentation to generic SQL presentation. More...
 
static enum_trigger_action_time_type convert_action_time_from_dd (dd::Trigger::enum_action_timing action_timing)
 Convert action timing value from DD presentation to generic SQL presentation. More...
 
bool load_triggers (THD *thd, MEM_ROOT *mem_root, const char *schema_name, const char *table_name, const dd::Table &table, List<::Trigger > *triggers)
 Load table triggers from the data dictionary. More...
 
bool table_has_triggers (THD *thd, const char *schema_name, const char *table_name, bool *table_has_trigger)
 Check in the data dictionary if there is any trigger associated with a table. More...
 
size_t normalize_string (const CHARSET_INFO *cs, const String_type &src, char *normalized_str_buf, size_t normalized_str_buf_length)
 Normalize (or transform) the multibyte character set string. More...
 
bool check_if_server_ddse_readonly (THD *thd, const char *schema_name=nullptr)
 Check if DDSE (Data Dictionary Storage Engine) is in readonly mode. More...
 
static ulonglong dd_get_old_view_check_type (dd::View::enum_check_option type)
 
static dd::View::enum_check_option dd_get_new_view_check_type (ulonglong type)
 For enum in dd::View. More...
 
static enum enum_view_algorithm dd_get_old_view_algorithm_type (dd::View::enum_algorithm type)
 
static dd::View::enum_algorithm dd_get_new_view_algorithm_type (enum enum_view_algorithm type)
 
static ulonglong dd_get_old_view_security_type (dd::View::enum_security_type type)
 
static dd::View::enum_security_type dd_get_new_view_security_type (ulonglong type)
 
static bool fill_dd_view_columns (THD *thd, View *view_obj, const Table_ref *view)
 Method to fill view columns from the first Query_block of view query. More...
 
static void fill_dd_view_tables (View *view_obj, const Table_ref *view, const Table_ref *query_tables)
 Method to fill base table and view names used by view query in DD View object. More...
 
static void fill_dd_view_routines (View *view_obj, Query_tables_list *routines_ctx)
 Method to fill view routines from the set of routines used by view query. More...
 
static bool fill_dd_view_definition (THD *thd, View *view_obj, Table_ref *view)
 Method to fill view information in the View object. More...
 
bool update_view (THD *thd, dd::View *new_view, Table_ref *view)
 Update view metadata in dd.views. More...
 
bool create_view (THD *thd, const dd::Schema &schema, Table_ref *view)
 Store view metadata in the data-dictionary. More...
 
bool read_view (Table_ref *view, const dd::View &view_ref, MEM_ROOT *mem_root)
 Read view metadata from dd.views into Table_ref. More...
 
bool update_view_status (THD *thd, const char *schema_name, const char *view_name, bool status, bool commit_dd_changes)
 Update view status(valid/invalid) value in dd.views.options. More...
 
bool acquire_shared_table_mdl (THD *thd, const char *schema_name, const char *table_name, bool no_wait, MDL_ticket **out_mdl_ticket)
 Acquire shared metadata lock on the given table name with explicit duration. More...
 
bool has_shared_table_mdl (THD *thd, const char *schema_name, const char *table_name)
 Predicate to check if we have a shared meta data lock on the submitted schema qualified table name. More...
 
bool has_exclusive_table_mdl (THD *thd, const char *schema_name, const char *table_name)
 Predicate to check if we have an exclusive meta data lock on the submitted schema qualified table name. More...
 
bool acquire_exclusive_tablespace_mdl (THD *thd, const char *tablespace_name, bool no_wait, MDL_ticket **ticket=nullptr, bool for_trx=true)
 Acquire an exclusive metadata lock on the given tablespace name with transaction duration. More...
 
bool acquire_shared_tablespace_mdl (THD *thd, const char *tablespace_name, bool no_wait, MDL_ticket **ticket=nullptr, bool for_trx=true)
 Acquire a shared metadata lock on the given tablespace name with transaction duration. More...
 
bool has_shared_tablespace_mdl (THD *thd, const char *tablespace_name)
 Predicate to check if we have a shared meta data lock on the submitted tablespace name. More...
 
bool has_exclusive_tablespace_mdl (THD *thd, const char *tablespace_name)
 Predicate to check if we have an exclusive meta data lock on the submitted tablespace name. More...
 
bool acquire_exclusive_table_mdl (THD *thd, const char *schema_name, const char *table_name, bool no_wait, MDL_ticket **out_mdl_ticket)
 Acquire exclusive metadata lock on the given table name with TRANSACTIONAL duration. More...
 
bool acquire_exclusive_table_mdl (THD *thd, const char *schema_name, const char *table_name, unsigned long int lock_wait_timeout, MDL_ticket **out_mdl_ticket)
 Acquire exclusive metadata lock on the given table name with TRANSACTIONAL duration. More...
 
bool acquire_exclusive_schema_mdl (THD *thd, const char *schema_name, bool no_wait, MDL_ticket **out_mdl_ticket)
 Acquire exclusive metadata lock on the given schema name with explicit duration. More...
 
void release_mdl (THD *thd, MDL_ticket *mdl_ticket)
 Release MDL_EXPLICIT lock held by a ticket. More...
 
cache::Dictionary_clientget_dd_client (THD *thd)
 Get Dictionary_client from THD object (the latter is opaque * in SEs). More...
 
bool create_native_table (THD *thd, const Plugin_table *pt)
 Create plugin native table. More...
 
bool drop_native_table (THD *thd, const char *schema_name, const char *table_name)
 Remove plugin native table from DD. More...
 
bool reset_tables_and_tablespaces ()
 Reset the tables and tablespace partitions in the DD cache, and invalidate the entries in the DDSE cache. More...
 
bool commit_or_rollback_tablespace_change (THD *thd, dd::Tablespace *space, bool error, bool release_mdl_on_commit_only=false)
 Update a tablespace change, commit and release transactional MDL. More...
 
template<typename Entity_object_type >
const Object_tableget_dd_table ()
 Get the Object_table instance storing the given entity object type. More...
 
void rename_tablespace_mdl_hook (THD *thd, MDL_ticket *src, MDL_ticket *dst)
 Implicit tablespaces are renamed inside SE. More...
 
bool alter_tablespace_encryption (THD *thd, const char *tablespace_name, bool encryption)
 Execute an ALTER TABLESPACE ... ENCRYPTION statement. More...
 
void store_predefined_tablespace_metadata (THD *thd)
 This function creates the meta data of the predefined tablespaces. More...
 
bool create_dd_schema (THD *thd)
 Executes SQL queries to create and use the dictionary schema. More...
 
bool getprop (THD *thd, const char *key, uint *value, bool silent=false, loglevel level=ERROR_LEVEL)
 
bool getprop (THD *thd, const char *key, String_type *value, bool silent=false, loglevel level=ERROR_LEVEL)
 
bool setprop (THD *thd, const char *key, const uint value, bool silent=false)
 
bool setprop (THD *thd, const char *key, const String_type &value, bool silent=false)
 
bool initialize_dd_properties (THD *thd)
 During –initialize, we create the dd_properties table. More...
 
bool is_non_inert_dd_or_ddse_table (System_tables::Types table_type)
 Predicate to check if a table type is a non-inert DD or a DDSE table. More...
 
bool create_tables (THD *thd, const std::set< String_type > *create_set)
 Execute SQL statements to create the DD tables. More...
 
bool sync_meta_data (THD *thd)
 Acquire the DD schema, tablespace and table objects. More...
 
bool update_properties (THD *thd, const std::set< String_type > *create_set, const std::set< String_type > *remove_set, const String_type &target_table_schema_name)
 Update properties in the DD_properties table. More...
 
bool update_versions (THD *thd)
 Updates the DD Version in the DD_properties table to the current version. More...
 
template Charset_implcreate_object< Charset_impl > ()
 
template Collationcreate_object< Collation > ()
 
template Collation_implcreate_object< Collation_impl > ()
 
template Columncreate_object< Column > ()
 
template Column_statisticscreate_object< Column_statistics > ()
 
template Column_type_elementcreate_object< Column_type_element > ()
 
template Eventcreate_object< Event > ()
 
template Functioncreate_object< Function > ()
 
template Foreign_keycreate_object< Foreign_key > ()
 
template Foreign_key_elementcreate_object< Foreign_key_element > ()
 
template Indexcreate_object< Index > ()
 
template Index_elementcreate_object< Index_element > ()
 
template Index_statcreate_object< Index_stat > ()
 
template Partitioncreate_object< Partition > ()
 
template Partition_indexcreate_object< Partition_index > ()
 
template Partition_valuecreate_object< Partition_value > ()
 
template Procedurecreate_object< Procedure > ()
 
template Resource_groupcreate_object< Resource_group > ()
 
template Schemacreate_object< Schema > ()
 
template Spatial_reference_systemcreate_object< Spatial_reference_system > ()
 
template Tablecreate_object< Table > ()
 
template Table_statcreate_object< Table_stat > ()
 
template Tablespacecreate_object< Tablespace > ()
 
template Tablespace_filecreate_object< Tablespace_file > ()
 
template Viewcreate_object< View > ()
 
static bool acquire_shared_mdl (THD *thd, MDL_key::enum_mdl_namespace lock_namespace, const char *schema_name, const char *table_name, bool no_wait, ulong lock_wait_timeout, enum_mdl_duration lock_duration, MDL_ticket **out_mdl_ticket)
 
static bool acquire_exclusive_mdl (THD *thd, MDL_key::enum_mdl_namespace lock_namespace, const char *schema_name, const char *table_name, bool no_wait, ulong lock_wait_timeout, enum_mdl_duration lock_duration, MDL_ticket **out_mdl_ticket)
 
template const Object_tableget_dd_table< dd::Column > ()
 
template const Object_tableget_dd_table< dd::Index > ()
 
template const Object_tableget_dd_table< dd::Partition > ()
 
template const Object_tableget_dd_table< dd::Table > ()
 
template const Object_tableget_dd_table< dd::Tablespace > ()
 
char * buf_handle (Sdi_wcontext *wctx, size_t sz)
 Return a non-owning pointer to a char buffer which can be used for e.g. More...
 
const String_typelookup_schema_name (Sdi_wcontext *wctx)
 Returns const reference to string holding schema name to use in SDI. More...
 
template<typename T >
String_type generic_serialize (THD *thd, const char *dd_object_type, size_t dd_object_type_size, const T &dd_obj, const String_type *schema_name)
 
const String_typelookup_tablespace_name (Sdi_wcontext *wctx, dd::Object_id id)
 Look up the tablespace name for a tablespace id. More...
 
template<typename T >
void generic_track_object (dd_vector< T * > *tvp, T *t)
 
void track_object (Sdi_rcontext *rctx, Column *column_object)
 Register Column objects being deserialized so that it will be possible to resolve references to it after deserialization has finished. More...
 
void track_object (Sdi_rcontext *rctx, Index *index_object)
 Register Index objects being deserialized so that it will be possible to resolve references to it after deserialization has finished. More...
 
Indexget_by_opx (Sdi_rcontext *rctx, const Index *, uint opx)
 Return an non-owning raw pointer to the deserialized Index object with ordinal position index opx (ordinal position opx+1). More...
 
Columnget_by_opx (Sdi_rcontext *rctx, const Column *, uint opx)
 Return an non-owning raw pointer to the deserialized Column object with ordinal position index opx (ordinal position opx+1). More...
 
char * buf_handle (Sdi_rcontext *rctx, size_t sz)
 Return a non-owning pointer to a char buffer which can be used for e.g. More...
 
template<typename T >
bool generic_lookup_ref (THD *thd, MDL_key::enum_mdl_namespace mdlns, const String_type &name, dd::Object_id *idp)
 
bool lookup_schema_ref (Sdi_rcontext *rctx, const String_type &name, Object_id *idp)
 Return the the Object_id of a schema name in the current data dictionary. More...
 
bool lookup_tablespace_ref (Sdi_rcontext *rctx, const String_type &name, Object_id *idp)
 Return the the Object_id of a tablespace name in the current data dictionary. More...
 
Sdi_type serialize (const Schema &schema)
 Serialize a Schema object. More...
 
bool deserialize (THD *thd, const Sdi_type &sdi, Table *table, String_type *deser_schema_name=nullptr)
 Deserialize a dd::Table object. More...
 
bool deserialize (THD *thd, const Sdi_type &sdi, Tablespace *tablespace)
 Deserialize a dd::Tablespace object. More...
 
Propertiesparse_properties (const String_type &str)
 Factory function for creating a Property object from String_type. More...
 
static bool is_valid_cpu_mask_str (const String_type &str)
 Check if the string contain characters of 0 and 1. More...
 
bool operator== (const Tablespace_table_ref &a, const Tablespace_table_ref &b)
 
bool operator< (const Tablespace_table_ref &a, const Tablespace_table_ref &b)
 
bool fetch_tablespace_table_refs (THD *thd, const Tablespace &tso, Tablespace_table_ref_vec *tblrefs)
 Fetch (by inserting into tblref vector) Tablespace_table_ref objects which describe tables in a given tablespace. More...
 
MDL_requestmdl_req (THD *thd, const Tablespace_table_ref &tref, enum enum_mdl_type mdl_type)
 Create am MDL_request for a the table identified by a Tablespace_table_ref. More...
 
MDL_requestmdl_schema_req (THD *thd, const dd::String_type &schema_name)
 Create am MDL_request for a the schema name provided. More...
 
bool execute_query (THD *thd, const dd::String_type &q_buf)
 Create a lex string for the query from the string supplied and execute the query. More...
 
void escape (String_type *dst, const String_type &src)
 Escaping of a String_type. More...
 
bool unescape (String_type &dest)
 In place unescaping of String_type. More...
 
bool eat_to (String_type::const_iterator &it, String_type::const_iterator end, char c)
 Start at it, iterate until we hit an unescaped c or the end of the string. More...
 
bool eat_str (String_type &dest, String_type::const_iterator &it, String_type::const_iterator end, char c)
 Start at it, find first unescaped occorrence of c, create destination string and copy substring to destination. More...
 
bool eat_pairs (String_type::const_iterator &it, String_type::const_iterator end, dd::Properties *props)
 Start at it, find a key and value separated by an unescaped '='. More...
 
ulonglong my_time_t_to_ull_datetime (my_time_t seconds_since_epoch)
 Convert seconds since epoch, to a datetime ulonglong using my_tz_OFFSET0 suitable for timestamp fields in the DD. More...
 
bool is_string_in_lowercase (const String_type &str, const CHARSET_INFO *cs)
 Method to verify if string is in lowercase. More...
 
bool end_transaction (THD *thd, bool error)
 Helper function to do rollback or commit, depending on error. More...
 
template<typename LEX_STRING_TYPE >
String_type make_string_type (const LEX_STRING_TYPE &lst)
 
template<class VISITOR_TYPE >
bool visit_tablespace_id_owners (const Partition &p, VISITOR_TYPE &&visitor)
 Visitor function which invokes its visitor argument on any subobject which holds a tablespace, that is, the partition itself, its Partition_indexes, its sub-partitions, and Partition_indexes of those. More...
 
template<class VISITOR_TYPE >
bool visit_tablespace_id_owners (const Table &t, VISITOR_TYPE &&visitor)
 Visitor function which invokes its visitor argument on any subobject which holds a tablespace, that is, the table itself, its m_indexes, its m_partitions, and m_indexes (Partition_index) of each partition and sub-partition. More...
 
bool is_checked_for_upgrade (const Table &t)
 
Sdi_type serialize (THD *thd, const Table &table, const String_type &schema_name)
 Serialize a Table object. More...
 
Sdi_type serialize (const Tablespace &tablespace)
 Serialize a Tablespace object. More...
 
bool CheckDefaultCompatibility (const RJ_Document &doc)
 Default checker which implements the traditional (strict) compatibility check: MYSQL_VERSION less than or equal, dd_version equal, and sdi_version equal. More...
 
template<class Dd_type >
bool generic_deserialize (THD *thd, const Sdi_type &sdi, const String_type &object_type_name, Dd_type *dst, const SdiCompatibilityChecker &comp_checker, String_type *schema_name_from_sdi)
 
bool deserialize (THD *thd, const Sdi_type &sdi, Table *dst_table, SdiCompatibilityChecker comp_checker, String_type *deser_schema_name)
 Deserialize a dd::Table object. More...
 
bool deserialize (THD *thd, const Sdi_type &sdi, Tablespace *dst_tablespace, SdiCompatibilityChecker comp_checker)
 Deserialize a dd::Tablespace object. More...
 

Variables

static const char * failsafe_object = "Event status option"
 
static const char FIELD_NAME_SEPARATOR_CHAR = ';'
 
static const char CHECK_CONSTRAINT_NAME_SUBSTR [] = "_chk_"
 
static const uint DD_VERSION = 80300
 
static const uint DD_VERSION_MINOR_DOWNGRADE_THRESHOLD = DD_VERSION
 If a new DD version is published in a MRU, that version may or may not be possible to downgrade to previous MRUs within the same GA. More...
 
constexpr uint SERVER_DOWNGRADE_THRESHOLD = 0
 A new release model supporting Long Term Stability (LTS) and innovation releases is being introduced. More...
 
constexpr uint SERVER_UPGRADE_THRESHOLD = 0
 The new release model explained above will also open the possibility of upgrading to a version that has been released in the past. More...
 
constexpr const std::uint64_t SDI_VERSION = 80019
 The version of the current SDI Json format. More...
 
static const std::set< String_typedefault_valid_option_keys
 
static const std::set< String_typedefault_valid_option_keys
 
static const std::set< String_typedefault_valid_option_keys
 
static const std::set< String_typedefault_valid_option_keys = {"geom_type"}
 
static const std::set< String_typedefault_valid_option_keys
 
static const std::set< String_typedefault_valid_option_keys = {"read_only"}
 
static const std::set< String_typedefault_valid_option_keys
 
const Object_id INVALID_OBJECT_ID = (Object_id)-1
 The default object ID which represents that the DD object is new and not persistent in dictionary tables yet. More...
 
static constexpr int CPU_MASK_SIZE = 1024
 

Detailed Description

The version of the current data dictionary table definitions.

Data dictionary initialization.

This version number is stored on disk in the data dictionary. Every time the data dictionary schema structure changes, this version number must change. The table that stores the data dictionary version number is never allowed to change.

The data dictionary version number is the MySQL server version number of the first MySQL server version that published a given database schema. The format is Mmmdd with M=Major, m=minor, d=dot, so that MySQL 8.0.4 is encoded as 80004. This is the same version numbering scheme as the information schema and performance schema are using.

When a data dictionary version is made public, the next change to a dictionary table will be associated with the next available MySQL server version number. So if DD version 80004 is made available in MySQL 8.0.4, and 8.0.5 is an MRU with no changes to the DD tables, then the DD version will stay 80004 also in MySQL 8.0.5. If MySQL 9.0.4 is the first GA of 9.0, and if there are no changes to the DD tables compared to 8.0.4, then the DD version number will stay 80004 also in MySQL 9.0.4. Then, if there are changes to the DD tables after MySQL 9.0.4, then the new DD version will be 90005. In day to day builds internally, changes to the DD tables may be done incrementally, so there may be different builds having the same DD version number, yet with different DD table definitions.

Historical version number published in the data dictionary:

1: Published in 8.0.3-RC.

Introduced in MySQL 8.0.0 by WL#6378. Never published in a GA version. Last changes were:

  • WL#6049: Removed foreign_keys.unique_constraint_id and the corresponding FK constraint, added foreign_keys.unique_constraint_name.
  • Bug#2620373: Added index_stats.cached_time and table_stats.cached_time.

80004: Published in 8.0.4-RC.

Changes from version 1:

  • WL#9059: Added collation clause for spatial_reference_systems.organization
  • WL#9553: Added new 'options' column to the following DD tables: catalogs, character_sets, collations, column_statistics, events, foreign_keys, resource_groups, routines, schemata, st_spatial_reference_systems, triggers.

    (Other relevant DD tables have this column already: columns, indexes, parameters, tables, tablespaces).

    Also added explicit indexes for foreign keys instead of relying on these to be created implicitly for the following tables/columns: character_sets.default_collation_id, collations.character_set_id, columns.collation_id, columns.srs_id, events.client_collation_id, events.connection_collation_id, events.schema_collation_id, foreign_key_column_usage.column_id, index_column_usage.column_id, index_partitions.index_id, index_partitions.tablespace_id, indexes.tablespace_id, parameters.collation_id, routines.result_collation_id, routines.client_collation_id, routines.connection_collation_id, routines.schema_collation_id, schemata.default.collation_id, table_partitions.tablespace_id, tables.collation_id, tables.tablespace_id, triggers.client_collation_id, triggers.connection_collation_id, triggers.schema_collation_id,

80011: Published in 8.0 GA.

Changes from version 80004:

  • WL#8383 and WL#9465: Removed obsolete SQL modes from enums in 'events', 'routines' and 'triggers'.
  • WL#10774 removed NO_AUTO_CREATE_USER as a valid sql mode value. As a result events, routines and triggers table are updated.
  • Bug#27499518 changed the data type for the column 'hidden' in table 'columns' from BOOL to ENUM('Visible', 'SE', 'SQL').
  • Bug#11754608 "MYSQL DOESN'T SHOW WHAT COLLATION WAS USED IF THAT COLLATION IS THE DEFAU" Added a new column 'is_explicit_collation' to the 'columns' DD table.
  • BUG#27309116: Add a new column external_language to mysql.routines and update information_schema.routines to reflect this column.
  • Bug#27690593: CHANGE TYPE OF MYSQL.DD_PROPERTIES.PROPERTIES. Changed type of 'dd_properties.properties' from MEDIUMTEXT to MEDIUMBLOB.

80012: Published in 8.0.12

Changes from version 80011:

  • Bug#27745526: Various adjustments to make the DD table definitions in sync with WL#6379.

80013: Published in 8.0.13

Changes from version 80012:

  • Bug#24741307: add last_checked_for_upgrade column to msyql.tables table

80014: Published in 8.0.14

Changes from version 80013:

  • Bug#28492272: Synchronize sql_mode in server with that in DD.

80015: Not published. DD version still at 80014 in server 8.0.15.

No changes from version 80014.

80016: Published in 8.0.16

Changes from version 80014:

  • WL#929 - CHECK CONSTRAINTS New DD table check_constraints is introduced for the check constraints metadata.
  • WL#12261 adds new mysql.schemata.default_encryption DD column.
  • Bug#29053560 Increases DD column mysql.tablespaces.name length to 268.

80017: Published in 8.0.17

Changes from version 80016:

  • WL#12731 adds new mysql.schemata.se_private_data DD column.
  • WL#12571 Support fully qualified hostnames longer than 60 characters Server metadata table columns size is increased to 255.

80021: Published in 8.0.21

Changes from version 80017:

  • WL#13341 adds new columns mysql.tables.engine_attribute mysql.tables.secondary_engine_attribute mysql.columns.engine_attribute mysql.columns.secondary_engine_attribute mysql.indexes.engine_attribute mysql.indexes.secondary_engine_attribute mysql.tablespaces.engine_attribute

80022: Published in 8.0.22

Changes from version 80021:

  • Bug#31587625: PERFORMANCE DEGRADATION AFTER WL14073: Adds definer index for mysql.{events, routines, tables, triggers}.

80023: Current.

Changes from version 80022:

  • WL#10905 adds new hidden type 'USER' to mysql.columns.hidden column.
  • Bug#31867653 changes the type of mysql.table_partition_values.list_num from TINYINT to SMALLINT.

80024: Next DD version number after the previous is public.

Changes from version 80023:

  • No changes, this version number is not active yet.

80200:

Changes:

  • WL#14190: Replace old terms in replication SQL commands on the SOURCE

    Changes the enum of mysql.events.status to use the correct terminology

    80300:

Changes:

  • WL#15786: Automatically updated histograms

    Adds a boolean "auto-update" property to the histogram JSON object in

    the mysql.column_statistics table.

The data dictionary is initialized whenever the mysqld process starts. We distinguish between the first time start and the subsequent normal restarts/upgrades, as explained below. However, there are three main design principles that should be elaborated first.

  1. Two-step process: The dictionary initialization is implemented as a two step process. First, scaffolding is built to prepare the synchronization with persistent storage, then, the actual synchronization is done. The way this is done depends on the context, and is different for first time start and the subsequent restarts.
  2. Use SQL: The initialization uses SQL to build the scaffolding. This means that we execute SQL statements to create the dictionary tables. Since this is done at a stage where the physical tables either do not exist yet, or are not known, we must instrument the DDL execution to create the physical counterpart of the tables only on first time start. The goal is to keep the instrumentation at a minimum.
  3. Fake caching: As a consequence of keeping instrumentation at a minimum, we provide uniform behavior of the caching layer in the data dictionary also in the scaffolding phase. This means that as seen from the outside, dictionary objects can be retrieved from the cache. Internally, below the caching layer, the objects are only kept in a separate buffer until all the required scaffolding is built. At that point, we can start using the underlying physical tables, depending on the circumstances:

    • For first time start (initialization), we can flush the meta data generated in the scaffolding phase, to the DD tables.
    • For ordinary restart, we can use the scaffolding to open the physical tables, and then sync up the real meta data that is stored persistently.
    • For upgrade, we first build scaffolding based on the actual DD tables, then we create the target DD tables, migrate the meta data from the old to the new tables, and finally switch from old to new tables atomically by means of DML on the DD tables. This means that we update the schema ids in the DD tables directly instead of executing 'RENAME TABLE', which would do auto commit and thus break atomicity.

    After the scaffolding has been flushed or synced, what should be left is a collection of the core DD meta data objects. This collection is located in the storage adapter, and allows the DD cache to evict core DD objects in the same way as other DD objects.

Please note that dictionary initialization is only a small part of server initialization. There is a lot going on before and after dictionary initialization while starting the server.

Please see more elaborated descriptions for the initialize() and restart() methods below.

Typedef Documentation

◆ Char_string_template

template<class A >
using dd::Char_string_template = typedef std::basic_string<char, std::char_traits<char>, A>

Template alias for char-based std::basic_string.

◆ Char_stringstream_template

template<class A >
using dd::Char_stringstream_template = typedef std::basic_stringstream<char, std::char_traits<char>, A>

Template alias for char-based std::basic_stringstream.

◆ Encrypt_result

typedef ResultType< bool > dd::Encrypt_result

◆ Object_id

typedef unsigned long long dd::Object_id

◆ RJ_Allocator

typedef rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> dd::RJ_Allocator

◆ RJ_Document

typedef rapidjson::GenericDocument<RJ_Encoding, RJ_Allocator, rapidjson::CrtAllocator> dd::RJ_Document

◆ RJ_Encoding

typedef rapidjson::UTF8<char> dd::RJ_Encoding

◆ RJ_PrettyWriter

◆ RJ_StringBuffer

typedef rapidjson::GenericStringBuffer<RJ_Encoding, rapidjson::CrtAllocator> dd::RJ_StringBuffer

◆ RJ_Value

typedef rapidjson::GenericValue<RJ_Encoding, RJ_Allocator> dd::RJ_Value

◆ RJ_Writer

using dd::RJ_Writer = typedef rapidjson::Writer<RJ_StringBuffer, RJ_Encoding, RJ_Encoding, RJ_Allocator, 0>

◆ Sdi_type

◆ Sdi_writer

using dd::Sdi_writer = typedef RJ_Writer

Alias for the rapidjson Writer type to use in serialization.

Can be changeed to RJ_PrettyWriter to get human-readable (but significatly larger) sdis.

◆ String_type

◆ String_type_allocator

◆ Stringstream_type

Instantiation of std::basic_stringstream with the same allocator as String_type.

This is needed since a std::basic_stringstream::str() returns a basic_string allocated with its own allocator. Note that this also means that it is difficult to use a different PSI key for the stream memory as that would mean the return type of Stringstream_type::str() would be different and incompatible with String_type.

To work around this would require the creation of a temporary String_type from the string returned from stringstream::str().

◆ Tablespace_table_ref_vec

◆ Weak_object_impl

using dd::Weak_object_impl = typedef Weak_object_impl_<true>

Enumeration Type Documentation

◆ enum_column_types

enum class dd::enum_column_types
strong
Enumerator
DECIMAL 
TINY 
SHORT 
LONG 
FLOAT 
DOUBLE 
TYPE_NULL 
TIMESTAMP 
LONGLONG 
INT24 
DATE 
TIME 
DATETIME 
YEAR 
NEWDATE 
VARCHAR 
BIT 
TIMESTAMP2 
DATETIME2 
TIME2 
NEWDECIMAL 
ENUM 
SET 
TINY_BLOB 
MEDIUM_BLOB 
LONG_BLOB 
BLOB 
VAR_STRING 
STRING 
GEOMETRY 
JSON 

◆ enum_dd_init_type

enum class dd::enum_dd_init_type
strong
Enumerator
DD_INITIALIZE 
DD_INITIALIZE_SYSTEM_VIEWS 
DD_RESTART_OR_UPGRADE 
DD_UPDATE_I_S_METADATA 
DD_INITIALIZE_NON_DD_BASED_SYSTEM_VIEWS 

◆ enum_encryption_type

enum class dd::enum_encryption_type
strong
Enumerator
ET_NO 
ET_YES 

◆ enum_table_type

enum class dd::enum_table_type
strong
Enumerator
INVALID_TABLE 
BASE_TABLE 
USER_VIEW 
SYSTEM_VIEW 

Function Documentation

◆ acquire_exclusive_mdl()

static bool dd::acquire_exclusive_mdl ( THD thd,
MDL_key::enum_mdl_namespace  lock_namespace,
const char *  schema_name,
const char *  table_name,
bool  no_wait,
ulong  lock_wait_timeout,
enum_mdl_duration  lock_duration,
MDL_ticket **  out_mdl_ticket 
)
static

◆ acquire_exclusive_schema_mdl()

bool dd::acquire_exclusive_schema_mdl ( THD thd,
const char *  schema_name,
bool  no_wait,
MDL_ticket **  out_mdl_ticket 
)

Acquire exclusive metadata lock on the given schema name with explicit duration.

Parameters
[in]thdTHD to which lock belongs to.
[in]schema_nameSchema name
[in]no_waitUse try_acquire_lock() if no_wait is true. else use acquire_lock() with thd->variables.lock_wait_timeout timeout value.
[out]out_mdl_ticketA pointer to MDL_ticket upon successful lock attempt.

◆ acquire_exclusive_table_mdl() [1/2]

bool dd::acquire_exclusive_table_mdl ( THD thd,
const char *  schema_name,
const char *  table_name,
bool  no_wait,
MDL_ticket **  out_mdl_ticket 
)

Acquire exclusive metadata lock on the given table name with TRANSACTIONAL duration.

Parameters
[in]thdTHD to which lock belongs to.
[in]schema_nameSchema name
[in]table_nameTable name
[in]no_waitUse try_acquire_lock() if no_wait is true. else use acquire_lock() with thd->variables.lock_wait_timeout timeout value.
[out]out_mdl_ticketA pointer to MDL_ticket upon successful lock attempt.

◆ acquire_exclusive_table_mdl() [2/2]

bool dd::acquire_exclusive_table_mdl ( THD thd,
const char *  schema_name,
const char *  table_name,
unsigned long int  lock_wait_timeout,
MDL_ticket **  out_mdl_ticket 
)

Acquire exclusive metadata lock on the given table name with TRANSACTIONAL duration.

Parameters
[in]thdTHD to which lock belongs to.
[in]schema_nameSchema name
[in]table_nameTable name
[in]lock_wait_timeoutTime to wait.
[out]out_mdl_ticketA pointer to MDL_ticket upon successful lock attempt.

◆ acquire_exclusive_tablespace_mdl()

bool dd::acquire_exclusive_tablespace_mdl ( THD thd,
const char *  tablespace_name,
bool  no_wait,
MDL_ticket **  ticket = nullptr,
bool  for_trx = true 
)

Acquire an exclusive metadata lock on the given tablespace name with transaction duration.

Parameters
thdTHD to which lock belongs.
tablespace_nameTablespace name
no_waitUse try_acquire_lock() if no_wait is true, else use acquire_lock() with thd->variables.lock_wait_timeout timeout value.
ticketticket for request (optional out parameter)
for_trxtrue if MDL duration is MDL_TRANSACTION false if MDL duration is MDL_EXPLICIT
Return values
trueFailure, e.g. a lock wait timeout.
falseSuccessful lock acquisition.

◆ acquire_shared_mdl()

static bool dd::acquire_shared_mdl ( THD thd,
MDL_key::enum_mdl_namespace  lock_namespace,
const char *  schema_name,
const char *  table_name,
bool  no_wait,
ulong  lock_wait_timeout,
enum_mdl_duration  lock_duration,
MDL_ticket **  out_mdl_ticket 
)
static

◆ acquire_shared_table_mdl()

bool dd::acquire_shared_table_mdl ( THD thd,
const char *  schema_name,
const char *  table_name,
bool  no_wait,
MDL_ticket **  out_mdl_ticket 
)

Acquire shared metadata lock on the given table name with explicit duration.

Parameters
thd- THD to which lock belongs to.
schema_name- Schema name
table_name- Table name
no_wait- Use try_acquire_lock() if no_wait is true. else use acquire_lock() with thd->variables.lock_wait_timeout timeout value.
out_mdl_ticket- This is a OUT parameter, a pointer to MDL_ticket upon successful lock attempt.

◆ acquire_shared_tablespace_mdl()

bool dd::acquire_shared_tablespace_mdl ( THD thd,
const char *  tablespace_name,
bool  no_wait,
MDL_ticket **  ticket = nullptr,
bool  for_trx = true 
)

Acquire a shared metadata lock on the given tablespace name with transaction duration.

Parameters
thdTHD to which lock belongs.
tablespace_nameTablespace name
no_waitUse try_acquire_lock() if no_wait is true, else use acquire_lock() with thd->variables.lock_wait_timeout timeout value.
ticketticket for request (optional out parameter)
for_trxtrue if MDL duration is MDL_TRANSACTION false if MDL duration is MDL_EXPLICIT
Return values
trueFailure, e.g. a lock wait timeout.
falseSuccessful lock acquisition.

◆ add_part_col_vals()

static bool dd::add_part_col_vals ( partition_info part_info,
part_elem_value list_value,
uint  list_index,
dd::Partition part_obj,
const HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
String part_desc_str 
)
static

◆ alter_routine()

bool dd::alter_routine ( THD thd,
Routine routine,
st_sp_chistics chistics 
)

Alters routine characteristics in the DD table.

Parameters
[in]thdThread handle.
[in]routineProcedure or Function to alter.
[in]chisticsNew values of stored routine attributes to write.
Return values
falseON SUCCESS
trueON FAILURE

◆ alter_tablespace_encryption()

bool dd::alter_tablespace_encryption ( THD thd,
const char *  tablespace_name,
bool  encryption 
)

Execute an ALTER TABLESPACE ... ENCRYPTION statement.

During recovery of a storage engine, an ALTER TABLESPACE ... ENCRYPTION statement may be resumed. This is initiated from the SE, which will first set the state as appropriate in the SE, then invoke this method to start executing the statement. When the SE is involved during execution of the statement, the internal state in the SE will indicate that this is a statement that has been initiated and partially executed already.

Parameters
thdThread context.
tablespace_nameName of tablespace to encrypt/decrypt.
encryptionTrue to turn on encryption, false to turn off.
Return values
falseif no errors, otherwise true.

◆ buf_handle() [1/2]

char * dd::buf_handle ( Sdi_rcontext rctx,
size_t  sz 
)

Return a non-owning pointer to a char buffer which can be used for e.g.

base64 encoding.

Parameters
rctxopaque context
szsize of buffer
Returns
non-owning pointer to buffer

◆ buf_handle() [2/2]

char * dd::buf_handle ( Sdi_wcontext wctx,
size_t  sz 
)

Return a non-owning pointer to a char buffer which can be used for e.g.

base64 encoding.

Parameters
wctxopaque context.
szsize of buffer.

◆ check_if_server_ddse_readonly()

bool dd::check_if_server_ddse_readonly ( THD thd,
const char *  schema_name = nullptr 
)

Check if DDSE (Data Dictionary Storage Engine) is in readonly mode.

Parameters
thdThread
schema_nameAbbreviation or name of schema (I_S, P_S, ndbinfo) for use in warning message output; nullptr if no warning should be emitted
Returns
false on success, otherwise true.

◆ check_non_standard_key_exists_in_fk()

bool dd::check_non_standard_key_exists_in_fk ( THD thd,
const Table table 
)

Validate if table uses foreign keys referring to proper index.

FK cannot refer to non unique index and partial elements in index.

Parameters
thdThread handle.
tabledd::Table instance of referenced table

◆ collect_partition_expr()

static void dd::collect_partition_expr ( const THD thd,
List< char > &  field_list,
String str 
)
static

◆ commit_or_rollback_tablespace_change()

bool dd::commit_or_rollback_tablespace_change ( THD thd,
dd::Tablespace space,
bool  error,
bool  release_mdl_on_commit_only = false 
)

Update a tablespace change, commit and release transactional MDL.

Parameters
[in,out]thdCurrent thread context.
[in,out]spaceTablespace to update and commit.
[in]errortrue for failure: Do rollback. false for success: Do commit.
[in]release_mdl_on_commit_onlyrelease MDLs only on commit
Return values
trueIf error is true, or if failure in update or in commit.
falseOtherwise.

◆ convert_action_time_from_dd()

static enum_trigger_action_time_type dd::convert_action_time_from_dd ( dd::Trigger::enum_action_timing  action_timing)
static

Convert action timing value from DD presentation to generic SQL presentation.

Parameters
[in]action_timingAction timing value from the Data Dictionary
Returns
Action timing value as it's presented in generic SQL-layer

◆ convert_event_type_from_dd()

static enum_trigger_event_type dd::convert_event_type_from_dd ( dd::Trigger::enum_event_type  event_type)
static

Convert event type value from DD presentation to generic SQL presentation.

Parameters
[in]event_typeEvent type value from the Data Dictionary
Returns
Event type value as it's presented in generic SQL-layer

◆ copy_tablespace_names()

template<typename IT >
static void dd::copy_tablespace_names ( const HA_CREATE_INFO ci,
partition_info pi,
IT  it 
)
static

◆ create_dd_schema()

bool dd::create_dd_schema ( THD thd)

Executes SQL queries to create and use the dictionary schema.

Parameters
thdThread context.

◆ create_dd_system_table()

static std::unique_ptr< dd::Table > dd::create_dd_system_table ( THD thd,
const dd::Schema system_schema,
const dd::String_type table_name,
HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
const KEY keyinfo,
uint  keys,
const FOREIGN_KEY fk_keyinfo,
uint  fk_keys,
const Sql_check_constraint_spec_list check_cons_spec,
handler file,
const dd::Object_table dd_table 
)
static

◆ create_dd_user_table()

std::unique_ptr< dd::Table > dd::create_dd_user_table ( THD thd,
const dd::Schema sch_obj,
const dd::String_type table_name,
HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
const KEY keyinfo,
uint  keys,
Alter_info::enum_enable_or_disable  keys_onoff,
const FOREIGN_KEY fk_keyinfo,
uint  fk_keys,
const Sql_check_constraint_spec_list check_cons_spec,
handler file 
)

Prepares a dd::Table object from mysql_prepare_create_table() output and return it to the caller.

This function creates a user table, as opposed to create_table() which can handle system tables as well.

Parameters
thdThread handle
sch_objSchema.
table_nameTable name.
create_infoHA_CREATE_INFO describing the table to be created.
create_fieldsList of fields for the table.
keyinfoArray with descriptions of keys for the table.
keysNumber of keys.
keys_onoffkeys ON or OFF
fk_keyinfoArray with descriptions of foreign keys for the table.
fk_keysNumber of foreign keys.
check_cons_specSpecification of check constraints for the table.
filehandler instance for the table.
Returns
Constructed dd::Table object, or nullptr in case of an error.

◆ create_event()

bool dd::create_event ( THD thd,
const Schema schema,
const String_type event_name,
const String_type event_body,
const String_type event_body_utf8,
const LEX_USER definer,
Event_parse_data event_data 
)

Create an event object and commit it to DD Table Events.

Parameters
thdThread handle
schemaSchema object.
event_nameEvent name
event_bodyEvent body.
event_body_utf8Event body in utf8 format.
definerDefiner of the event.
event_dataEvent information obtained from parser.
Return values
trueEvent creation failed.
falseEvent creation succeeded.

◆ create_native_table()

bool dd::create_native_table ( THD thd,
const Plugin_table pt 
)

Create plugin native table.

The API would only write metadata to DD and skip calling handler::create().

Parameters
[in]thdTHD to which lock belongs to.
[in]ptPlugin_table* contain metadata of table to be created.
Returns
false on success, otherwise true.

◆ create_object()

template<typename X >
X * dd::create_object ( )

Create a instance of data dictionary object of type X.

E.g., X could be 'dd::Table', 'dd::View' and etc.

Returns
Pointer to the newly allocated dictionary object.

◆ create_object< Charset_impl >()

◆ create_object< Collation >()

◆ create_object< Collation_impl >()

◆ create_object< Column >()

template Column * dd::create_object< Column > ( )

◆ create_object< Column_statistics >()

◆ create_object< Column_type_element >()

◆ create_object< Event >()

template Event * dd::create_object< Event > ( )

◆ create_object< Foreign_key >()

◆ create_object< Foreign_key_element >()

◆ create_object< Function >()

template Function * dd::create_object< Function > ( )

◆ create_object< Index >()

template Index * dd::create_object< Index > ( )

◆ create_object< Index_element >()

◆ create_object< Index_stat >()

◆ create_object< Partition >()

◆ create_object< Partition_index >()

◆ create_object< Partition_value >()

◆ create_object< Procedure >()

◆ create_object< Resource_group >()

◆ create_object< Schema >()

template Schema * dd::create_object< Schema > ( )

◆ create_object< Spatial_reference_system >()

◆ create_object< Table >()

template Table * dd::create_object< Table > ( )

◆ create_object< Table_stat >()

◆ create_object< Tablespace >()

◆ create_object< Tablespace_file >()

◆ create_object< View >()

template View * dd::create_object< View > ( )

◆ create_resource_group()

bool dd::create_resource_group ( THD thd,
const resourcegroups::Resource_group res_grp_ref 
)

Create a DD object and persist it to DD table resourcegroup.

Parameters
thdThread handle.
res_grp_refReference to resource group.
Return values
trueResource group creation failed.
falseResource group creation succeeded.

◆ create_routine()

bool dd::create_routine ( THD thd,
const Schema schema,
sp_head sp,
const LEX_USER definer 
)

Prepares dd:Routine object from sp_head and updates DD tables accordingly.

Parameters
[in]thdThread handle.
[in]schemaSchema to create the routine in.
[in]spStored routine object to store.
[in]definerStored routine definer.
Return values
falseON SUCCESS
trueON FAILURE

◆ create_schema()

bool dd::create_schema ( THD thd,
const char *  schema_name,
const CHARSET_INFO charset_info,
bool  default_encryption 
)

Create a schema record into dd.schemata.

◆ create_table()

std::unique_ptr< dd::Table > dd::create_table ( THD thd,
const dd::Schema sch_obj,
const dd::String_type table_name,
HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
const KEY keyinfo,
uint  keys,
Alter_info::enum_enable_or_disable  keys_onoff,
const FOREIGN_KEY fk_keyinfo,
uint  fk_keys,
const Sql_check_constraint_spec_list check_cons_spec,
handler file 
)

Prepares a dd::Table object from mysql_prepare_create_table() output and return it to the caller.

Parameters
thdThread handle
sch_objSchema.
table_nameTable name.
create_infoHA_CREATE_INFO describing the table to be created.
create_fieldsList of fields for the table.
keyinfoArray with descriptions of keys for the table.
keysNumber of keys.
keys_onoffEnable or disable keys.
fk_keyinfoArray with descriptions of foreign keys for the table.
fk_keysNumber of foreign keys.
check_cons_specSpecification of check constraints for the table.
filehandler instance for the table.
Returns
Constructed dd::Table object, or nullptr in case of an error.

◆ create_tables()

bool dd::create_tables ( THD thd,
const std::set< String_type > *  create_set 
)

Execute SQL statements to create the DD tables.

The tables created here will be a subset of the target DD tables for this DD version. This function is called in the following four cases:

  1. When a server is started the first time, with –initialize. Then, we will iterate over all target tables and create them. This will also make them be created physically in the DDSE.
  2. When a server is restarted, and the data directory contains a dictionary with the same DD version as the target DD version of the starting server. In this case, we will iterate over all target tables and create them, using the target table SQL DDL definitions. This is done only to create the meta data, though; the tables will not be created physically in the DDSE since they already exist. But we need to create the meta data to be able top open them.
  3. When a server is restarted, and the data directory was last used by a more recent MRU within the same GA with a higher target DD version. This is considered a 'minor downgrade'. In this case, the restarting server will continue to run using the more recent DD version. This is possible since only a subset of DD changes are allowed in a DD upgrade that can also be downgraded. However, it means that we must create the meta data reflecting the actual tables, not the target tables. So in this case, we iterate over the target tables, but execute the DDL statements of the actual tables. We get these statements from the 'dd_properties' table, where the more recent MRU has stored them.
  4. When a server is restarted, and the data directory was last used by a server with a DD version from which the starting server can upgrade. In this case, this function is called three times:
    • The first time, we need to create the meta data reflecting the actual tables in the persistent DD. This is needed to be able to open the DD tables and read the data. This is similar to use case 3. above.
    • The second time, we create the tables that are modified in the new DD version. Here, the tables are also created physically in the DDSE. In this case, the 'create_set' specifies which subset of the target tables should be created. After this stage, we replace the meta data in 'dd_properties' by new meta data reflecting the modified tables. We also replace the version numbers to make sure a new restart will use the upgraded DD.
    • The third time, we do the same as in case 2 above. This is basically the same as a shutdown and restart of the server after upgrade was completed.
Parameters
thdThread context.
create_setSubset of the target tables which should be created during upgrade.
Returns
false if success, otherwise true.

◆ create_tmp_table()

std::unique_ptr< dd::Table > dd::create_tmp_table ( THD thd,
const dd::Schema sch_obj,
const dd::String_type table_name,
HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
const KEY keyinfo,
uint  keys,
Alter_info::enum_enable_or_disable  keys_onoff,
const Sql_check_constraint_spec_list check_cons_spec,
handler file 
)

Prepares a dd::Table object for a temporary table from mysql_prepare_create_table() output.

Doesn't update DD tables, instead returns dd::Table object to caller.

Parameters
thdThread handle.
sch_objSchema.
table_nameTable name.
create_infoHA_CREATE_INFO describing the table to be created.
create_fieldsList of fields for the table.
keyinfoArray with descriptions of keys for the table.
keysNumber of keys.
keys_onoffEnable or disable keys.
check_cons_specSpecification of check constraints for the table.
filehandler instance for the table.
Returns
Constructed dd::Table object, or nullptr in case of an error.

◆ create_trigger()

bool dd::create_trigger ( THD thd,
const ::Trigger new_trigger,
enum_trigger_order_type  ordering_clause,
const LEX_CSTRING referenced_trigger_name 
)

Create new trigger in the data dictionary.

Parameters
[in]thdthread handle
[in]new_triggerTrigger object from sql-layer that describes a trigger to add in the Data Dictionary
[in]ordering_clauseOrdering property for trigger being created
[in]referenced_trigger_nameInformation about trigger referenced by ordering_clause if any.
Returns
Operation status
Return values
trueFailure
falseSuccess

◆ create_view()

bool dd::create_view ( THD thd,
const dd::Schema schema,
Table_ref view 
)

Store view metadata in the data-dictionary.

Parameters
thdThread handle.
schemaSchema where the view should be created.
viewTable_ref element describing the view.
Note
The caller must rollback both statement and transaction on failure, before any further accesses to DD. This is because such a failure might be caused by a deadlock, which requires rollback before any other operations on SE (including reads using attachable transactions) can be done.
Return values
falseOn Success.
trueOn Failure.

◆ dd_get_new_index_algorithm_type()

static dd::Index::enum_index_algorithm dd::dd_get_new_index_algorithm_type ( enum ha_key_alg  type)
static

◆ dd_get_new_index_type()

static dd::Index::enum_index_type dd::dd_get_new_index_type ( const KEY key)
static

◆ dd_get_new_row_format()

static Table::enum_row_format dd::dd_get_new_row_format ( row_type  old_format)
static

Convert old row type value to corresponding value in new row format enum used by DD framework.

◆ dd_get_new_view_algorithm_type()

static dd::View::enum_algorithm dd::dd_get_new_view_algorithm_type ( enum enum_view_algorithm  type)
static

◆ dd_get_new_view_check_type()

static dd::View::enum_check_option dd::dd_get_new_view_check_type ( ulonglong  type)
static

For enum in dd::View.

◆ dd_get_new_view_security_type()

static dd::View::enum_security_type dd::dd_get_new_view_security_type ( ulonglong  type)
static

◆ dd_get_old_view_algorithm_type()

static enum enum_view_algorithm dd::dd_get_old_view_algorithm_type ( dd::View::enum_algorithm  type)
static

◆ dd_get_old_view_check_type()

static ulonglong dd::dd_get_old_view_check_type ( dd::View::enum_check_option  type)
static

◆ dd_get_old_view_security_type()

static ulonglong dd::dd_get_old_view_security_type ( dd::View::enum_security_type  type)
static

◆ drop_native_table()

bool dd::drop_native_table ( THD thd,
const char *  schema_name,
const char *  table_name 
)

Remove plugin native table from DD.

The API would only update metadata to DD and skip calling handler::drop().

Parameters
[in]thdTHD to which lock belongs to.
[in]schema_nameschema name which the table belongs to.
[in]table_nametable name to be dropped.
Returns
false on success, otherwise true.

◆ drop_resource_group()

bool dd::drop_resource_group ( THD thd,
const String_type  resource_grp_name 
)

Drop a resource group from DD table resourcegroup.

Parameters
thdThread handle.
resource_grp_nameName of resource group to be dropped.
Return values
trueif resource group drop failed.
falseif resource group drop succeeded.

◆ drop_table()

bool dd::drop_table ( THD thd,
const char *  schema_name,
const char *  name,
const dd::Table table_def 
)

◆ eat_pairs()

bool dd::eat_pairs ( String_type::const_iterator &  it,
String_type::const_iterator  end,
dd::Properties props 
)

Start at it, find a key and value separated by an unescaped '='.

Value is supposed to be terminated by an unescaped ';' or by the end of the string. Unescape the key and value and add them to the property object. Call recursively to find the remaining pairs.

Parameters
[in,out]propsproperty object where key and value should be added
[in,out]itstring iterator
enditerator pointing to string end
Returns
Operation status
Return values
trueif an error occurred
falseif success

◆ eat_str()

bool dd::eat_str ( String_type dest,
String_type::const_iterator &  it,
String_type::const_iterator  end,
char  c 
)

Start at it, find first unescaped occorrence of c, create destination string and copy substring to destination.

Unescape the destination string, advance the iterator to get to the next character after c, or to end of string.

In the event of success, the iterator will be at the next character after the one that was to be searched for, or at the end of the string.

Parameters
[out]destdestination string
[in,out]itstring iterator
enditerator pointing to string end
ccharacter to search for
Returns
Operation status
Return values
trueif an error occurred
falseif success

◆ eat_to()

bool dd::eat_to ( String_type::const_iterator &  it,
String_type::const_iterator  end,
char  c 
)

Start at it, iterate until we hit an unescaped c or the end of the string.

The stop character c may be ';' or '='. The escape character is '\'. Escapable characters are '\', '=' and ';'. Hitting an unescaped '=' while searching for ';' is an error, and also the opposite. Hitting end of string while searching for '=' is an error, but end of string while searching for ';' is ok.

In the event of success, the iterator will be at the character to be searched for, or at the end of the string.

Parameters
[in,out]itstring iterator
enditerator pointing to string end
ccharacter to search for
Returns
Operation status
Return values
trueif an error occurred
falseif success

◆ end_transaction()

bool dd::end_transaction ( THD thd,
bool  error 
)

Helper function to do rollback or commit, depending on error.

Also closes tables and releases transactional locks, regardless of error.

Parameters
thdThread
errorIf true, the transaction will be rolledback. otherwise, it is committed.
Returns
false on success, otherwise true.

◆ engine_supports_provided_srs_id()

static bool dd::engine_supports_provided_srs_id ( THD thd,
const dd::Table table,
const handler handler 
)
static

Check if the storage engine supports geographic geometry columns.

If not, check that the columns defined only has Cartesian coordinate systems (projected SRS or SRID 0).

Parameters
thdThread handle
tableThe table definition
handlerHandler to the storage engine
Returns
true if the engine does not supports the provided SRS id. In that case my_error is called
false on success

◆ escape()

void dd::escape ( String_type dst,
const String_type src 
)

Escaping of a String_type.

Escapable characters are '\', '=' and ';'. Escape character is '\'. Iterate over all characters of src, precede all escapable characters by the escape character and append to dst. The source string is not modified.

Parameters
[out]dststring to which escaped result will be appended.
[in]srcsource string for escaping

◆ execute_query()

bool dd::execute_query ( THD thd,
const dd::String_type q_buf 
)

Create a lex string for the query from the string supplied and execute the query.

Parameters
thdThread handle.
q_bufString containing the query text.
Return values
falseSuccess.
trueError.

◆ fetch_tablespace_table_refs()

bool dd::fetch_tablespace_table_refs ( THD thd,
const Tablespace tso,
Tablespace_table_ref_vec tblrefs 
)

Fetch (by inserting into tblref vector) Tablespace_table_ref objects which describe tables in a given tablespace.

Parameters
thdthread context
tsodd object
tblrefs[OUT] Tablespace_table_ref objects for tables in tablespace
Return values
trueif error occurred
falseotherwise

◆ fill_dd_check_constraints()

bool dd::fill_dd_check_constraints ( THD thd,
dd::Table tab_obj,
const Sql_check_constraint_spec_list check_cons_spec 
)

Fill in check constraints metadata to the Table object from the list of check constraint specifications.

Parameters
[in]thdThread handle.
[in,out]tab_objTable object where to store the info.
[in]check_cons_specCheck constraints specification list.
Returns
false on success, else true.

◆ fill_dd_columns_from_create_fields()

bool dd::fill_dd_columns_from_create_fields ( THD thd,
Abstract_table tab_obj,
const List< Create_field > &  create_fields,
handler file 
)

Add column objects to dd::Abstract_table according to list of Create_field objects.

Add column objects to dd::Abstract_table objects according to the list of Create_field objects.

Parameters
thdThread handle.
tab_objdd::Table or dd::View's instance.
create_fieldsList of Create_field objects to fill dd::Column object(s).
filehandler instance for the table.
Return values
falseOn Success
trueOn error.

Storing default value specified for column in columns.default_value_utf8. The values are stored in string form here. This information is mostly used by the I_S queries. For others, default value can be obtained from the columns.default_values.

So now column.default_value_utf8 is not just used for storing "CURRENT_TIMESTAMP" for timestamp columns but also used to hold the default value of column of all types.

To get the default value in string form, buffer "buf" prepared in prepare_default_value() is used.

◆ fill_dd_foreign_keys_from_create_fields()

static bool dd::fill_dd_foreign_keys_from_create_fields ( dd::Table tab_obj,
uint  key_count,
const FOREIGN_KEY keyinfo 
)
static

Add foreign keys to dd::Table according to Foreign_key_spec structs.

Parameters
tab_objtable to add foreign keys to
key_countnumber of foreign keys
keyinfoarray containing foreign key info
Returns
true if error (error reported), false otherwise.

◆ fill_dd_function_return_type()

static void dd::fill_dd_function_return_type ( THD thd,
sp_head sp,
Function sf 
)
static

Helper method for create_routine() to fill return type information of stored routine from the sp_head.

from the sp_head.

Parameters
[in]thdThread handle.
[in]spStored routine object.
[out]sfdd::Function object.

◆ fill_dd_index_elements_from_key_parts()

static void dd::fill_dd_index_elements_from_key_parts ( const dd::Table tab_obj,
dd::Index idx_obj,
uint  key_part_count,
const KEY_PART_INFO key_parts,
handler file,
bool  is_primary_key 
)
static

Add dd::Index_element objects to dd::Index/Table according to KEY_PART_INFO array for the index.

◆ fill_dd_indexes_from_keyinfo()

static void dd::fill_dd_indexes_from_keyinfo ( THD thd,
dd::Table tab_obj,
uint  key_count,
const KEY keyinfo,
const List< Create_field > &  create_fields,
handler file 
)
static

Add index objects to dd::Table according to array of KEY structures.

Currently the index order type is not persisted in new DD or in .FRM. In I_S with new DD index order is calculated from the index type. That is, the index order is always calculated as ascending except for FULLTEXT and HASH index. Type of index ordering(ASC/DESC/UNDEF) is property of handler and index type. With the proper handler and the index type, index order type can be easily retrieved. So here using keyinfo with table share of handler to get the index order type. If table share does not exist for handler then dummy_table_share is created. Index order type value is stored in the index_column_usage.index_order.

Note: The keyinfo prepared here is some what different from one prepared at table opening time. For example: actual_flags, unused_key_parts, usable_key_parts, rec_per_key, rec_per_key_float ... member of keyinfo might be different in one prepared at table opening time.

But index_flags() implementations mostly uses algorithm and flags members of keyinfo to get the flag value. Apparently these members are not different from the one prepared at table opening time. So approach to get index order type from keyinfo works fine.

Alternative approach: Introduce a new handler API to get index order type using the index type. Usage of dummy_table_share and backup variables to reset handler's table share can be avoided with this approach.

TODO:Refine approach during the complete WL6599 review by dlenev.

◆ fill_dd_partition_from_create_info()

static bool dd::fill_dd_partition_from_create_info ( THD thd,
dd::Table tab_obj,
const HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
partition_info part_info 
)
static

Fill in partitioning meta data form create_info to the table object.

Parameters
[in]thdThread handle.
[in,out]tab_objTable object where to store the info.
[in]create_infoCreate info.
[in]create_fieldsList of fields in the new table.
[in]part_infoPartition info object.
Returns
false on success, else true.

◆ fill_dd_routine_info()

static bool dd::fill_dd_routine_info ( THD thd,
const dd::Schema schema,
sp_head sp,
Routine routine,
const LEX_USER definer 
)
static

Helper method for create_routine() to prepare dd::Routine object from the sp_head.

Parameters
[in]thdThread handle.
[in]schemaSchema where the routine is to be created.
[in]spStored routine object.
[in]definerDefiner of the routine.
[out]routinedd::Routine object to be prepared from the sp_head.
Return values
falseON SUCCESS
trueON FAILURE

◆ fill_dd_table_from_create_info()

static bool dd::fill_dd_table_from_create_info ( THD thd,
dd::Table tab_obj,
const dd::String_type table_name,
const dd::String_type schema_name,
const HA_CREATE_INFO create_info,
const List< Create_field > &  create_fields,
const KEY keyinfo,
uint  keys,
Alter_info::enum_enable_or_disable  keys_onoff,
const FOREIGN_KEY fk_keyinfo,
uint  fk_keys,
const Sql_check_constraint_spec_list check_cons_spec,
handler file 
)
static

Fill dd::Table object from mysql_prepare_create_table() output.

◆ fill_dd_tablespace_id_or_name()

template<typename T >
static bool dd::fill_dd_tablespace_id_or_name ( THD thd,
T *  obj,
handlerton hton,
const char *  tablespace_name,
bool  is_temporary_table 
)
static

Set dd::Tablespace object id for dd::Table and dd::Partition object during CREATE TABLE.

Parameters
thd- Thread handle.
obj- dd::Table or dd::Partition.
hton- handlerton of table or a partition.
tablespace_name- Tablespace name to be associated with Table or partition.
is_temporary_table- Is this temporary table ?
Returns
true - On failure.
false - On success.

◆ fill_dd_view_columns()

static bool dd::fill_dd_view_columns ( THD thd,
View view_obj,
const Table_ref view 
)
static

Method to fill view columns from the first Query_block of view query.

Parameters
thdThread Handle.
view_objDD view object.
viewTable_ref object of view.
Return values
falseOn Success.
trueOn failure.

◆ fill_dd_view_definition()

static bool dd::fill_dd_view_definition ( THD thd,
View view_obj,
Table_ref view 
)
static

Method to fill view information in the View object.

Parameters
thdThread handle.
view_objDD view object.
viewView description.
Return values
falseOn success.
trueOn failure.

◆ fill_dd_view_routines()

static void dd::fill_dd_view_routines ( View view_obj,
Query_tables_list routines_ctx 
)
static

Method to fill view routines from the set of routines used by view query.

Parameters
view_objDD view object.
routines_ctxQuery_table_list object for the view which contains set of routines used by view query.

◆ fill_dd_view_tables()

static void dd::fill_dd_view_tables ( View view_obj,
const Table_ref view,
const Table_ref query_tables 
)
static

Method to fill base table and view names used by view query in DD View object.

Parameters
view_objDD view object.
viewTable_ref object of view.
query_tablesView query tables list.

◆ fill_in_dd_trigger_object()

static bool dd::fill_in_dd_trigger_object ( const ::Trigger new_trigger,
Trigger dd_trig_obj 
)
static

Fill in a dd::Trigger object based on a Trigger object supplied by sql-layer.

Parameters
[in]new_triggerTrigger object supplied by sql-layer
[out]dd_trig_objdd::Trigger object to fill in
Returns
Operation status
Return values
trueFailure
falseSuccess

◆ fill_parameter_info_from_field()

static void dd::fill_parameter_info_from_field ( THD thd,
Create_field field,
dd::Parameter param 
)
static

Helper method for create_routine() to fill parameter information from the object of type Create_field.

Method is called by the fill_routine_parameters_info().

Parameters
[in]thdThread handle.
[in]fieldObject of type Create_field.
[out]paramParameter object to be filled using the state of field object.

◆ fill_routine_parameters_info()

static bool dd::fill_routine_parameters_info ( THD thd,
sp_head sp,
Routine routine 
)
static

Helper method for create_routine() to fill parameters of routine to dd::Routine object from the sp_head.

Method is called from the fill_dd_routine_info().

Parameters
[in]thdThread handle.
[in]spStored routine object.
[out]routinedd::Routine object prepared from sp_head.
Return values
falseON SUCCESS
trueON FAILURE

◆ fill_table_and_parts_tablespace_names()

bool dd::fill_table_and_parts_tablespace_names ( THD thd,
const char *  db_name,
const char *  table_name,
Tablespace_hash_set tablespace_set 
)

Fill Tablespace_hash_set with tablespace names used by the given db_name.table_name.

Parameters
thd- Thread invoking the function.
db_name- Database name.
table_name- Table name.
tablespace_set- (OUT) hash set where tablespace names are filled.
Returns
true - On failure.
false - On success.

◆ fix_row_type()

bool dd::fix_row_type ( THD thd,
dd::Table table,
row_type  correct_row_type 
)

Update row format for the table with the value value supplied by caller function.

Precondition
There must be an exclusive MDL lock on the table.
Parameters
[in]thdThread context.
[in]tableTable object for the table.
[in]correct_row_typerow_type to be set.
Return values
falseSuccess
trueError

◆ generic_lookup_ref()

template<typename T >
bool dd::generic_lookup_ref ( THD thd,
MDL_key::enum_mdl_namespace  mdlns,
const String_type name,
dd::Object_id idp 
)

◆ generic_serialize()

template<typename T >
String_type dd::generic_serialize ( THD thd,
const char *  dd_object_type,
size_t  dd_object_type_size,
const T &  dd_obj,
const String_type schema_name 
)

◆ generic_track_object()

template<typename T >
void dd::generic_track_object ( dd_vector< T * > *  tvp,
T *  t 
)

◆ get_by_opx() [1/2]

Column * dd::get_by_opx ( Sdi_rcontext rctx,
const Column ,
uint  opx 
)

Return an non-owning raw pointer to the deserialized Column object with ordinal position index opx (ordinal position opx+1).

The unused const Column* argument is needed for overload resolution.

Parameters
rctxopaque context
opxordinal position index

◆ get_by_opx() [2/2]

Index * dd::get_by_opx ( Sdi_rcontext rctx,
const Index ,
uint  opx 
)

Return an non-owning raw pointer to the deserialized Index object with ordinal position index opx (ordinal position opx+1).

The unused const Index* argument is needed for overload resolution.

Parameters
rctxopaque context
opxordinal position index

◆ get_dd_action_timing()

static Trigger::enum_action_timing dd::get_dd_action_timing ( const ::Trigger new_trigger)
inlinestatic

Get DD API value of action timing for a trigger.

Parameters
[in]new_triggerpointer to a Trigger object from sql-layer.
Returns
Value of enumeration Trigger::enum_action_timing

◆ get_dd_client()

cache::Dictionary_client * dd::get_dd_client ( THD thd)

Get Dictionary_client from THD object (the latter is opaque * in SEs).

◆ get_dd_event_type()

static Trigger::enum_event_type dd::get_dd_event_type ( const ::Trigger new_trigger)
inlinestatic

Get DD API value of event type for a trigger.

Parameters
[in]new_triggerpointer to a Trigger object from sql-layer.
Returns
Value of enumeration dd::Trigger::enum_event_type

◆ get_dd_table()

template<typename Entity_object_type >
const Object_table & dd::get_dd_table ( )

Get the Object_table instance storing the given entity object type.

We can return this as a reference since all relevant types for which this template is used will indeed have a corresponding object table.

Template Parameters
Entity_object_typeType for which to get the object table.
Returns
reference to Object_table instance.

◆ get_dd_table< dd::Column >()

template const Object_table & dd::get_dd_table< dd::Column > ( )

◆ get_dd_table< dd::Index >()

template const Object_table & dd::get_dd_table< dd::Index > ( )

◆ get_dd_table< dd::Partition >()

template const Object_table & dd::get_dd_table< dd::Partition > ( )

◆ get_dd_table< dd::Table >()

template const Object_table & dd::get_dd_table< dd::Table > ( )

◆ get_dd_table< dd::Tablespace >()

template const Object_table & dd::get_dd_table< dd::Tablespace > ( )

◆ get_dictionary()

Dictionary * dd::get_dictionary ( )

Get the data dictionary instance.

Returns
'Dictionary*' pointer to data dictionary instance. Else returns NULL if data dictionary is not initialized.

◆ get_enum_event_status()

static Event::enum_event_status dd::get_enum_event_status ( int  event_status)
static

Convert legacy event status to dd::Event::enum_event_status.

Parameters
event_statusLegacy event_status
Returns
dd::Event::enum_event_status value corresponding to legacy event_status.

◆ get_enum_interval_field()

static Event::enum_interval_field dd::get_enum_interval_field ( interval_type  interval_type_val)
static

Convert legacy interval type value to dd::Event::enum_interval_field.

Parameters
interval_type_valInterval type value.
Returns
dd::Event::enum_interval_field corresponding to legacy interval type value.

◆ get_field_datetime_precision()

bool dd::get_field_datetime_precision ( const Create_field field,
uint *  datetime_precision 
)

Helper method to get datetime precision for types using Create_field type object.

Parameters
[in]fieldField object.
[out]datetime_precisiondatetime precision value for types.
Return values
falseIf datetime precision is calculated.
trueIf datetime precision is not calculated;

◆ get_field_list_str()

static bool dd::get_field_list_str ( dd::String_type str,
List< char > *  name_list 
)
static

Get a string of fields to be stores as partition_expression.

Must be in sync with set_field_list()!

Parameters
[in,out]strString to add the field name list to.
[in]name_listField name list.
Returns
false on success, else true.

◆ get_field_numeric_precision()

bool dd::get_field_numeric_precision ( const Create_field field,
uint *  numeric_precision 
)

Helper method to get numeric precision for types using Create_field type object.

Parameters
[in]fieldField object.
[out]numeric_precisionnumeric precision value for types.
Return values
falseIf numeric precision is calculated.
trueIf numeric precision is not calculated;

◆ get_field_numeric_scale()

bool dd::get_field_numeric_scale ( const Create_field field,
uint *  scale 
)

Helper method to get numeric scale for types using Create_field type object.

Parameters
[in]fieldField object.
[out]scalenumeric scale value for types.
Return values
falseIf numeric scale is calculated.
trueIf numeric scale is not calculated;

◆ get_fk_rule()

static dd::Foreign_key::enum_rule dd::get_fk_rule ( fk_option  opt)
static

Translate from the old fk_option enum to the new dd::Foreign_key::enum_rule enum.

Parameters
optold fk_option enum.
Returns
new dd::Foreign_key::enum_rule

◆ get_implicit_tablespace_options()

bool dd::get_implicit_tablespace_options ( THD thd,
const Table table,
ulonglong autoextend_size 
)

Get the autoextend_size option value for implicit tablespaces.

Parameters
thdThread handler
tabledd::Table instance
autoextend_sizeValue of autoextend_size attribute
Returns
true - On failure
false - On success

◆ get_new_field_type()

enum_column_types dd::get_new_field_type ( enum_field_types  type)

Convert to and from new enum types in DD framework to current MySQL server enum types.

Convert field type from MySQL server type to new enum types in DD.

We have plans to retain both old and new enum values in DD tables so as to handle client compatibility and information schema requirements.

We have plans to retain both old and new enum values in DD tables so as to handle client compatibility and information schema requirements.

Parameters
[in]typeMySQL server field type.
Return values
fieldtype used by DD framework.

◆ get_old_interval_type()

interval_type dd::get_old_interval_type ( Event::enum_interval_field  interval_field)

Convert new DD interval_field type to type interval_type used in server code.

Parameters
interval_fieldinterval_field of type enum_interval_field.
Returns
an value of type interval type indicating interval type values used in server code.

◆ get_old_on_completion()

int dd::get_old_on_completion ( Event::enum_on_completion  on_completion)

Convert new DD Event::enum_on_completion to completion type used in server code.

Parameters
on_completionon_completion of type enum_on_completion.
Returns
an int indicating on_completion of event used in server code.

◆ get_old_status()

int dd::get_old_status ( Event::enum_event_status  event_status)

Convert new DD Event::enum_event_status to status type used in server code.

Parameters
event_statusstatus of type enum_event_status.
Returns
an int indicating status of event used in server code.

◆ get_on_completion()

static Event::enum_on_completion dd::get_on_completion ( int  on_completion)
static

Convert legacy event on completion behavior to dd::Event::enum_on_compeltion.

Parameters
on_completionLegacy on completion behaviour value
Returns
dd::Event::enum_on_compeltion corresponding to legacy event on completion value.

◆ get_se_private_data()

static bool dd::get_se_private_data ( THD thd,
dd::Table tab_obj 
)
static

Get the SE private data from the dd_properties table.

Note
During restart, when the scaffolding is created, we assign the DD tablespace id (==1) even though this is different that the scaffolding DD tablespace id. This is because both server code and innodb code has hard coded expectations regarding the DD tablespace id.
Parameters
[in]thdThread context.
[in,out]tab_objTable object to which SE private data should be added.
Returns
true if error, false otherwise.

◆ get_sql_type_by_create_field()

dd::String_type dd::get_sql_type_by_create_field ( TABLE table,
const Create_field field 
)

Function returns string representing column type by Create_field.

This is required for the IS implementation which uses views on DD

This is required for the IS implementation which uses views on DD tables

Parameters
[in]tableTABLE object.
[in]fieldColumn information.
Returns
dd::String_type representing column type.

◆ get_sql_type_by_field_info()

String_type dd::get_sql_type_by_field_info ( THD thd,
enum_field_types  field_type,
uint32  field_length,
uint32  decimals,
bool  maybe_null,
bool  is_unsigned,
const CHARSET_INFO field_charset 
)

Function returns string representing column type by ST_FIELD_INFO.

Function prepares string representing columns data type.

This is required for the IS implementation which uses views on DD tables

Parameters
[in]thdThe thread handle.
[in]field_typeColumn type.
[in]field_lengthColumn length.
[in]decimalsDecimals.
[in]maybe_nullColumn is null.
[in]is_unsignedColumn is unsigned.
[in]field_charsetColumn charset.
Returns
dd::String_type representing column type.

This is required for IS implementation which uses views on DD tables

◆ get_tablespace_name() [1/2]

template<typename T >
bool dd::get_tablespace_name ( THD thd,
const T *  obj,
const char **  tablespace_name,
MEM_ROOT mem_root 
)

Read tablespace name of a tablespace_id.

Parameters
thd- Thread invoking this call.
obj- Table/Partition object whose tablespace name is being read.
tablespace_name(OUT) - Tablespace name of table.
mem_root- Memroot where tablespace name should be stored.
Returns
true - On failure.
false - On success.

◆ get_tablespace_name() [2/2]

template<typename T >
bool dd::get_tablespace_name ( THD thd,
const T *  obj,
String_type name 
)

Read tablespace name of a tablespace_id from Table or similar object.

Parameters
thdThread invoking this call.
objTable/Partition/Index/.. object whose tablespace name is being read.
[out]nameTablespace name.
Returns
true - On failure.
false - On success.

◆ getprop() [1/2]

bool dd::getprop ( THD thd,
const char *  key,
String_type value,
bool  silent = false,
loglevel  level = ERROR_LEVEL 
)

◆ getprop() [2/2]

bool dd::getprop ( THD thd,
const char *  key,
uint *  value,
bool  silent = false,
loglevel  level = ERROR_LEVEL 
)

◆ has_exclusive_table_mdl()

bool dd::has_exclusive_table_mdl ( THD thd,
const char *  schema_name,
const char *  table_name 
)

Predicate to check if we have an exclusive meta data lock on the submitted schema qualified table name.

Parameters
thdThread context.
schema_nameSchema name.
table_nameTable name.
Return values
trueThe thread context has a lock.
falseThe thread context does not have a lock.

◆ has_exclusive_tablespace_mdl()

bool dd::has_exclusive_tablespace_mdl ( THD thd,
const char *  tablespace_name 
)

Predicate to check if we have an exclusive meta data lock on the submitted tablespace name.

Parameters
thdThread context.
tablespace_nameTablespace name.
Return values
trueThe thread context has a lock.
falseThe thread context does not have a lock.

◆ has_primary_key()

bool dd::has_primary_key ( const Table t)

Predicate which indicates if the table has real (non-hidden) primary key.

Parameters
ttable to check
Returns
true if a non-hidden index has type dd::Index::IT_PRIMARY

◆ has_shared_table_mdl()

bool dd::has_shared_table_mdl ( THD thd,
const char *  schema_name,
const char *  table_name 
)

Predicate to check if we have a shared meta data lock on the submitted schema qualified table name.

Parameters
thdThread context.
schema_nameSchema name.
table_nameTable name.
Return values
trueThe thread context has a lock.
falseThe thread context does not have a lock.

◆ has_shared_tablespace_mdl()

bool dd::has_shared_tablespace_mdl ( THD thd,
const char *  tablespace_name 
)

Predicate to check if we have a shared meta data lock on the submitted tablespace name.

Parameters
thdThread context.
tablespace_nameTablespace name.
Return values
trueThe thread context has a lock.
falseThe thread context does not have a lock.

◆ init()

bool dd::init ( enum_dd_init_type  dd_init)

Initialize data dictionary upon server startup, server startup on old data directory or install data dictionary for the first time.

Parameters
dd_init- Option for initialization, population or deletion of data dictionary.
Returns
false - On success
true - On error

◆ initialize_dd_properties()

bool dd::initialize_dd_properties ( THD thd)

During –initialize, we create the dd_properties table.

During restart, create its meta data, and use it to open and read its contents.

Parameters
thdThread context.

◆ invalid_tablespace_usage()

bool dd::invalid_tablespace_usage ( THD thd,
const dd::String_type schema_name,
const dd::String_type table_name,
const HA_CREATE_INFO create_info 
)

Checking if the table is being created in a restricted tablespace.

Parameters
thdThread context.
schema_nameName of the schema where the table is located.
table_nameName of the table.
create_infoTable options, e.g. the tablespace name.
Return values
trueInvalid usage (error has been reported).
falseSuccess, no invalid usage.

◆ is_candidate_primary_key()

static bool dd::is_candidate_primary_key ( THD thd,
const KEY key,
const List< Create_field > &  create_fields 
)
static

◆ is_checked_for_upgrade()

bool dd::is_checked_for_upgrade ( const Table t)
inline

◆ is_encrypted() [1/2]

bool dd::is_encrypted ( const LEX_STRING type)
inline

◆ is_encrypted() [2/2]

bool dd::is_encrypted ( const String_type type)
inline

◆ is_foreign_key_name_locked()

static bool dd::is_foreign_key_name_locked ( THD thd,
const char *  db,
const char *  fk_name 
)
static

◆ is_general_tablespace_and_encrypted()

template<typename KEY >
bool dd::is_general_tablespace_and_encrypted ( const KEY  k,
THD thd,
bool *  is_encrypted_tablespace,
bool *  is_general_tablespace 
)

◆ is_generated_check_constraint_name()

bool dd::is_generated_check_constraint_name ( const char *  table_name,
size_t  table_name_length,
const char *  cc_name,
size_t  cc_name_length 
)

Check if name of check constraint is generated one.

Parameters
table_nameTable name.
table_name_lengthTable name length.
cc_nameCheck constraint name.
cc_name_lengthCheck constraint name length.
Return values
trueIf check constraint name is generated one.
falseOtherwise.

◆ is_generated_foreign_key_name()

bool dd::is_generated_foreign_key_name ( const char *  table_name,
size_t  table_name_length,
handlerton hton,
const dd::Foreign_key fk 
)

Check if foreign key name is generated one.

Parameters
table_nameTable name.
table_name_lengthTable name length.
htonTable storage engine.
fkForeign key to be checked.
Note
We assume that the name is generated if it starts with (table name)(SE-specific or default foreign key name suffix) (e.g. "_ibfk_" for InnoDB or "_fk_" for NDB).
Returns
true if name is generated, false otherwise.

◆ is_non_inert_dd_or_ddse_table()

bool dd::is_non_inert_dd_or_ddse_table ( System_tables::Types  table_type)

Predicate to check if a table type is a non-inert DD or a DDSE table.

Parameters
table_typeType as defined in the System_tables registry.
Returns
true if the table is a non-inert DD or DDSE table, false otherwise

◆ is_server_ps_table_name()

bool dd::is_server_ps_table_name ( const dd::String_type schema_name,
const dd::String_type table_name 
)

◆ is_string_in_lowercase()

bool dd::is_string_in_lowercase ( const String_type str,
const CHARSET_INFO cs 
)

Method to verify if string is in lowercase.

Parameters
strString to verify.
csCharacter set.
Return values
trueIf string is in lowercase.
falseOtherwise.

◆ is_tablespace_encrypted() [1/2]

Encrypt_result dd::is_tablespace_encrypted ( THD thd,
const HA_CREATE_INFO ci,
bool *  is_general_tablespace 
)

Predicate to determine if a table resides in an encrypted tablespace and if it a general tablespace.

Parameters
[in]thdThread
[in]ciHA_CREATE_INFO * Representing table DDL.
[out]is_general_tablespaceMarked as true on success if its general tablespace.
Returns
{true, *} in case of errors
{false, true} if at least one tablespace is encrypted
{false, false} if no tablespace is encrypted

◆ is_tablespace_encrypted() [2/2]

Encrypt_result dd::is_tablespace_encrypted ( THD thd,
const Table t,
bool *  is_general_tablespace 
)

Predicate to determine if a table resides in an encrypted tablespace.

First checks if the option "encrypt_type" is set on the table itself (implicit tablespace), then proceeds to acquire and check the "ecryption" option in table's tablespaces.

Parameters
[in]thdthread context
[in]ttable to check
[out]is_general_tablespaceDenotes if we found general tablespace.
Returns
{true, *} in case of errors
{false, true} if at least one tablespace is encrypted
{false, false} if no tablespace is encrypted

◆ is_valid_cpu_mask_str()

static bool dd::is_valid_cpu_mask_str ( const String_type str)
inlinestatic

Check if the string contain characters of 0 and 1.

Returns
true if characters of string are either 0 or 1 else false.

◆ item_compare()

template<typename T >
static bool dd::item_compare ( const T *  a,
const T *  b 
)
static

◆ load_triggers()

bool dd::load_triggers ( THD thd,
MEM_ROOT mem_root,
const char *  schema_name,
const char *  table_name,
const dd::Table table,
List<::Trigger > *  triggers 
)

Load table triggers from the data dictionary.

Parameters
[in]thdthread handle
[in]mem_rootMEM_ROOT for memory allocation
[in]schema_namename of schema
[in]table_namesubject table name
[in]tabletable object
[out]triggerspointer to the list where new Trigger objects will be inserted
Returns
Operation status
Return values
trueFailure
falseSuccess

◆ lookup_schema_name()

const String_type & dd::lookup_schema_name ( Sdi_wcontext wctx)

Returns const reference to string holding schema name to use in SDI.

Parameters
wctxopaque context.
Returns
schema name to use.

◆ lookup_schema_ref()

bool dd::lookup_schema_ref ( Sdi_rcontext rctx,
const String_type name,
Object_id idp 
)

Return the the Object_id of a schema name in the current data dictionary.

Used to recreate a reference to a schema during deserialization.

Parameters
rctxopaque context.
nameschema name used as reference.
idp[OUT] pointer to Object_id variable where result is stored.
Returns
MySQL error handling.

◆ lookup_tablespace_name()

const dd::String_type & dd::lookup_tablespace_name ( Sdi_wcontext wctx,
dd::Object_id  id 
)

Look up the tablespace name for a tablespace id.

Returns a reference to the name string inside an acquired tablespace object. The lifetime of these tablespace objects are managed by the Auto_releaser in the scope where the dd store is initiated.

Parameters
wctxopaque context
idtablespace id to look up
Returns
tablespace name ref

◆ lookup_tablespace_ref()

bool dd::lookup_tablespace_ref ( Sdi_rcontext rctx,
const String_type name,
Object_id idp 
)

Return the the Object_id of a tablespace name in the current data dictionary.

Used to recreate a reference to a tablespace during deserialization.

Parameters
rctxopaque context.
nameschema name used as reference.
idp[OUT] pointer to Object_id variable where result is stored.
Returns
MySQL error handling.

◆ make_string_type()

template<typename LEX_STRING_TYPE >
String_type dd::make_string_type ( const LEX_STRING_TYPE &  lst)

◆ mdl_lock_schema()

bool dd::mdl_lock_schema ( THD thd,
const char *  schema_name,
enum_mdl_duration  duration,
MDL_ticket **  ticket = nullptr 
)

Acquire MDL on schema name.

Parameters
thdThread context.
schema_nameSchema to check for.
durationDuration type for MDL
ticketWhere to store ticket pointer (default: nullptr, no ticket pointer will be stored)
Returns
false if success, true if error.

◆ mdl_req()

MDL_request * dd::mdl_req ( THD thd,
const Tablespace_table_ref tref,
enum enum_mdl_type  mdl_type 
)

Create am MDL_request for a the table identified by a Tablespace_table_ref.

Parameters
thdthread context
treftable to create request for
mdl_typeThe lock type requested.
Return values
MDL_request(allocated on thd->memroot)

◆ mdl_schema_req()

MDL_request * dd::mdl_schema_req ( THD thd,
const dd::String_type schema_name 
)

Create am MDL_request for a the schema name provided.

Parameters
thdthread context
schema_nameon which to create request for
Return values
MDL_request(allocated on thd->memroot)

◆ my_time_t_to_ull_datetime()

ulonglong dd::my_time_t_to_ull_datetime ( my_time_t  seconds_since_epoch)

Convert seconds since epoch, to a datetime ulonglong using my_tz_OFFSET0 suitable for timestamp fields in the DD.

Parameters
seconds_since_epochvalue to convert
Returns
time value converted to datetime ulonglong

◆ normalize_string()

size_t dd::normalize_string ( const CHARSET_INFO cs,
const String_type src,
char *  normalized_str_buf,
size_t  normalized_str_buf_length 
)

Normalize (or transform) the multibyte character set string.

The normalized string contains the weight of the each character of the source string. The normalized strings are suitable for the comparisons (strings yields the correct collation order).

Parameters
csCharacter set.
srcSource string.
[out]normalized_str_bufBuffer to store the normalized string.
normalized_str_buf_lengthSize of the normalized_str_buf.
Returns
length of the normalized string. 0 is returned if buffer length is insufficient to store the normalized string.

◆ now_with_opt_decimals()

static dd::String_type dd::now_with_opt_decimals ( uint  decimals)
static

◆ operator<()

bool dd::operator< ( const Tablespace_table_ref a,
const Tablespace_table_ref b 
)

◆ operator==()

bool dd::operator== ( const Tablespace_table_ref a,
const Tablespace_table_ref b 
)

◆ parse_properties()

Properties * dd::parse_properties ( const String_type str)

Factory function for creating a Property object from String_type.

Parameters
strstring representation of properties

◆ prefix_key_partition_exists()

bool dd::prefix_key_partition_exists ( const char *  schema_name,
const char *  orig_table_name,
const Table table,
const bool  is_upgrade 
)

Check and give error if table uses prefix keys in the partitioning function.

Parameters
schema_nameSchema name
orig_table_nameOriginal table name (required in case of ALTER TABLE, since temporary table name is created)
tabledd::Table instance
is_upgradeTrue if this is called during upgrade. Error will be sent to error log instead of the client.
Returns
true - On failure
false - On success

◆ prepare_default_value_string()

static void dd::prepare_default_value_string ( uchar buf,
TABLE table,
const Create_field field,
dd::Column col_obj,
String def_value 
)
static

Helper method to get default value of column in the string format.

The default value prepared from this methods is stored in the columns.default_value_utf8. This information is mostly used by the I_S queries only. For others, default value can be obtained from the columns.default_values.

Parameters
[in]bufDefault value buffer.
[in]tableTable object.
[in]fieldField information.
[in]col_objDD column object for the field.
[out]def_valueDefault value is stored in the string format if non-NULL default value is specified for the column. Empty string is stored if no default value is specified for the column. def_value is not set if default value for the column is nullptr.

◆ read_view()

bool dd::read_view ( Table_ref view,
const dd::View view_obj,
MEM_ROOT mem_root 
)

Read view metadata from dd.views into Table_ref.

◆ recreate_table()

bool dd::recreate_table ( THD thd,
const char *  schema_name,
const char *  table_name 
)

Regenerate a metadata locked table.

This function does not set error codes beyond what is set by the functions it calls.

Precondition
There must be an exclusive MDL lock on the table.
Parameters
[in]thdThread context
[in]schema_nameName of the schema
[in]table_nameName of the table
Return values
falseSuccess
trueError

◆ release_mdl()

void dd::release_mdl ( THD thd,
MDL_ticket mdl_ticket 
)

Release MDL_EXPLICIT lock held by a ticket.

Parameters
thd- THD to which lock belongs to.
mdl_ticket- Lock ticket.

◆ rename_check_constraints()

bool dd::rename_check_constraints ( const char *  old_table_name,
dd::Table new_tab 
)

Rename generated check constraint names to match the new name of the table.

Parameters
old_table_nameTable name before rename.
new_tabNew version of the table with new name set.
Returns
true if error, false otherwise.

◆ rename_foreign_keys()

bool dd::rename_foreign_keys ( THD thd,
const char *  old_db,
const char *  old_table_name,
handlerton hton,
const char *  new_db,
dd::Table new_tab 
)

Rename foreign keys which have generated names to match the new name of the table.

Parameters
thdThread context.
old_dbTable's database before rename.
old_table_nameTable name before rename.
htonTable's storage engine.
new_dbTable's database after rename.
new_tabNew version of the table with new name set.
Returns
true if error, false otherwise.

◆ rename_tablespace_mdl_hook()

void dd::rename_tablespace_mdl_hook ( THD thd,
MDL_ticket src,
MDL_ticket dst 
)

Implicit tablespaces are renamed inside SE.

But it is necessary to inform the server layer about the rename, specifically which MDLs have been taken, so that it can perform the necessary adjustment of MDLs when running in LOCK TABLES mode.

Parameters
thdthread context
srcticket for old name
dstticket for new name

◆ report_error_as_tablespace_missing() [1/2]

void dd::report_error_as_tablespace_missing ( const String_type  name)
inline

◆ report_error_as_tablespace_missing() [2/2]

void dd::report_error_as_tablespace_missing ( Object_id  id)
inline

◆ reset_tables_and_tablespaces()

bool dd::reset_tables_and_tablespaces ( )

Reset the tables and tablespace partitions in the DD cache, and invalidate the entries in the DDSE cache.

Note
This is a temporary workaround to support proper recovery after ha_recover().
Returns
false on success, otherwise true.

◆ resource_group_exists()

bool dd::resource_group_exists ( dd::cache::Dictionary_client dd_client,
const String_type resource_group_name,
bool *  exists 
)

Check if resource group exists in the data dictionary.

Parameters
dd_clientDictionary client.
resource_group_nameName of the resource group.
[out]existsValue set to true if DD object found else false.
Return values
trueFailure (error has been reported).
falseSuccess.

◆ schema_exists()

bool dd::schema_exists ( THD thd,
const char *  schema_name,
bool *  exists 
)

Check if given schema exists.

Parameters
thdThread context.
schema_nameSchema to check for.
[out]existstrue if schema exists, else false.
Returns
false if success, true if error.

◆ set_event_attributes()

static void dd::set_event_attributes ( THD thd,
const dd::Schema schema,
Event event,
const String_type event_name,
const String_type event_body,
const String_type event_body_utf8,
const LEX_USER definer,
Event_parse_data event_data,
bool  is_update 
)
static

Set Event attributes.

Parameters
thdTHD context.
schemaSchema containing the event.
eventPointer to Event Object.
event_nameEvent name.
event_bodyEvent body.
event_body_utf8Event body utf8.
definerDefiner of event.
event_dataParsed Event Data.
is_updatetrue if existing Event objects attributes set else false.

◆ set_partition_options()

static void dd::set_partition_options ( partition_element part_elem,
dd::Properties part_options 
)
static

Helper function to set partition options.

◆ set_resource_group_attributes()

static bool dd::set_resource_group_attributes ( dd::Resource_group resource_group,
const resourcegroups::Resource_group res_grp_ref 
)
static

◆ setprop() [1/2]

bool dd::setprop ( THD thd,
const char *  key,
const String_type value,
bool  silent = false 
)

◆ setprop() [2/2]

bool dd::setprop ( THD thd,
const char *  key,
const uint  value,
bool  silent = false 
)

◆ shutdown()

bool dd::shutdown ( )

Shuts down the data dictionary instance by deleting the instance of dd::Dictionary_impl* upon server shutdown.

Returns
false - On success
true - If invoked when data dictionary instance is not yet initialized.

◆ store_predefined_tablespace_metadata()

void dd::store_predefined_tablespace_metadata ( THD thd)

This function creates the meta data of the predefined tablespaces.

Parameters
thdThread context.

◆ sync_meta_data()

bool dd::sync_meta_data ( THD thd)

Acquire the DD schema, tablespace and table objects.

Read the persisted objects from the DD tables, and replace the contents of the core registry in the storage adapter

Parameters
thdThread context.

◆ table_exists()

bool dd::table_exists ( dd::cache::Dictionary_client client,
const char *  schema_name,
const char *  name,
bool *  exists 
)

Check if a table or view exists.

table_exists() sets exists=true if such a table or a view exists.

Parameters
clientThe dictionary client.
schema_nameThe schema in which the object should be defined.
nameThe object name to search for.
[out]existsA boolean which is set to true if the object is found.
Return values
trueFailure (error has been reported).
falseSuccess.

◆ table_has_triggers()

bool dd::table_has_triggers ( THD thd,
const char *  schema_name,
const char *  table_name,
bool *  table_has_trigger 
)

Check in the data dictionary if there is any trigger associated with a table.

Parameters
[in]thdthread handle
[in]schema_namename of schema
[in]table_namesubject table name
[out]table_has_triggertrue in case there is trigger(s) for a table, else false
Returns
Operation status
Return values
trueFailure
falseSuccess

◆ table_legacy_db_type()

bool dd::table_legacy_db_type ( THD thd,
const char *  schema_name,
const char *  table_name,
enum legacy_db_type db_type 
)

Get the legacy db type from the options of the given table.

This function does not set error codes beyond what is set by the functions it calls.

Parameters
[in]thdThread context
[in]schema_nameName of the schema
[in]table_nameName of the table
[out]db_typeValue of the legacy db type option
Return values
trueError, e.g. name is not a table, or no legacy_db_type in the table's options. In this case, the value of db_type is undefined.
falseSuccess

◆ table_storage_engine()

template<typename T >
bool dd::table_storage_engine ( THD thd,
const T *  obj,
handlerton **  hton 
)

Get the storage engine handlerton for the given table or tablespace.

This function sets explicit error codes if:

  • The SE is invalid: ER_UNKNOWN_STORAGE_ENGINE
Parameters
[in]thdThread context
[in]objdd::Table or a dd::Tablespace object.
[out]htonHandlerton for the table's storage engine
Return values
trueError
falseSuccess

◆ table_storage_engine< dd::Table >()

template bool dd::table_storage_engine< dd::Table > ( THD ,
const dd::Table ,
handlerton **   
)

◆ table_storage_engine< dd::Tablespace >()

template bool dd::table_storage_engine< dd::Tablespace > ( THD ,
const dd::Tablespace ,
handlerton **   
)

◆ track_object() [1/2]

void dd::track_object ( Sdi_rcontext rctx,
Column column_object 
)

Register Column objects being deserialized so that it will be possible to resolve references to it after deserialization has finished.

Parameters
rctxopaque context
column_objectobject which may be referenced by other objects.

◆ track_object() [2/2]

void dd::track_object ( Sdi_rcontext rctx,
Index index_object 
)

Register Index objects being deserialized so that it will be possible to resolve references to it after deserialization has finished.

Parameters
rctxopaque context
index_objectobject which may be referenced by other objects.

◆ unescape()

bool dd::unescape ( String_type dest)

In place unescaping of String_type.

Escapable characters are '\', '=' and ';'. Escape character is '\'. Iterate over all characters, remove escape character if it precedes an escapable character.

Parameters
[in,out]destsource and destination string for escaping
Returns
Operation status
Return values
trueif an escapable character is not escaped
falseif success

◆ update_event()

bool dd::update_event ( THD thd,
Event event,
const dd::Schema schema,
const dd::Schema new_schema,
const String_type new_event_name,
const String_type new_event_body,
const String_type new_event_body_utf8,
const LEX_USER definer,
Event_parse_data event_data 
)

Create or update a event object and commit it to DD Table Events.

Parameters
thdThread handle
eventEvent to update.
schemaSchema currently containing the event.
new_schemaNew Schema or nullptr if the schema does not change.
new_event_nameUpdated Event name.
new_event_bodyUpdated Event body.
new_event_body_utf8Updated Event body in utf8 format.
definerDefiner of the event.
event_dataEvent information obtained from parser.
Return values
trueEvent updation failed.
falseEvent updation succeeded.

◆ update_event_time_and_status()

bool dd::update_event_time_and_status ( THD thd,
Event event,
my_time_t  last_executed,
ulonglong  status 
)

Update time related fields of Event object.

Parameters
thdThread handle
eventEvent to update.
last_executedTime the event was last executed.
statusEvent status.
Return values
truetrue if update failed.
falsefalse if update succeeded.

◆ update_properties()

bool dd::update_properties ( THD thd,
const std::set< String_type > *  create_set,
const std::set< String_type > *  remove_set,
const String_type target_table_schema_name 
)

Update properties in the DD_properties table.

Note that upon failure, we will rollback, whereas upon success, commit will be delayed.

Parameters
thdThread context.
create_setA set of table names created/modified in this version of DD.
remove_setA set of table names removed in this version of DD.
target_table_schema_nameSchema name in which the final changes are required.
Returns
Upon failure, return true, otherwise false.

◆ update_resource_group()

bool dd::update_resource_group ( THD thd,
const String_type resource_grp_name,
const resourcegroups::Resource_group res_grp_ref 
)

Update a resource group and persist it to DD table resourcegroup.

Parameters
thdThread handle
resource_grp_nameName of the resource group.
res_grp_refReference to resource group.
Return values
trueUpdating Resource group failed.
falseUpdating Resource group succeeded.

◆ update_versions()

bool dd::update_versions ( THD thd)

Updates the DD Version in the DD_properties table to the current version.

This function is used during initialize and during server upgrade.

Parameters
thdThread context.
Returns
Upon failure, return true, otherwise false.

◆ update_view()

bool dd::update_view ( THD thd,
dd::View new_view,
Table_ref view 
)

Update view metadata in dd.views.

Parameters
thdThread handle.
new_viewView object that should be updated.
viewTable_ref element describing the new view.
Note
The caller must rollback both statement and transaction on failure, before any further accesses to DD. This is because such a failure might be caused by a deadlock, which requires rollback before any other operations on SE (including reads using attachable transactions) can be done.
Return values
falseOn success.
trueOn failure.

◆ update_view_status()

bool dd::update_view_status ( THD thd,
const char *  schema_name,
const char *  view_name,
bool  status,
bool  commit_dd_changes 
)

Update view status(valid/invalid) value in dd.views.options.

Parameters
thdThread handle.
schema_nameSchema name.
view_nameView name.
statusView status(valid/invalid).
commit_dd_changesIndicates whether changes to DD need to be committed.
Note
In case when commit_dd_changes is false, the caller must rollback both statement and transaction on failure, before any further accesses to DD. This is because such a failure might be caused by a deadlock, which requires rollback before any other operations on SE (including reads using attachable transactions) can be done. If case when commit_dd_changes is true this function will handle transaction rollback itself.
Return values
falseOn Success.
trueOn Failure.

◆ uses_general_tablespace()

bool dd::uses_general_tablespace ( const Table t)

Check if table uses general tablespace.

Parameters
tdd::Table instance.
Returns
true if table users general tablespace, false otherwise.

◆ visit_tablespace_id_owners() [1/2]

template<class VISITOR_TYPE >
bool dd::visit_tablespace_id_owners ( const Partition p,
VISITOR_TYPE &&  visitor 
)

Visitor function which invokes its visitor argument on any subobject which holds a tablespace, that is, the partition itself, its Partition_indexes, its sub-partitions, and Partition_indexes of those.

Visitation is terminated when the vistor closure returns true.

Parameters
ppartition to visit.
visitorgeneric closure which can be applied to all tablespace holding objects.
Returns
value of last visitor invocation.

◆ visit_tablespace_id_owners() [2/2]

template<class VISITOR_TYPE >
bool dd::visit_tablespace_id_owners ( const Table t,
VISITOR_TYPE &&  visitor 
)

Visitor function which invokes its visitor argument on any subobject which holds a tablespace, that is, the table itself, its m_indexes, its m_partitions, and m_indexes (Partition_index) of each partition and sub-partition.

Visitation is terminated when the vistor closure returns true.

Parameters
ttable to visit.
visitorgeneric closure which can be applied to all tablespace holding objects.
Returns
value of last visitor invocation.

Variable Documentation

◆ CHECK_CONSTRAINT_NAME_SUBSTR

const char dd::CHECK_CONSTRAINT_NAME_SUBSTR[] = "_chk_"
static

◆ CPU_MASK_SIZE

constexpr int dd::CPU_MASK_SIZE = 1024
staticconstexpr

◆ DD_VERSION

const uint dd::DD_VERSION = 80300
static

◆ DD_VERSION_MINOR_DOWNGRADE_THRESHOLD

const uint dd::DD_VERSION_MINOR_DOWNGRADE_THRESHOLD = DD_VERSION
static

If a new DD version is published in a MRU, that version may or may not be possible to downgrade to previous MRUs within the same GA.

From a technical perspective, we may support downgrade for some types of changes to the DD tables, such as:

i) Addition of new attributes to a predefined general purpose option-like field. ii) Addition of a column at the end of the table definition. iii) Addition of elements at the end of an enumeration column type. iv) Extension of a VARCHAR field. v) Addition of an index on a column.

This means we can support downgrade in terms of being able to open the DD tables and read from them. However, additional considerations are relevant in order to determine whether downgrade should be supported or not, e.g.:

  • For changes like i) and iii): In the older version, will invalid entries just be ignored, or will they lead to a failure?
  • For changes like iv): In the older version, are there buffer sizes that may be insufficient?

If downgrade is supported, the constant DD_VERSION_MINOR_DOWNGRADE_THRESHOLD should be set to the lowest DD_VERSION that we may downgrade to. If downgrade is not supported at all, then DD_VERSION_MINOR_DOWNGRADE_THRESHOLD should be set to DD_VERSION.

It has been decided that the default policy for MySQL 8.0 is not to allow downgrade for any minor release. One of the major reasons for this is that this would lead to a huge amount of possible upgrade/downgrade paths with correspondingly complicated and effort demanding QA. Thus, we set this constant to be equal to DD_VERSION to prohibit downgrade attempts. This decision may be relaxed for future releases.

◆ default_valid_option_keys [1/7]

const std::set<String_type> dd::default_valid_option_keys
static
Initial value:
= {
"avg_row_length",
"checksum",
"compress",
"connection_string",
"delay_key_write",
"encrypt_type",
"explicit_tablespace",
"key_block_size",
"keys_disabled",
"max_rows",
"min_rows",
"pack_keys",
"pack_record",
"plugin_version",
"row_type",
"secondary_engine",
"secondary_load",
"server_i_s_table",
"server_p_s_table",
"stats_auto_recalc",
"stats_persistent",
"stats_sample_pages",
"storage",
"tablespace",
"timestamp",
"view_valid",
"gipk"}

◆ default_valid_option_keys [2/7]

const std::set<String_type> dd::default_valid_option_keys
static
Initial value:
= {
"column_format", "geom_type", "interval_count",
"not_secondary", "storage", "treat_bit_as_char",
"is_array", "gipk" }

◆ default_valid_option_keys [3/7]

const std::set<String_type> dd::default_valid_option_keys
static
Initial value:
= {
"block_size", "flags", "parser_name",
"gipk" }

◆ default_valid_option_keys [4/7]

const std::set<String_type> dd::default_valid_option_keys = {"geom_type"}
static

◆ default_valid_option_keys [5/7]

const std::set<String_type> dd::default_valid_option_keys
static
Initial value:
= {
"data_file_name", "explicit_tablespace", "index_file_name", "max_rows",
"min_rows", "nodegroup_id", "tablespace"}

◆ default_valid_option_keys [6/7]

const std::set<String_type> dd::default_valid_option_keys = {"read_only"}
static

◆ default_valid_option_keys [7/7]

const std::set<String_type> dd::default_valid_option_keys
static
Initial value:
= {
"encryption", "autoextend_size"}

◆ failsafe_object

const char* dd::failsafe_object = "Event status option"
static

◆ FIELD_NAME_SEPARATOR_CHAR

const char dd::FIELD_NAME_SEPARATOR_CHAR = ';'
static

◆ INVALID_OBJECT_ID

const Object_id dd::INVALID_OBJECT_ID = (Object_id)-1

The default object ID which represents that the DD object is new and not persistent in dictionary tables yet.

◆ SDI_VERSION

constexpr const std::uint64_t dd::SDI_VERSION = 80019
constexpr

The version of the current SDI Json format.

This version number is stored inside SDIs. This number is bumpred only when there is a change in how the data dictionary information is converted to json (e.g. adding a forgotten member). It does not need to be bumped when the data dictionary schema structure is changed, as this is covered by the DD_VERSION variable.

The SDI version number is the MySQL server version number of the first MySQL server version that published a given SDI Json format. The format is Mmmdd with M=Major, m=minor, d=dot, so that MySQL 8.0.4 is encoded as 80004. This is the same version numbering scheme as the information schema and performance schema are using.

The next change to the SDI Json format will be associated with the next available MySQL server version number.

Historical version number published in the data dictionary, (note that 1 is a legacy number from before SDI version numbers were mapped to server versions):

1: Published in 8.0.15

Initial version.

80016: Published in 8.0.16

Changes from version 1:

  • Bug#29210646: DD::INDEX_IMPL::M_HIDDEN NOT INCLUDED IN SDI

80019: Current

Changes from version 80016:

  • Bug#30326020: SUBPARTITIONING NOT REFLECTED IN SDI

800XX: Next SDI version number after the previous is public. The next server version > current SDI version where a change to the SDI

JSON format is made.

Changes from current version:

  • No changes, this version number is not active yet.

If a new SDI version is published in a MRU, it will not be possible to import this version into previous MRUs within the same GA.

◆ SERVER_DOWNGRADE_THRESHOLD

constexpr uint dd::SERVER_DOWNGRADE_THRESHOLD = 0
constexpr

A new release model supporting Long Term Stability (LTS) and innovation releases is being introduced.

The LTS releases will be kept as stable as possible, patch updates will be provided mostly for critical issues. Innovation releases will be released regularly with new features.

When we start a new major version, e.g. 9.0.0, this is an innovation release. Each consecutive release is a new innovation release where the minor version number is incremented. The last minor version for a given major version is an LTS release, this will normally have minor version 7, e.g. 9.7.0. The LTS release will have regular CPU releases (critical patch update) where the major and minor versions stay unchanged, and only the patch number is incremented (e.g. 9.7.1, 9.7.2 etc.). In parallel with the CPU releases, a new major version will also be released, starting with an incremented major version number (e.g. 10.0.0). In some cases, the innovation releases may also have CPU releases, e.g. 9.1.0, 9.1.1 etc.

With the release model supporting LTS releases, we will have to support downgrade between patch releases. Normally, there will be no changes in features in a patch release, and the disk image should have a similar format, both in terms of record layout, data dictionary structure, system table definitions, information schema, performance schema, etc. However, there might be situations where changes that are not backwards compatible need to be made within a patch release. For some server artifacts, we already have mechanisms in place to allow older versions to reject a downgrade attempt (e.g. if the data dictionary is changed, the older version will reject the downgrade attempt). For other artifacts, there is no such mechanism. Thus, we introduce the SERVER_DOWNGRADE_THRESHOLD which makes it possible to define how far back the current version should be able to downgrade. On a downgrade attempt, the target version will look at the threshold which has been stored persistently by the actual server that we downgrade from. If the target server version is lower than the threshold, it will reject the downgrade attempt.

The threshold defaults to 0. This means that downgrade back to the first patch for the given version is possible. E.g. if LTS version 9.7.2 has the threshold defined to 0, downgrades to 9.7.1 and 9.7.0 is possible. Then, if LTS version 9.7.3 is released with the threshold set to 9.7.2, then only downgrade to 9.7.2 is possible. Downgrades to or from innovation releases are never supported, regardless of the downgrade threshold.

◆ SERVER_UPGRADE_THRESHOLD

constexpr uint dd::SERVER_UPGRADE_THRESHOLD = 0
constexpr

The new release model explained above will also open the possibility of upgrading to a version that has been released in the past.

I.e., we will upgrade from an actual version to a target version with a higher version number, but an earlier (older) GA release date.

Like for the patch downgrades mentioned above, we already have mechanisms in place to allow older versions to reject an upgrade attempt (e.g. if the data dictionary is changed, the older version will reject the upgrade attempt). For other artifacts, there is no such mechanism. Thus, we introduce the SERVER_UPGRADE_THRESHOLD which makes it possible to define how far back the current version should be able to upgrade. On an upgrade attempt, the target version will look at the threshold which has been stored persistently by the actual server that we upgrade from. If the target server version is lower than the threshold, it will reject the upgrade attempt.

The threshold defaults to 0. This means that for upgrades to any higher version is possible (unless prohibited by other rules). E.g. if LTS version 9.7.2 has the threshold defined to 0, upgrades to 10.0.0, 10.1.0 etc. is possible. Then, if LTS version 9.7.3 is released with the upgrade threshold set to 10.2.0, then upograde from 9.7.3 is possible only to 10.2.0 or higher.