MySQL 8.4.3
Source Code Documentation
handler.h File Reference
#include <fcntl.h>
#include <float.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <random>
#include <set>
#include <string>
#include <string_view>
#include <mysql/components/services/bulk_data_service.h>
#include <mysql/components/services/page_track_service.h>
#include "ft_global.h"
#include "lex_string.h"
#include "map_helpers.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_checksum.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_double2ulonglong.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "my_thread_local.h"
#include "mysql/components/services/bits/psi_table_bits.h"
#include "mysql/strings/m_ctype.h"
#include "sql/dd/object_id.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/object_table.h"
#include "sql/discrete_interval.h"
#include "sql/key.h"
#include "sql/sql_const.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "string_with_len.h"
#include "thr_lock.h"
#include "typelib.h"

Go to the source code of this file.

Classes

struct  sdi_key_t
 Key to identify a dictionary object. More...
 
struct  sdi_vector_t
 
struct  st_handler_tablename
 
class  st_alter_tablespace
 Legacy struct for passing tablespace information to SEs. More...
 
struct  Ha_clone_file
 File reference for clone. More...
 
class  Ha_clone_cbk
 
struct  Ha_fk_column_type
 Column type description for foreign key columns compatibility check. More...
 
class  Xa_state_list
 Class to maintain list of externally coordinated transactions and their current state at recovery. More...
 
struct  Clone_interface_t
 
struct  SecondaryEngineGraphSimplificationRequestParameters
 
struct  Page_track_t
 Page track interface. More...
 
struct  handlerton
 handlerton is a singleton structure - one instance per storage engine - to provide access to storage engine functionality that works on the "global" level (unlike handler class that works on a per-table basis). More...
 
struct  HA_CREATE_INFO
 Struct to hold information about the table that should be created. More...
 
struct  KEY_PAIR
 Structure describing changes to an index to be caused by ALTER TABLE. More...
 
class  inplace_alter_handler_ctx
 In-place alter handler context. More...
 
class  Alter_inplace_info
 Class describing changes to be done by ALTER TABLE. More...
 
struct  HA_CHECK_OPT
 
struct  HANDLER_BUFFER
 
struct  RANGE_SEQ_IF
 
class  Cost_estimate
 Used to store optimizer cost estimates. More...
 
class  ha_statistics
 
class  Handler_share
 Base class to be used by handlers different shares. More...
 
class  Ft_hints
 Wrapper for struct ft_hints. More...
 
class  handler
 The handler class is the interface for dynamically loadable storage engines. More...
 
class  Temp_table_handle
 
class  DsMrr_impl
 
class  ha_tablespace_statistics
 

Namespaces

namespace  dd
 The version of the current data dictionary table definitions.
 

Macros

#define HA_ADMIN_ALREADY_DONE   1
 
#define HA_ADMIN_OK   0
 
#define HA_ADMIN_NOT_IMPLEMENTED   -1
 
#define HA_ADMIN_FAILED   -2
 
#define HA_ADMIN_CORRUPT   -3
 
#define HA_ADMIN_INTERNAL_ERROR   -4
 
#define HA_ADMIN_INVALID   -5
 
#define HA_ADMIN_REJECT   -6
 
#define HA_ADMIN_TRY_ALTER   -7
 
#define HA_ADMIN_WRONG_CHECKSUM   -8
 
#define HA_ADMIN_NOT_BASE_TABLE   -9
 
#define HA_ADMIN_NEEDS_UPGRADE   -10
 
#define HA_ADMIN_NEEDS_ALTER   -11
 
#define HA_ADMIN_NEEDS_CHECK   -12
 
#define HA_ADMIN_STATS_UPD_ERR   -13
 
#define HA_ADMIN_NEEDS_DUMP_UPGRADE   -14
 User needs to dump and re-create table to fix pre 5.0 decimal types. More...
 
#define HA_NO_TRANSACTIONS   (1 << 0) /* Doesn't support transactions */
 
#define HA_PARTIAL_COLUMN_READ   (1 << 1) /* read may not return all columns */
 
#define HA_TABLE_SCAN_ON_INDEX   (1 << 2)
 
#define HA_UNUSED3   (1 << 3)
 Not in use. More...
 
#define HA_CAN_GEOMETRY   (1 << 4)
 
#define HA_FAST_KEY_READ   (1 << 5)
 
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE   (1 << 6)
 
#define HA_NULL_IN_KEY   (1 << 7)
 
#define HA_DUPLICATE_POS   (1 << 8)
 
#define HA_NO_BLOBS   (1 << 9) /* Doesn't support blobs */
 
#define HA_CAN_INDEX_BLOBS   (1 << 10)
 
#define HA_AUTO_PART_KEY   (1 << 11)
 
#define HA_REQUIRE_PRIMARY_KEY   (1 << 12)
 
#define HA_STATS_RECORDS_IS_EXACT   (1 << 13)
 
#define HA_UNUSED14   (1 << 14)
 Not in use. More...
 
#define HA_PRIMARY_KEY_IN_READ_INDEX   (1 << 15)
 
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION   (1 << 16)
 
#define HA_CAN_RTREEKEYS   (1 << 17)
 
#define HA_UNUSED18
 Not in use. More...
 
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE   (1 << 19)
 
#define HA_NO_PREFIX_CHAR_KEYS   (1 << 20)
 
#define HA_CAN_FULLTEXT   (1 << 21)
 
#define HA_CAN_SQL_HANDLER   (1 << 22)
 
#define HA_NO_AUTO_INCREMENT   (1 << 23)
 
#define HA_HAS_CHECKSUM   (1 << 24)
 
#define HA_FILE_BASED   (1 << 26)
 
#define HA_NO_VARCHAR   (1 << 27)
 
#define HA_CAN_BIT_FIELD   (1 << 28)
 
#define HA_ANY_INDEX_MAY_BE_UNIQUE   (1 << 30)
 
#define HA_NO_COPY_ON_ALTER   (1LL << 31)
 
#define HA_COUNT_ROWS_INSTANT   (1LL << 32) /* records() gives exact count*/
 
#define HA_HAS_OWN_BINLOGGING   (1LL << 33)
 
#define HA_BINLOG_ROW_CAPABLE   (1LL << 34)
 
#define HA_BINLOG_STMT_CAPABLE   (1LL << 35)
 
#define HA_DUPLICATE_KEY_NOT_IN_ORDER   (1LL << 36)
 
#define HA_CAN_REPAIR   (1LL << 37)
 
#define HA_BINLOG_FLAGS   (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
 
#define HA_READ_BEFORE_WRITE_REMOVAL   (1LL << 38)
 The handler supports read before write removal optimization. More...
 
#define HA_CAN_FULLTEXT_EXT   (1LL << 39)
 
#define HA_READ_OUT_OF_SYNC   (1LL << 40)
 
#define HA_CAN_EXPORT   (1LL << 41)
 
#define HA_BLOCK_CONST_TABLE   (1LL << 42)
 
#define HA_CAN_FULLTEXT_HINTS   (1LL << 43)
 
#define HA_NO_READ_LOCAL_LOCK   (1LL << 44)
 Storage engine doesn't support LOCK TABLE ... READ LOCAL locks but doesn't want to use handler::store_lock() API for upgrading them to LOCK TABLE ... READ locks, for example, because it doesn't use THR_LOCK locks at all. More...
 
#define HA_ATTACHABLE_TRX_COMPATIBLE   (1LL << 45)
 A storage engine is compatible with the attachable transaction requirements means that. More...
 
#define HA_GENERATED_COLUMNS   (1LL << 46)
 Handler supports Generated Columns. More...
 
#define HA_CAN_INDEX_VIRTUAL_GENERATED_COLUMN   (1LL << 47)
 Supports index on virtual generated column. More...
 
#define HA_DESCENDING_INDEX   (1LL << 48)
 Supports descending indexes. More...
 
#define HA_BLOB_PARTIAL_UPDATE   (1LL << 49)
 Supports partial update of BLOB columns. More...
 
#define HA_SUPPORTS_GEOGRAPHIC_GEOMETRY_COLUMN   (1LL << 50)
 If this isn't defined, only columns/indexes with Cartesian coordinate systems (projected SRS or SRID 0) is supported. More...
 
#define HA_SUPPORTS_DEFAULT_EXPRESSION   (1LL << 51)
 Handler supports expressions as DEFAULT for a column. More...
 
#define HA_UPDATE_NOT_SUPPORTED   (1LL << 52)
 Handlers with this flag set do not support UPDATE operations. More...
 
#define HA_DELETE_NOT_SUPPORTED   (1LL << 53)
 Handlers with this flag set do not support DELETE operations. More...
 
#define HA_NO_INDEX_ACCESS   (1LL << 54)
 The storage engine does not support using indexes for access. More...
 
#define HA_MULTI_VALUED_KEY_SUPPORT   (1LL << 55)
 Supports multi-valued index. More...
 
#define HA_READ_NEXT   1 /* TODO really use this flag */
 
#define HA_READ_PREV   2
 
#define HA_READ_ORDER   4
 
#define HA_READ_RANGE   8
 
#define HA_ONLY_WHOLE_INDEX   16
 
#define HA_TABLE_SCAN_ON_NULL   32
 
#define HA_KEYREAD_ONLY   64
 
#define HA_KEY_SCAN_NOT_ROR   128
 
#define HA_DO_INDEX_COND_PUSHDOWN   256 /* Supports Index Condition Pushdown */
 
#define HA_KEY_SWITCH_NONUNIQ   0
 
#define HA_KEY_SWITCH_ALL   1
 
#define HA_KEY_SWITCH_NONUNIQ_SAVE   2
 
#define HA_KEY_SWITCH_ALL_SAVE   3
 
#define HA_SLOT_UNDEF   ((uint)-1)
 
#define HA_OPEN_KEYFILE   1
 
#define HA_OPEN_RNDFILE   2
 
#define HA_GET_INDEX   4
 
#define HA_GET_INFO   8 /* do a handler::info() after open */
 
#define HA_READ_ONLY   16 /* File opened as readonly */
 
#define HA_TRY_READ_ONLY   32
 
#define HA_WAIT_IF_LOCKED   64 /* Wait if locked on open */
 
#define HA_ABORT_IF_LOCKED   128 /* skip if locked on open.*/
 
#define HA_BLOCK_LOCK   256 /* unlock when reading some records */
 
#define HA_OPEN_TEMPORARY   512
 
#define HA_KEY_NULL_LENGTH   1
 
#define HA_KEY_BLOB_LENGTH   2
 
#define HA_LEX_CREATE_TMP_TABLE   1
 
#define HA_LEX_CREATE_IF_NOT_EXISTS   2
 
#define HA_LEX_CREATE_TABLE_LIKE   4
 
#define HA_LEX_CREATE_INTERNAL_TMP_TABLE   8
 
#define HA_MAX_REC_LENGTH   65535U
 
#define HA_CREATE_USED_AUTO   (1L << 0)
 
#define HA_CREATE_USED_RAID   (1L << 1)
 
#define HA_CREATE_USED_UNION   (1L << 2)
 
#define HA_CREATE_USED_INSERT_METHOD   (1L << 3)
 
#define HA_CREATE_USED_MIN_ROWS   (1L << 4)
 
#define HA_CREATE_USED_MAX_ROWS   (1L << 5)
 
#define HA_CREATE_USED_AVG_ROW_LENGTH   (1L << 6)
 
#define HA_CREATE_USED_PACK_KEYS   (1L << 7)
 
#define HA_CREATE_USED_CHARSET   (1L << 8)
 
#define HA_CREATE_USED_DEFAULT_CHARSET   (1L << 9)
 
#define HA_CREATE_USED_DATADIR   (1L << 10)
 
#define HA_CREATE_USED_INDEXDIR   (1L << 11)
 
#define HA_CREATE_USED_ENGINE   (1L << 12)
 
#define HA_CREATE_USED_CHECKSUM   (1L << 13)
 
#define HA_CREATE_USED_DELAY_KEY_WRITE   (1L << 14)
 
#define HA_CREATE_USED_ROW_FORMAT   (1L << 15)
 
#define HA_CREATE_USED_COMMENT   (1L << 16)
 
#define HA_CREATE_USED_PASSWORD   (1L << 17)
 
#define HA_CREATE_USED_CONNECTION   (1L << 18)
 
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
 
#define HA_CREATE_USED_TRANSACTIONAL   (1L << 20)
 Unused. More...
 
#define HA_CREATE_USED_PAGE_CHECKSUM   (1L << 21)
 Unused. More...
 
#define HA_CREATE_USED_STATS_PERSISTENT   (1L << 22)
 This is set whenever STATS_PERSISTENT=0|1|default has been specified in CREATE/ALTER TABLE. More...
 
#define HA_CREATE_USED_STATS_AUTO_RECALC   (1L << 23)
 This is set whenever STATS_AUTO_RECALC=0|1|default has been specified in CREATE/ALTER TABLE. More...
 
#define HA_CREATE_USED_STATS_SAMPLE_PAGES   (1L << 24)
 This is set whenever STATS_SAMPLE_PAGES=N|default has been specified in CREATE/ALTER TABLE. More...
 
#define HA_CREATE_USED_TABLESPACE   (1L << 25)
 This is set whenever a 'TABLESPACE=...' phrase is used on CREATE TABLE. More...
 
#define HA_CREATE_USED_COMPRESS   (1L << 26)
 COMPRESSION="zlib|lz4|none" used during table create. More...
 
#define HA_CREATE_USED_ENCRYPT   (1L << 27)
 ENCRYPTION="Y" used during table create. More...
 
#define HA_CREATE_USED_DEFAULT_COLLATE   (1L << 28)
 CREATE|ALTER SCHEMA|DATABASE|TABLE has an explicit COLLATE clause. More...
 
#define HA_CREATE_USED_SECONDARY_ENGINE   (1L << 29)
 SECONDARY_ENGINE used during table create. More...
 
#define HA_CREATE_USED_DEFAULT_ENCRYPTION   (1L << 30)
 CREATE|ALTER SCHEMA|DATABASE has an explicit ENCRYPTION clause. More...
 
#define MAXGTRIDSIZE   64
 
#define MAXBQUALSIZE   64
 
#define COMPATIBLE_DATA_YES   0
 
#define COMPATIBLE_DATA_NO   1
 
#define UNDEF_NODEGROUP   65535
 
#define HTON_NO_FLAGS   0
 
#define HTON_CLOSE_CURSORS_AT_COMMIT   (1 << 0)
 
#define HTON_ALTER_NOT_SUPPORTED   (1 << 1)
 
#define HTON_CAN_RECREATE   (1 << 2)
 
#define HTON_HIDDEN   (1 << 3)
 
#define HTON_NOT_USER_SELECTABLE   (1 << 5)
 
#define HTON_TEMPORARY_NOT_SUPPORTED    (1 << 6)
 
#define HTON_SUPPORT_LOG_TABLES   (1 << 7)
 
#define HTON_NO_PARTITION   (1 << 8)
 
#define HTON_NO_BINLOG_ROW_OPT   (1 << 9)
 
#define HTON_SUPPORTS_EXTENDED_KEYS   (1 << 10)
 Engine supports extended keys. More...
 
#define HTON_SUPPORTS_FOREIGN_KEYS   (1 << 11)
 
#define HTON_SUPPORTS_ATOMIC_DDL   (1 << 12)
 Engine supports atomic DDL. More...
 
#define HTON_SUPPORTS_PACKED_KEYS   (1 << 13)
 
#define HTON_IS_SECONDARY_ENGINE   (1 << 14)
 Engine is a secondary storage engine. More...
 
#define HTON_SUPPORTS_SECONDARY_ENGINE   (1 << 15)
 Engine supports secondary storage engines. More...
 
#define HTON_SUPPORTS_TABLE_ENCRYPTION   (1 << 16)
 Engine supports table or tablespace encryption . More...
 
#define HTON_SECONDARY_ENGINE_SUPPORTS_DDL   (1 << 19)
 Whether the secondary engine supports DDLs. More...
 
#define HTON_NO_TRIGGER_SUPPORT   (1 << 20)
 Whether the engine does not support triggers. More...
 
#define HTON_SUPPORTS_EXTERNAL_SOURCE   (1 << 21)
 Whether the primary engine supports external data sources. More...
 
#define HA_MRR_SINGLE_POINT   1
 
#define HA_MRR_FIXED_KEY   2
 
#define HA_MRR_NO_ASSOCIATION   4
 
#define HA_MRR_SORTED   8
 
#define HA_MRR_INDEX_ONLY   16
 
#define HA_MRR_LIMITS   32
 
#define HA_MRR_USE_DEFAULT_IMPL   64
 
#define HA_MRR_NO_NULL_ENDPOINTS   128
 
#define HA_MRR_SUPPORT_SORTED   256
 
#define make_keypart_map(N)   (((key_part_map)2 << (N)) - 1)
 
#define make_prev_keypart_map(N)   (((key_part_map)1 << (N)) - 1)
 

Typedefs

typedef struct xid_t XID
 
typedef struct st_xarecover_txn XA_recover_txn
 
using sdi_container = std::vector< sdi_key_t >
 
typedef bool(* qc_engine_callback) (THD *thd, const char *table_key, uint key_length, ulonglong *engine_data)
 
typedef bool() stat_print_fn(THD *thd, const char *type, size_t type_len, const char *file, size_t file_len, const char *status, size_t status_len)
 
using Ha_clone_flagset = std::bitset< HA_CLONE_TYPE_MAX >
 
typedef ulonglong my_xid
 
using Xid_commit_list = std::unordered_set< my_xid, std::hash< my_xid >, std::equal_to< my_xid >, Mem_root_allocator< my_xid > >
 Single occurrence set of XIDs of internally coordinated transactions found as been committed in the transaction coordinator state. More...
 
typedef int(* close_connection_t) (handlerton *hton, THD *thd)
 close_connection is only called if thd->ha_data[xxx_hton.slot] is non-zero, so even if you don't need this storage area - set it to something, so that MySQL would know this storage engine was accessed in this connection More...
 
typedef void(* kill_connection_t) (handlerton *hton, THD *thd)
 Terminate connection/statement notification. More...
 
typedef void(* pre_dd_shutdown_t) (handlerton *hton)
 Shut down all storage engine background tasks that might access the data dictionary, before the main shutdown. More...
 
typedef void(* reset_plugin_vars_t) (THD *thd)
 Some plugin session variables may require some special handling upon clean up. More...
 
typedef int(* savepoint_rollback_t) (handlerton *hton, THD *thd, void *sv)
 sv points to a storage area, that was earlier passed to the savepoint_set call More...
 
typedef int(* savepoint_set_t) (handlerton *hton, THD *thd, void *sv)
 sv points to an uninitialized storage area of requested size (see savepoint_offset description) More...
 
typedef bool(* savepoint_rollback_can_release_mdl_t) (handlerton *hton, THD *thd)
 Check if storage engine allows to release metadata locks which were acquired after the savepoint if rollback to savepoint is done. More...
 
typedef int(* savepoint_release_t) (handlerton *hton, THD *thd, void *sv)
 
typedef int(* commit_t) (handlerton *hton, THD *thd, bool all)
 'all' is true if it's a real commit, that makes persistent changes 'all' is false if it's not in fact a commit but an end of the statement that is part of the transaction. More...
 
typedef int(* rollback_t) (handlerton *hton, THD *thd, bool all)
 
typedef int(* prepare_t) (handlerton *hton, THD *thd, bool all)
 
typedef int(* recover_t) (handlerton *hton, XA_recover_txn *xid_list, uint len, MEM_ROOT *mem_root)
 
using recover_prepared_in_tc_t = int(*)(handlerton *hton, Xa_state_list &xa_list)
 Retrieves information about externally coordinated transactions for which the two-phase prepare was finished and transactions were prepared in the server TC. More...
 
using set_prepared_in_tc_t = int(*)(handlerton *hton, THD *thd)
 Instructs the storage engine to mark the externally coordinated transactions held by the THD parameters as prepared in the server TC. More...
 
typedef xa_status_code(* commit_by_xid_t) (handlerton *hton, XID *xid)
 
typedef xa_status_code(* rollback_by_xid_t) (handlerton *hton, XID *xid)
 
using set_prepared_in_tc_by_xid_t = xa_status_code(*)(handlerton *hton, XID *xid)
 Instructs the storage engine to mark the externally coordinated transactions identified by the XID parameters as prepared in the server TC. More...
 
typedef handler *(* create_t) (handlerton *hton, TABLE_SHARE *table, bool partitioned, MEM_ROOT *mem_root)
 Create handler object for the table in the storage engine. More...
 
typedef void(* drop_database_t) (handlerton *hton, char *path)
 
typedef int(* panic_t) (handlerton *hton, enum ha_panic_function flag)
 
typedef int(* start_consistent_snapshot_t) (handlerton *hton, THD *thd)
 
typedef bool(* flush_logs_t) (handlerton *hton, bool binlog_group_flush)
 Flush the log(s) of storage engine(s). More...
 
typedef bool(* show_status_t) (handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat)
 
typedef uint(* partition_flags_t) ()
 The flag values are defined in sql_partition.h. More...
 
typedef bool(* is_valid_tablespace_name_t) (ts_command_type ts_cmd, const char *tablespace_name)
 SE specific validation of the tablespace name. More...
 
typedef int(* get_tablespace_t) (THD *thd, LEX_CSTRING db_name, LEX_CSTRING table_name, LEX_CSTRING *tablespace_name)
 Get the tablespace name from the SE for the given schema and table. More...
 
typedef int(* alter_tablespace_t) (handlerton *hton, THD *thd, st_alter_tablespace *ts_info, const dd::Tablespace *old_ts_def, dd::Tablespace *new_ts_def)
 Create/drop or alter tablespace in the storage engine. More...
 
typedef const char *(* get_tablespace_filename_ext_t) ()
 SE interface for getting tablespace extension. More...
 
typedef int(* upgrade_tablespace_t) (THD *thd)
 Get the tablespace data from SE and insert it into Data dictionary. More...
 
typedef bool(* upgrade_space_version_t) (dd::Tablespace *tablespace)
 Get the tablespace data from SE and insert it into Data dictionary. More...
 
typedef int(* finish_upgrade_t) (THD *thd, bool failed_upgrade)
 Finish upgrade process inside storage engines. More...
 
typedef int(* upgrade_logs_t) (THD *thd)
 Upgrade logs after the checkpoint from where upgrade process can only roll forward. More...
 
typedef bool(* get_tablespace_type_t) (const dd::Tablespace &space, Tablespace_type *space_type)
 Get the tablespace type from the SE. More...
 
typedef bool(* get_tablespace_type_by_name_t) (const char *tablespace_name, Tablespace_type *space_type)
 Get the tablespace type given the name, from the SE. More...
 
typedef int(* fill_is_table_t) (handlerton *hton, THD *thd, Table_ref *tables, class Item *cond, enum enum_schema_tables)
 
typedef int(* binlog_func_t) (handlerton *hton, THD *thd, enum_binlog_func fn, void *arg)
 
typedef void(* binlog_log_query_t) (handlerton *hton, THD *thd, enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name)
 
typedef void(* acl_notify_t) (THD *thd, const class Acl_change_notification *notice)
 
typedef int(* discover_t) (handlerton *hton, THD *thd, const char *db, const char *name, uchar **frmblob, size_t *frmlen)
 
typedef int(* find_files_t) (handlerton *hton, THD *thd, const char *db, const char *path, const char *wild, bool dir, List< LEX_STRING > *files)
 
typedef int(* table_exists_in_engine_t) (handlerton *hton, THD *thd, const char *db, const char *name)
 
using push_to_engine_t = int(*)(THD *thd, AccessPath *query, JOIN *join)
 Let storage engine inspect the query Accesspath and pick whatever it like for being pushed down to the engine. More...
 
typedef bool(* is_supported_system_table_t) (const char *db, const char *table_name, bool is_sql_layer_system_table)
 Check if the given db.tablename is a system table for this SE. More...
 
typedef bool(* sdi_create_t) (dd::Tablespace *tablespace)
 Create SDI in a tablespace. More...
 
typedef bool(* sdi_drop_t) (dd::Tablespace *tablespace)
 Drop SDI in a tablespace. More...
 
typedef bool(* sdi_get_keys_t) (const dd::Tablespace &tablespace, sdi_vector_t &vector)
 Get the SDI keys in a tablespace into vector. More...
 
typedef bool(* sdi_get_t) (const dd::Tablespace &tablespace, const sdi_key_t *sdi_key, void *sdi, uint64 *sdi_len)
 Retrieve SDI for a given SDI key. More...
 
typedef bool(* sdi_set_t) (handlerton *hton, const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key, const void *sdi, uint64 sdi_len)
 Insert/Update SDI for a given SDI key. More...
 
typedef bool(* sdi_delete_t) (const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key)
 Delete SDI for a given SDI key. More...
 
typedef bool(* is_dict_readonly_t) ()
 Check if the DDSE is started in a way that leaves thd DD being read only. More...
 
typedef bool(* rm_tmp_tables_t) (handlerton *hton, THD *thd, List< LEX_STRING > *files)
 Drop all temporary tables which have been left from previous server run belonging to this SE. More...
 
typedef SE_cost_constants *(* get_cost_constants_t) (uint storage_category)
 Retrieve cost constants to be used for this storage engine. More...
 
typedef void(* replace_native_transaction_in_thd_t) (THD *thd, void *new_trx_arg, void **ptr_trx_arg)
 
typedef bool(* dict_init_t) (dict_init_mode_t dict_init_mode, uint version, List< const Plugin_table > *DDSE_tables, List< const Plugin_tablespace > *DDSE_tablespaces)
 Initialize the SE for being used to store the DD tables. More...
 
typedef bool(* ddse_dict_init_t) (dict_init_mode_t dict_init_mode, uint version, List< const dd::Object_table > *DDSE_tables, List< const Plugin_tablespace > *DDSE_tablespaces)
 
typedef void(* dict_register_dd_table_id_t) (dd::Object_id hard_coded_tables)
 Initialize the set of hard coded DD table ids. More...
 
typedef void(* dict_cache_reset_t) (const char *schema_name, const char *table_name)
 Invalidate an entry in the local dictionary cache. More...
 
typedef void(* dict_cache_reset_tables_and_tablespaces_t) ()
 Invalidate all table and tablespace entries in the local dictionary cache. More...
 
typedef bool(* dict_recover_t) (dict_recovery_mode_t dict_recovery_mode, uint version)
 Do recovery in the DDSE as part of initializing the data dictionary. More...
 
typedef bool(* dict_get_server_version_t) (uint *version)
 Get the server version id stored in the header of the dictionary tablespace. More...
 
typedef bool(* dict_set_server_version_t) ()
 Store the current server version number into the header of the dictionary tablespace. More...
 
typedef bool(* notify_exclusive_mdl_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, bool *victimized)
 Notify/get permission from storage engine before acquisition or after release of exclusive metadata lock on object represented by key. More...
 
typedef bool(* notify_alter_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type)
 Notify/get permission from storage engine before or after execution of ALTER TABLE operation on the table identified by the MDL key. More...
 
typedef bool(* notify_rename_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, const char *old_db_name, const char *old_table_name, const char *new_db_name, const char *new_table_name)
 Notify/get permission from storage engine before or after execution of RENAME TABLE operation on the table identified by the MDL key. More...
 
typedef bool(* notify_truncate_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type)
 Notify/get permission from storage engine before or after execution of TRUNCATE TABLE operation on the table identified by the MDL key. More...
 
typedef bool(* rotate_encryption_master_key_t) (void)
 Initiate master key rotation. More...
 
typedef bool(* redo_log_set_state_t) (THD *thd, bool enable)
 Enable or Disable SE write ahead logging. More...
 
typedef bool(* get_table_statistics_t) (const char *db_name, const char *table_name, dd::Object_id se_private_id, const dd::Properties &ts_se_private_data, const dd::Properties &tbl_se_private_data, uint flags, ha_statistics *stats)
 Retrieve ha_statistics from SE. More...
 
typedef bool(* get_index_column_cardinality_t) (const char *db_name, const char *table_name, const char *index_name, uint index_ordinal_position, uint column_ordinal_position, dd::Object_id se_private_id, ulonglong *cardinality)
 Retrieve index column cardinality from SE. More...
 
typedef bool(* get_tablespace_statistics_t) (const char *tablespace_name, const char *file_name, const dd::Properties &ts_se_private_data, ha_tablespace_statistics *stats)
 Retrieve ha_tablespace_statistics from SE. More...
 
using Clone_capability_t = void(*)(Ha_clone_flagset &flags)
 Get capability flags for clone operation. More...
 
using Clone_begin_t = int(*)(handlerton *hton, THD *thd, const uchar *&loc, uint &loc_len, uint &task_id, Ha_clone_type type, Ha_clone_mode mode)
 Begin copy from source database. More...
 
using Clone_copy_t = int(*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, Ha_clone_cbk *cbk)
 Copy data from source database in chunks via callback. More...
 
using Clone_ack_t = int(*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)
 Acknowledge data transfer to source database. More...
 
using Clone_end_t = int(*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err)
 End copy from source database. More...
 
using Clone_apply_begin_t = int(*)(handlerton *hton, THD *thd, const uchar *&loc, uint &loc_len, uint &task_id, Ha_clone_mode mode, const char *data_dir)
 Begin apply to destination database. More...
 
using Clone_apply_t = int(*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)
 Apply data to destination database in chunks via callback. More...
 
using Clone_apply_end_t = int(*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err)
 End apply to destination database. More...
 
typedef void(* post_ddl_t) (THD *thd)
 Perform post-commit/rollback cleanup after DDL statement (e.g. More...
 
typedef void(* post_recover_t) (void)
 Perform SE-specific cleanup after recovery of transactions. More...
 
typedef bool(* lock_hton_log_t) (handlerton *hton)
 Lock a handlerton (resource) log to collect log information. More...
 
typedef bool(* unlock_hton_log_t) (handlerton *hton)
 Unlock a handlerton (resource) log after collecting log information. More...
 
typedef bool(* collect_hton_log_info_t) (handlerton *hton, Json_dom *json)
 Collect a handlerton (resource) log information. More...
 
typedef bool(* check_fk_column_compat_t) (const Ha_fk_column_type *child_column_type, const Ha_fk_column_type *parent_column_type, bool check_charsets)
 Check SE considers types of child and parent columns in foreign key to be compatible. More...
 
typedef bool(* is_reserved_db_name_t) (handlerton *hton, const char *name)
 
using prepare_secondary_engine_t = bool(*)(THD *thd, LEX *lex)
 Prepare the secondary engine for executing a statement. More...
 
using optimize_secondary_engine_t = bool(*)(THD *thd, LEX *lex)
 Optimize a statement for execution on a secondary storage engine. More...
 
using compare_secondary_engine_cost_t = bool(*)(THD *thd, const JOIN &join, double optimizer_cost, bool *use_best_so_far, bool *cheaper, double *secondary_engine_cost)
 Compares the cost of two join plans in the secondary storage engine. More...
 
using secondary_engine_modify_access_path_cost_t = bool(*)(THD *thd, const JoinHypergraph &hypergraph, AccessPath *access_path)
 Evaluates the cost of executing the given access path in this secondary storage engine, and potentially modifies the cost estimates that are in the access path. More...
 
using external_engine_explain_check_t = bool(*)(THD *thd)
 Checks whether the tables used in an explain query are loaded in the secondary engine. More...
 
using get_secondary_engine_offload_or_exec_fail_reason_t = std::string_view(*)(const THD *thd)
 Looks up and returns a specific secondary engine query offload or exec failure reason as a string given a thread context (representing the query) when the offloaded query fails in the secondary storage engine. More...
 
using find_secondary_engine_offload_fail_reason_t = std::string_view(*)(THD *thd)
 Finds and returns a specific secondary engine query offload failure reason as a string given a thread context (representing the query) whenever get_secondary_engine_offload_or_exec_fail_reason_t returns an empty reason. More...
 
using set_secondary_engine_offload_fail_reason_t = bool(*)(const THD *thd, std::string_view reason)
 Sets a specific secondary engine offload failure reason for a query represented by the thread context when the offloaded query fails in the secondary storage engine. More...
 
using secondary_engine_check_optimizer_request_t = SecondaryEngineGraphSimplificationRequestParameters(*)(THD *thd, const JoinHypergraph &hypergraph, const AccessPath *access_path, int current_subgraph_pairs, int current_subgraph_pairs_limit, bool is_root_access_path, std::string *trace)
 Hook for secondary engine to evaluate the current hypergraph optimization state, and returns the state that hypergraph should transition to. More...
 
using SecondaryEngineFlags = uint64_t
 
using se_before_commit_t = void(*)(void *arg)
 
using se_after_commit_t = void(*)(void *arg)
 
using se_before_rollback_t = void(*)(void *arg)
 
using notify_after_select_t = void(*)(THD *thd, SelectExecutedIn executed_in)
 Notify plugins when a SELECT query was executed. More...
 
using notify_create_table_t = void(*)(struct HA_CREATE_INFO *create_info, const char *db, const char *table_name)
 Notify plugins when a table is created. More...
 
using secondary_engine_pre_prepare_hook_t = bool(*)(THD *thd)
 Secondary engine hook called after PRIMARY_TENTATIVELY optimization is complete, and decides if secondary engine optimization will be performed, and comparison of primary engine cost and secondary engine cost will determine which engine to use for execution. More...
 
using notify_drop_table_t = void(*)(Table_ref *tab)
 Notify plugins when a table is dropped. More...
 
using page_track_start_t = int(*)(uint64_t *start_id)
 Start page tracking. More...
 
using page_track_stop_t = int(*)(uint64_t *stop_id)
 Stop page tracking. More...
 
using page_track_purge_t = int(*)(uint64_t *purge_id)
 Purge page tracking data. More...
 
using page_track_get_page_ids_t = int(*)(Page_Track_Callback cbk_func, void *cbk_ctx, uint64_t *start_id, uint64_t *stop_id, unsigned char *buffer, size_t buffer_len)
 Fetch tracked pages. More...
 
using page_track_get_num_page_ids_t = int(*)(uint64_t *start_id, uint64_t *stop_id, uint64_t *num_pages)
 Fetch approximate number of tracked pages in the given range. More...
 
using page_track_get_status_t = void(*)(std::vector< std::pair< uint64_t, bool > > &status)
 Fetch the status of the page tracking system. More...
 
typedef void * range_seq_t
 
typedef bool Log_func(THD *, TABLE *, bool, const uchar *, const uchar *)
 

Enumerations

enum  enum_alter_inplace_result {
  HA_ALTER_ERROR , HA_ALTER_INPLACE_NOT_SUPPORTED , HA_ALTER_INPLACE_EXCLUSIVE_LOCK , HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE ,
  HA_ALTER_INPLACE_SHARED_LOCK , HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE , HA_ALTER_INPLACE_NO_LOCK , HA_ALTER_INPLACE_INSTANT
}
 Return values for check_if_supported_inplace_alter(). More...
 
enum class  SelectExecutedIn : bool { kPrimaryEngine , kSecondaryEngine }
 Used to identify which engine executed a SELECT query. More...
 
enum  legacy_db_type {
  DB_TYPE_UNKNOWN = 0 , DB_TYPE_DIAB_ISAM = 1 , DB_TYPE_HASH , DB_TYPE_MISAM ,
  DB_TYPE_PISAM , DB_TYPE_RMS_ISAM , DB_TYPE_HEAP , DB_TYPE_ISAM ,
  DB_TYPE_MRG_ISAM , DB_TYPE_MYISAM , DB_TYPE_MRG_MYISAM , DB_TYPE_BERKELEY_DB ,
  DB_TYPE_INNODB , DB_TYPE_GEMINI , DB_TYPE_NDBCLUSTER , DB_TYPE_EXAMPLE_DB ,
  DB_TYPE_ARCHIVE_DB , DB_TYPE_CSV_DB , DB_TYPE_FEDERATED_DB , DB_TYPE_BLACKHOLE_DB ,
  DB_TYPE_PARTITION_DB , DB_TYPE_BINLOG , DB_TYPE_SOLID , DB_TYPE_PBXT ,
  DB_TYPE_TABLE_FUNCTION , DB_TYPE_MEMCACHE , DB_TYPE_FALCON , DB_TYPE_MARIA ,
  DB_TYPE_PERFORMANCE_SCHEMA , DB_TYPE_TEMPTABLE , DB_TYPE_FIRST_DYNAMIC = 42 , DB_TYPE_DEFAULT = 127
}
 
enum  row_type : int {
  ROW_TYPE_NOT_USED = -1 , ROW_TYPE_DEFAULT , ROW_TYPE_FIXED , ROW_TYPE_DYNAMIC ,
  ROW_TYPE_COMPRESSED , ROW_TYPE_REDUNDANT , ROW_TYPE_COMPACT , ROW_TYPE_PAGED
}
 
enum  enum_binlog_func {
  BFN_RESET_LOGS = 1 , BFN_RESET_SLAVE = 2 , BFN_BINLOG_WAIT = 3 , BFN_BINLOG_END = 4 ,
  BFN_BINLOG_PURGE_FILE = 5 , BFN_BINLOG_PURGE_WAIT = 6
}
 
enum  enum_binlog_command {
  LOGCOM_CREATE_TABLE , LOGCOM_ALTER_TABLE , LOGCOM_RENAME_TABLE , LOGCOM_DROP_TABLE ,
  LOGCOM_CREATE_DB , LOGCOM_ALTER_DB , LOGCOM_DROP_DB
}
 
enum class  enum_sampling_method { SYSTEM , NONE }
 
enum  ts_command_type {
  TS_CMD_NOT_DEFINED = -1 , CREATE_TABLESPACE = 0 , ALTER_TABLESPACE = 1 , CREATE_LOGFILE_GROUP = 2 ,
  ALTER_LOGFILE_GROUP = 3 , DROP_TABLESPACE = 4 , DROP_LOGFILE_GROUP = 5 , CHANGE_FILE_TABLESPACE = 6 ,
  ALTER_ACCESS_MODE_TABLESPACE = 7 , CREATE_UNDO_TABLESPACE = 8 , ALTER_UNDO_TABLESPACE = 9 , DROP_UNDO_TABLESPACE = 10
}
 
enum  ts_alter_tablespace_type {
  TS_ALTER_TABLESPACE_TYPE_NOT_DEFINED = -1 , ALTER_TABLESPACE_ADD_FILE = 1 , ALTER_TABLESPACE_DROP_FILE = 2 , ALTER_TABLESPACE_RENAME = 3 ,
  ALTER_TABLESPACE_OPTIONS = 4 , ALTER_UNDO_TABLESPACE_SET_ACTIVE = 5 , ALTER_UNDO_TABLESPACE_SET_INACTIVE = 6
}
 
enum  enum_schema_tables : int {
  SCH_FIRST = 0 , SCH_COLUMN_PRIVILEGES = SCH_FIRST , SCH_ENGINES , SCH_OPEN_TABLES ,
  SCH_OPTIMIZER_TRACE , SCH_PLUGINS , SCH_PROCESSLIST , SCH_PROFILES ,
  SCH_SCHEMA_PRIVILEGES , SCH_TABLE_PRIVILEGES , SCH_USER_PRIVILEGES , SCH_TMP_TABLE_COLUMNS ,
  SCH_TMP_TABLE_KEYS , SCH_LAST = SCH_TMP_TABLE_KEYS
}
 
enum  ha_stat_type { HA_ENGINE_STATUS , HA_ENGINE_LOGS , HA_ENGINE_MUTEX }
 
enum  ha_notification_type : int { HA_NOTIFY_PRE_EVENT , HA_NOTIFY_POST_EVENT }
 
enum  ha_ddl_type : int { HA_INVALID_DDL , HA_ALTER_DDL , HA_TRUNCATE_DDL , HA_RENAME_DDL }
 
enum  Ha_clone_mode {
  HA_CLONE_MODE_START , HA_CLONE_MODE_RESTART , HA_CLONE_MODE_ADD_TASK , HA_CLONE_MODE_VERSION ,
  HA_CLONE_MODE_MAX
}
 Clone start operation mode. More...
 
enum  Ha_clone_type : size_t {
  HA_CLONE_BLOCKING , HA_CLONE_REDO , HA_CLONE_PAGE , HA_CLONE_HYBRID ,
  HA_CLONE_MULTI_TASK , HA_CLONE_RESTART , HA_CLONE_TYPE_MAX
}
 Clone operation types. More...
 
enum class  enum_ha_recover_xa_state : int {
  NOT_FOUND = -1 , PREPARED_IN_SE = 0 , PREPARED_IN_TC = 1 , COMMITTED_WITH_ONEPHASE = 2 ,
  COMMITTED = 3 , ROLLEDBACK = 4
}
 Enumeration of possible states for externally coordinated transactions (XA). More...
 
enum  xa_status_code {
  XA_OK = 0 , XAER_ASYNC = -2 , XAER_RMERR = -3 , XAER_NOTA = -4 ,
  XAER_INVAL = -5 , XAER_PROTO = -6 , XAER_RMFAIL = -7 , XAER_DUPID = -8 ,
  XAER_OUTSIDE = -9
}
 X/Open XA distributed transaction status codes. More...
 
enum class  Tablespace_type {
  SPACE_TYPE_DICTIONARY , SPACE_TYPE_SYSTEM , SPACE_TYPE_UNDO , SPACE_TYPE_TEMPORARY ,
  SPACE_TYPE_SHARED , SPACE_TYPE_IMPLICIT
}
 
enum  dict_init_mode_t { DICT_INIT_CREATE_FILES , DICT_INIT_CHECK_FILES }
 Mode for initializing the data dictionary. More...
 
enum  dict_recovery_mode_t { DICT_RECOVERY_INITIALIZE_SERVER , DICT_RECOVERY_INITIALIZE_TABLESPACES , DICT_RECOVERY_RESTART_SERVER }
 Mode for data dictionary recovery. More...
 
enum class  SecondaryEngineGraphSimplificationRequest { kContinue = 0 , kRestart = 1 }
 
enum class  SecondaryEngineFlag : SecondaryEngineFlags { SUPPORTS_HASH_JOIN = 0 , SUPPORTS_NESTED_LOOP_JOIN = 1 , AGGREGATION_IS_UNORDERED = 2 , USE_EXTERNAL_EXECUTOR = 3 }
 
enum  enum_tx_isolation : int { ISO_READ_UNCOMMITTED , ISO_READ_COMMITTED , ISO_REPEATABLE_READ , ISO_SERIALIZABLE }
 
enum  enum_stats_auto_recalc : int { HA_STATS_AUTO_RECALC_DEFAULT = 0 , HA_STATS_AUTO_RECALC_ON , HA_STATS_AUTO_RECALC_OFF }
 

Functions

st_plugin_inthton2plugin (uint slot)
 Maps from slot to plugin. May return NULL if plugin has been unloaded. More...
 
size_t num_hton2plugins ()
 Returns the size of the array holding pointers to plugins. More...
 
st_plugin_intinsert_hton2plugin (uint slot, st_plugin_int *plugin)
 For unit testing. More...
 
st_plugin_intremove_hton2plugin (uint slot)
 
void set_externally_disabled_storage_engine_names (const char *)
 Read a comma-separated list of storage engine names. More...
 
bool ha_is_externally_disabled (const handlerton &)
 Returns true if the storage engine of the handlerton argument has been listed in the disabled_storage_engines system variable. More...
 
constexpr SecondaryEngineFlags MakeSecondaryEngineFlags ()
 Creates an empty bitmap of access path types. More...
 
template<typename... Args>
constexpr SecondaryEngineFlags MakeSecondaryEngineFlags (SecondaryEngineFlag flag1, Args... rest)
 Creates a bitmap representing a set of access path types. More...
 
const handlertonSecondaryEngineHandlerton (const THD *thd)
 Returns the handlerton of the secondary engine that is used in the session, or nullptr if a secondary engine is not used. More...
 
bool secondary_engine_supports_ddl (const handlerton *hton)
 
bool ddl_is_atomic (const handlerton *hton)
 
void get_sweep_read_cost (TABLE *table, ha_rows nrows, bool interrupted, Cost_estimate *cost)
 Get cost of reading nrows table records in a "disk sweep". More...
 
uint calculate_key_len (TABLE *table, uint key, key_part_map keypart_map)
 Calculates length of key. More...
 
int check_table_for_old_types (const TABLE *table)
 Function identifies any old data type present in table. More...
 
handlertonha_default_handlerton (THD *thd)
 Return the default storage engine handlerton used for non-temp tables for thread. More...
 
handlertonha_default_temp_handlerton (THD *thd)
 Return the default storage engine handlerton used for explicitly created temp tables for a thread. More...
 
plugin_ref ha_resolve_by_name_raw (THD *thd, const LEX_CSTRING &name)
 Resolve handlerton plugin by name, without checking for "DEFAULT" or HTON_NOT_USER_SELECTABLE. More...
 
plugin_ref ha_resolve_by_name (THD *thd, const LEX_CSTRING *name, bool is_temp_table)
 Return the storage engine handlerton for the supplied name. More...
 
plugin_ref ha_lock_engine (THD *thd, const handlerton *hton)
 
handlertonha_resolve_by_legacy_type (THD *thd, enum legacy_db_type db_type)
 
handlerget_new_handler (TABLE_SHARE *share, bool partitioned, MEM_ROOT *alloc, handlerton *db_type)
 Create handler object for the table in the storage engine. More...
 
handlertonha_checktype (THD *thd, enum legacy_db_type database_type, bool no_substitute, bool report_error)
 Use other database handler if databasehandler is not compiled in. More...
 
bool ha_secondary_engine_supports_ddl (THD *thd, const LEX_CSTRING &secondary_engine) noexcept
 
handlertonget_default_handlerton (THD *thd, handlerton *hton)
 Get default handlerton, if handler supplied is null. More...
 
static enum legacy_db_type ha_legacy_type (const handlerton *db_type)
 
const char * ha_resolve_storage_engine_name (const handlerton *db_type)
 
static bool ha_check_storage_engine_flag (const handlerton *db_type, uint32 flag)
 
bool ha_storage_engine_is_enabled (const handlerton *db_type)
 Predicate to determine if a storage engine, represented by a handlerton*, is enabled. More...
 
int ha_init_errors (void)
 Register handler error messages for use with my_error(). More...
 
int ha_init (void)
 
void ha_end ()
 
int ha_initialize_handlerton (st_plugin_int *plugin)
 
int ha_finalize_handlerton (st_plugin_int *plugin)
 
TYPELIBha_known_exts ()
 
int ha_panic (enum ha_panic_function flag)
 
void ha_reset_plugin_vars (THD *thd)
 
void ha_close_connection (THD *thd)
 
void ha_kill_connection (THD *thd)
 
void ha_pre_dd_shutdown (void)
 Invoke handlerton::pre_dd_shutdown() on every storage engine plugin. More...
 
bool ha_flush_logs (bool binlog_group_flush=false)
 Flush the log(s) of storage engine(s). More...
 
void ha_drop_database (char *path)
 
int ha_create_table (THD *thd, const char *path, const char *db, const char *table_name, HA_CREATE_INFO *create_info, bool update_create_info, bool is_temp_table, dd::Table *table_def)
 Initiates table-file and calls appropriate database-creator. More...
 
int ha_delete_table (THD *thd, handlerton *db_type, const char *path, const char *db, const char *alias, const dd::Table *table_def, bool generate_warning)
 Delete table from the storage engine. More...
 
bool ha_check_reserved_db_name (const char *name)
 Check if the database name is reserved word used by SE. More...
 
bool ha_show_status (THD *thd, handlerton *db_type, enum ha_stat_type stat)
 
int binlog_log_row (TABLE *table, const uchar *before_record, const uchar *after_record, Log_func *log_func)
 
int ha_create_table_from_engine (THD *thd, const char *db, const char *name)
 Try to discover table from engine. More...
 
bool ha_check_if_table_exists (THD *thd, const char *db, const char *name, bool *exists)
 Try to find a table in a storage engine. More...
 
int ha_find_files (THD *thd, const char *db, const char *path, const char *wild, bool dir, List< LEX_STRING > *files)
 
int ha_table_exists_in_engine (THD *thd, const char *db, const char *name)
 
bool ha_check_if_supported_system_table (handlerton *hton, const char *db, const char *table_name)
 Check if a given table is a system table. More...
 
bool ha_rm_tmp_tables (THD *thd, List< LEX_STRING > *files)
 Ask all SEs to drop all temporary tables which have been left from previous server run. More...
 
bool default_rm_tmp_tables (handlerton *hton, THD *thd, List< LEX_STRING > *files)
 Default implementation for handlerton::rm_tmp_tables() method which simply removes all files from "files" list which have one of SE's extensions. More...
 
int ha_init_key_cache (std::string_view name, KEY_CACHE *key_cache)
 Init a key cache if it has not been initied before. More...
 
int ha_resize_key_cache (KEY_CACHE *key_cache)
 Resize key cache. More...
 
int ha_change_key_cache (KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache)
 Move all tables from one key cache to another one. More...
 
int ha_start_consistent_snapshot (THD *thd)
 
int ha_commit_trans (THD *thd, bool all, bool ignore_global_read_lock=false)
 
int ha_commit_attachable (THD *thd)
 Commit the attachable transaction in storage engines. More...
 
int ha_rollback_trans (THD *thd, bool all)
 
int ha_recover (Xid_commit_list *commit_list=nullptr, Xa_state_list *xa_state_list=nullptr)
 Stage of the recovery process where information is collected from the storage engines (SE), merged with information from the transaction coordinator (TC) and transactions states are determined and enforced. More...
 
void ha_post_recover ()
 Perform SE-specific cleanup after recovery of transactions. More...
 
int ha_commit_low (THD *thd, bool all, bool run_after_commit=true)
 Commit the sessions outstanding transaction. More...
 
int ha_prepare_low (THD *thd, bool all)
 Prepares the underlying transaction of the THD session object parameter in the storage engines that participate in the transaction. More...
 
int ha_rollback_low (THD *thd, bool all)
 
int ha_enable_transaction (THD *thd, bool on)
 Tell the storage engine that it is allowed to "disable transaction" in the handler. More...
 
int ha_rollback_to_savepoint (THD *thd, SAVEPOINT *sv)
 
bool ha_rollback_to_savepoint_can_release_mdl (THD *thd)
 Check if all storage engines used in transaction agree that after rollback to savepoint it is safe to release MDL locks acquired after savepoint creation. More...
 
int ha_savepoint (THD *thd, SAVEPOINT *sv)
 
int ha_release_savepoint (THD *thd, SAVEPOINT *sv)
 
void trans_register_ha (THD *thd, bool all, handlerton *ht, const ulonglong *trxid)
 Register a storage engine for a transaction. More...
 
int ha_reset_logs (THD *thd)
 
int ha_binlog_index_purge_file (THD *thd, const char *file)
 Inform storage engine(s) that a binary log file will be purged and any references to it should be removed. More...
 
void ha_binlog_index_purge_wait (THD *thd)
 Request the storage engine to complete any operations that were initiated by ha_binlog_index_purge_file and which need to complete before PURGE BINARY LOGS completes. More...
 
void ha_reset_slave (THD *thd)
 
void ha_binlog_log_query (THD *thd, handlerton *db_type, enum_binlog_command binlog_command, const char *query, size_t query_length, const char *db, const char *table_name)
 
void ha_acl_notify (THD *thd, class Acl_change_notification *)
 
void ha_binlog_wait (THD *thd)
 
int ha_binlog_end (THD *thd)
 
const char * get_canonical_filename (handler *file, const char *path, char *tmp_path)
 make canonical filename More...
 
const char * table_case_name (const HA_CREATE_INFO *info, const char *name)
 
void print_keydup_error (TABLE *table, KEY *key, const char *msg, myf errflag, const char *org_table_name)
 Construct and emit duplicate key error message using information from table's record buffer. More...
 
void print_keydup_error (TABLE *table, KEY *key, myf errflag, const char *org_table_name)
 Construct and emit duplicate key error message using information from table's record buffer. More...
 
void print_keydup_error (TABLE *table, KEY *key, const char *msg, myf errflag)
 
void print_keydup_error (TABLE *table, KEY *key, myf errflag)
 
bool ha_is_storage_engine_disabled (handlerton *se_engine)
 
bool ha_notify_exclusive_mdl (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, bool *victimized)
 Notify/get permission from all interested storage engines before acquisition or after release of exclusive metadata lock on object represented by key. More...
 
bool ha_notify_table_ddl (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, ha_ddl_type ddl_type, const char *old_db_name, const char *old_table_name, const char *new_db_name, const char *new_table_name)
 Notify/get permission from all interested storage engines before or after executed DDL (ALTER TABLE, RENAME TABLE, TRUNCATE TABLE) on the table identified by key. More...
 
std::pair< int, bool > commit_owned_gtids (THD *thd, bool all)
 The function computes condition to call gtid persistor wrapper, and executes it. More...
 
bool set_tx_isolation (THD *thd, enum_tx_isolation tx_isolation, bool one_shot)
 Set the transaction isolation level for the next transaction and update session tracker information about the transaction isolation level. More...
 
bool is_index_access_error (int error)
 Check whether an error is index access error or not after an index read. More...
 

Variables

constexpr const ha_rows EXTRA_RECORDS {10}
 
constexpr const uint32 SDI_TYPE_TABLE = 1
 Id for identifying Table SDIs. More...
 
constexpr const uint32 SDI_TYPE_TABLESPACE = 2
 Id for identifying Tablespace SDIs. More...
 
ulong savepoint_alloc_size
 
const char * ha_row_type []
 
const char * tx_isolation_names []
 
const char * binlog_format_names []
 
TYPELIB tx_isolation_typelib
 
ulong total_ha_2pc
 
static const uint MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT = 1
 Options for the START TRANSACTION statement. More...
 
static const uint MYSQL_START_TRANS_OPT_READ_ONLY = 2
 
static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4
 
static const uint MYSQL_START_TRANS_OPT_HIGH_PRIORITY = 8
 
constexpr const uint64_t HA_CREATE_USED_START_TRANSACTION {1ULL << 31}
 This option is used to convey that the create table should not commit the operation and keep the transaction started. More...
 
constexpr const uint64_t HA_CREATE_USED_ENGINE_ATTRIBUTE {1ULL << 32}
 
constexpr const uint64_t HA_CREATE_USED_SECONDARY_ENGINE_ATTRIBUTE {1ULL << 33}
 
constexpr const uint64_t HA_CREATE_USED_READ_ONLY {1ULL << 34}
 ALTER SCHEMA|DATABASE has an explicit READ_ONLY clause. More...
 
constexpr const uint64_t HA_CREATE_USED_AUTOEXTEND_SIZE {1ULL << 35}
 These flags convey that the options AUTOEXTEND_SIZE has been specified in the CREATE TABLE statement. More...
 
constexpr const decltype(handlerton::flagsHTON_SUPPORTS_ENGINE_ATTRIBUTE
 
constexpr const decltype(handlerton::flagsHTON_SUPPORTS_GENERATED_INVISIBLE_PK {1 << 18}
 Engine supports Generated invisible primary key. More...
 
constexpr const decltype(handlerton::flagsHTON_SUPPORTS_BULK_LOAD {1 << 22}
 
constexpr const decltype(handlerton::flagsHTON_SUPPORTS_DISTANCE_SCAN
 Engine supports index distance scan. More...
 
constexpr const decltype(handlerton::flagsHTON_NO_DEFAULT_ENGINE_SUPPORT {1 << 24}
 
static const uint32 HTON_FKS_WITH_PREFIX_PARENT_KEYS = (1 << 0)
 Engine supports both unique and non-unique parent keys for foreign keys which contain full foreign key as its prefix. More...
 
static const uint32 HTON_FKS_WITH_SUPPORTING_HASH_KEYS = (1 << 1)
 Storage engine supports hash keys as supporting keys for foreign keys. More...
 
static const uint32 HTON_FKS_WITH_ANY_PREFIX_SUPPORTING_KEYS = (1 << 2)
 Storage engine supports non-hash keys which have common prefix with the foreign key as supporting keys for it. More...
 
static const uint32 HTON_FKS_NEED_DIFFERENT_PARENT_AND_SUPPORTING_KEYS
 Storage engine does not support using the same key for both parent and supporting key, but requires the two to be different. More...
 
static const uint32 HTON_FKS_WITH_EXTENDED_PARENT_KEYS = (1 << 4)
 Engine takes into account hidden part of key (coming from primary key) when determines if it can serve as parent key for a foreign key. More...
 
static const size_t MAX_FK_NAME_SUFFIX_LENGTH = 16
 Maximum possible length of SE-specific suffixes for auto-generated foreign key names. More...
 
static const LEX_CSTRING FK_NAME_DEFAULT_SUFFIX = {STRING_WITH_LEN("_fk_")}
 Suffix for auto-generated foreign key names for tables in SE's which don't specify own suffix. More...
 

Macro Definition Documentation

◆ COMPATIBLE_DATA_NO

#define COMPATIBLE_DATA_NO   1

◆ COMPATIBLE_DATA_YES

#define COMPATIBLE_DATA_YES   0

◆ HA_ABORT_IF_LOCKED

#define HA_ABORT_IF_LOCKED   128 /* skip if locked on open.*/

◆ HA_ADMIN_ALREADY_DONE

#define HA_ADMIN_ALREADY_DONE   1

◆ HA_ADMIN_CORRUPT

#define HA_ADMIN_CORRUPT   -3

◆ HA_ADMIN_FAILED

#define HA_ADMIN_FAILED   -2

◆ HA_ADMIN_INTERNAL_ERROR

#define HA_ADMIN_INTERNAL_ERROR   -4

◆ HA_ADMIN_INVALID

#define HA_ADMIN_INVALID   -5

◆ HA_ADMIN_NEEDS_ALTER

#define HA_ADMIN_NEEDS_ALTER   -11

◆ HA_ADMIN_NEEDS_CHECK

#define HA_ADMIN_NEEDS_CHECK   -12

◆ HA_ADMIN_NEEDS_DUMP_UPGRADE

#define HA_ADMIN_NEEDS_DUMP_UPGRADE   -14

User needs to dump and re-create table to fix pre 5.0 decimal types.

◆ HA_ADMIN_NEEDS_UPGRADE

#define HA_ADMIN_NEEDS_UPGRADE   -10

◆ HA_ADMIN_NOT_BASE_TABLE

#define HA_ADMIN_NOT_BASE_TABLE   -9

◆ HA_ADMIN_NOT_IMPLEMENTED

#define HA_ADMIN_NOT_IMPLEMENTED   -1

◆ HA_ADMIN_OK

#define HA_ADMIN_OK   0

◆ HA_ADMIN_REJECT

#define HA_ADMIN_REJECT   -6

◆ HA_ADMIN_STATS_UPD_ERR

#define HA_ADMIN_STATS_UPD_ERR   -13

◆ HA_ADMIN_TRY_ALTER

#define HA_ADMIN_TRY_ALTER   -7

◆ HA_ADMIN_WRONG_CHECKSUM

#define HA_ADMIN_WRONG_CHECKSUM   -8

◆ HA_ANY_INDEX_MAY_BE_UNIQUE

#define HA_ANY_INDEX_MAY_BE_UNIQUE   (1 << 30)

◆ HA_ATTACHABLE_TRX_COMPATIBLE

#define HA_ATTACHABLE_TRX_COMPATIBLE   (1LL << 45)

A storage engine is compatible with the attachable transaction requirements means that.

  • either SE detects the fact that THD::ha_data was reset and starts a new attachable transaction, closes attachable transaction on close_connection and resumes regular (outer) transaction when THD::ha_data is restored;
  • or SE completely ignores THD::ha_data and close_connection like MyISAM does.

◆ HA_AUTO_PART_KEY

#define HA_AUTO_PART_KEY   (1 << 11)

◆ HA_BINLOG_FLAGS

#define HA_BINLOG_FLAGS   (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)

◆ HA_BINLOG_ROW_CAPABLE

#define HA_BINLOG_ROW_CAPABLE   (1LL << 34)

◆ HA_BINLOG_STMT_CAPABLE

#define HA_BINLOG_STMT_CAPABLE   (1LL << 35)

◆ HA_BLOB_PARTIAL_UPDATE

#define HA_BLOB_PARTIAL_UPDATE   (1LL << 49)

Supports partial update of BLOB columns.

◆ HA_BLOCK_CONST_TABLE

#define HA_BLOCK_CONST_TABLE   (1LL << 42)

◆ HA_BLOCK_LOCK

#define HA_BLOCK_LOCK   256 /* unlock when reading some records */

◆ HA_CAN_BIT_FIELD

#define HA_CAN_BIT_FIELD   (1 << 28)

◆ HA_CAN_EXPORT

#define HA_CAN_EXPORT   (1LL << 41)

◆ HA_CAN_FULLTEXT

#define HA_CAN_FULLTEXT   (1 << 21)

◆ HA_CAN_FULLTEXT_EXT

#define HA_CAN_FULLTEXT_EXT   (1LL << 39)

◆ HA_CAN_FULLTEXT_HINTS

#define HA_CAN_FULLTEXT_HINTS   (1LL << 43)

◆ HA_CAN_GEOMETRY

#define HA_CAN_GEOMETRY   (1 << 4)

◆ HA_CAN_INDEX_BLOBS

#define HA_CAN_INDEX_BLOBS   (1 << 10)

◆ HA_CAN_INDEX_VIRTUAL_GENERATED_COLUMN

#define HA_CAN_INDEX_VIRTUAL_GENERATED_COLUMN   (1LL << 47)

Supports index on virtual generated column.

◆ HA_CAN_REPAIR

#define HA_CAN_REPAIR   (1LL << 37)

◆ HA_CAN_RTREEKEYS

#define HA_CAN_RTREEKEYS   (1 << 17)

◆ HA_CAN_SQL_HANDLER

#define HA_CAN_SQL_HANDLER   (1 << 22)

◆ HA_COUNT_ROWS_INSTANT

#define HA_COUNT_ROWS_INSTANT   (1LL << 32) /* records() gives exact count*/

◆ HA_CREATE_USED_AUTO

#define HA_CREATE_USED_AUTO   (1L << 0)

◆ HA_CREATE_USED_AVG_ROW_LENGTH

#define HA_CREATE_USED_AVG_ROW_LENGTH   (1L << 6)

◆ HA_CREATE_USED_CHARSET

#define HA_CREATE_USED_CHARSET   (1L << 8)

◆ HA_CREATE_USED_CHECKSUM

#define HA_CREATE_USED_CHECKSUM   (1L << 13)

◆ HA_CREATE_USED_COMMENT

#define HA_CREATE_USED_COMMENT   (1L << 16)

◆ HA_CREATE_USED_COMPRESS

#define HA_CREATE_USED_COMPRESS   (1L << 26)

COMPRESSION="zlib|lz4|none" used during table create.

◆ HA_CREATE_USED_CONNECTION

#define HA_CREATE_USED_CONNECTION   (1L << 18)

◆ HA_CREATE_USED_DATADIR

#define HA_CREATE_USED_DATADIR   (1L << 10)

◆ HA_CREATE_USED_DEFAULT_CHARSET

#define HA_CREATE_USED_DEFAULT_CHARSET   (1L << 9)

◆ HA_CREATE_USED_DEFAULT_COLLATE

#define HA_CREATE_USED_DEFAULT_COLLATE   (1L << 28)

CREATE|ALTER SCHEMA|DATABASE|TABLE has an explicit COLLATE clause.

Implies HA_CREATE_USED_DEFAULT_CHARSET.

◆ HA_CREATE_USED_DEFAULT_ENCRYPTION

#define HA_CREATE_USED_DEFAULT_ENCRYPTION   (1L << 30)

CREATE|ALTER SCHEMA|DATABASE has an explicit ENCRYPTION clause.

Implies HA_CREATE_USED_DEFAULT_ENCRYPTION.

◆ HA_CREATE_USED_DELAY_KEY_WRITE

#define HA_CREATE_USED_DELAY_KEY_WRITE   (1L << 14)

◆ HA_CREATE_USED_ENCRYPT

#define HA_CREATE_USED_ENCRYPT   (1L << 27)

ENCRYPTION="Y" used during table create.

◆ HA_CREATE_USED_ENGINE

#define HA_CREATE_USED_ENGINE   (1L << 12)

◆ HA_CREATE_USED_INDEXDIR

#define HA_CREATE_USED_INDEXDIR   (1L << 11)

◆ HA_CREATE_USED_INSERT_METHOD

#define HA_CREATE_USED_INSERT_METHOD   (1L << 3)

◆ HA_CREATE_USED_KEY_BLOCK_SIZE

#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)

◆ HA_CREATE_USED_MAX_ROWS

#define HA_CREATE_USED_MAX_ROWS   (1L << 5)

◆ HA_CREATE_USED_MIN_ROWS

#define HA_CREATE_USED_MIN_ROWS   (1L << 4)

◆ HA_CREATE_USED_PACK_KEYS

#define HA_CREATE_USED_PACK_KEYS   (1L << 7)

◆ HA_CREATE_USED_PAGE_CHECKSUM

#define HA_CREATE_USED_PAGE_CHECKSUM   (1L << 21)

Unused.

Reserved for future versions.

◆ HA_CREATE_USED_PASSWORD

#define HA_CREATE_USED_PASSWORD   (1L << 17)

◆ HA_CREATE_USED_RAID

#define HA_CREATE_USED_RAID   (1L << 1)

◆ HA_CREATE_USED_ROW_FORMAT

#define HA_CREATE_USED_ROW_FORMAT   (1L << 15)

◆ HA_CREATE_USED_SECONDARY_ENGINE

#define HA_CREATE_USED_SECONDARY_ENGINE   (1L << 29)

SECONDARY_ENGINE used during table create.

◆ HA_CREATE_USED_STATS_AUTO_RECALC

#define HA_CREATE_USED_STATS_AUTO_RECALC   (1L << 23)

This is set whenever STATS_AUTO_RECALC=0|1|default has been specified in CREATE/ALTER TABLE.

See enum_stats_auto_recalc. It is possible to distinguish whether STATS_AUTO_RECALC=default has been specified or no STATS_AUTO_RECALC= is given at all.

◆ HA_CREATE_USED_STATS_PERSISTENT

#define HA_CREATE_USED_STATS_PERSISTENT   (1L << 22)

This is set whenever STATS_PERSISTENT=0|1|default has been specified in CREATE/ALTER TABLE.

See also HA_OPTION_STATS_PERSISTENT in include/my_base.h. It is possible to distinguish whether STATS_PERSISTENT=default has been specified or no STATS_PERSISTENT= is given at all.

◆ HA_CREATE_USED_STATS_SAMPLE_PAGES

#define HA_CREATE_USED_STATS_SAMPLE_PAGES   (1L << 24)

This is set whenever STATS_SAMPLE_PAGES=N|default has been specified in CREATE/ALTER TABLE.

It is possible to distinguish whether STATS_SAMPLE_PAGES=default has been specified or no STATS_SAMPLE_PAGES= is given at all.

◆ HA_CREATE_USED_TABLESPACE

#define HA_CREATE_USED_TABLESPACE   (1L << 25)

This is set whenever a 'TABLESPACE=...' phrase is used on CREATE TABLE.

◆ HA_CREATE_USED_TRANSACTIONAL

#define HA_CREATE_USED_TRANSACTIONAL   (1L << 20)

Unused.

Reserved for future versions.

◆ HA_CREATE_USED_UNION

#define HA_CREATE_USED_UNION   (1L << 2)

◆ HA_DELETE_NOT_SUPPORTED

#define HA_DELETE_NOT_SUPPORTED   (1LL << 53)

Handlers with this flag set do not support DELETE operations.

◆ HA_DESCENDING_INDEX

#define HA_DESCENDING_INDEX   (1LL << 48)

Supports descending indexes.

◆ HA_DO_INDEX_COND_PUSHDOWN

#define HA_DO_INDEX_COND_PUSHDOWN   256 /* Supports Index Condition Pushdown */

◆ HA_DUPLICATE_KEY_NOT_IN_ORDER

#define HA_DUPLICATE_KEY_NOT_IN_ORDER   (1LL << 36)

◆ HA_DUPLICATE_POS

#define HA_DUPLICATE_POS   (1 << 8)

◆ HA_FAST_KEY_READ

#define HA_FAST_KEY_READ   (1 << 5)

◆ HA_FILE_BASED

#define HA_FILE_BASED   (1 << 26)

◆ HA_GENERATED_COLUMNS

#define HA_GENERATED_COLUMNS   (1LL << 46)

Handler supports Generated Columns.

◆ HA_GET_INDEX

#define HA_GET_INDEX   4

◆ HA_GET_INFO

#define HA_GET_INFO   8 /* do a handler::info() after open */

◆ HA_HAS_CHECKSUM

#define HA_HAS_CHECKSUM   (1 << 24)

◆ HA_HAS_OWN_BINLOGGING

#define HA_HAS_OWN_BINLOGGING   (1LL << 33)

◆ HA_KEY_BLOB_LENGTH

#define HA_KEY_BLOB_LENGTH   2

◆ HA_KEY_NULL_LENGTH

#define HA_KEY_NULL_LENGTH   1

◆ HA_KEY_SCAN_NOT_ROR

#define HA_KEY_SCAN_NOT_ROR   128

◆ HA_KEY_SWITCH_ALL

#define HA_KEY_SWITCH_ALL   1

◆ HA_KEY_SWITCH_ALL_SAVE

#define HA_KEY_SWITCH_ALL_SAVE   3

◆ HA_KEY_SWITCH_NONUNIQ

#define HA_KEY_SWITCH_NONUNIQ   0

◆ HA_KEY_SWITCH_NONUNIQ_SAVE

#define HA_KEY_SWITCH_NONUNIQ_SAVE   2

◆ HA_KEYREAD_ONLY

#define HA_KEYREAD_ONLY   64

◆ HA_LEX_CREATE_IF_NOT_EXISTS

#define HA_LEX_CREATE_IF_NOT_EXISTS   2

◆ HA_LEX_CREATE_INTERNAL_TMP_TABLE

#define HA_LEX_CREATE_INTERNAL_TMP_TABLE   8

◆ HA_LEX_CREATE_TABLE_LIKE

#define HA_LEX_CREATE_TABLE_LIKE   4

◆ HA_LEX_CREATE_TMP_TABLE

#define HA_LEX_CREATE_TMP_TABLE   1

◆ HA_MAX_REC_LENGTH

#define HA_MAX_REC_LENGTH   65535U

◆ HA_MRR_FIXED_KEY

#define HA_MRR_FIXED_KEY   2

◆ HA_MRR_INDEX_ONLY

#define HA_MRR_INDEX_ONLY   16

◆ HA_MRR_LIMITS

#define HA_MRR_LIMITS   32

◆ HA_MRR_NO_ASSOCIATION

#define HA_MRR_NO_ASSOCIATION   4

◆ HA_MRR_NO_NULL_ENDPOINTS

#define HA_MRR_NO_NULL_ENDPOINTS   128

◆ HA_MRR_SINGLE_POINT

#define HA_MRR_SINGLE_POINT   1

◆ HA_MRR_SORTED

#define HA_MRR_SORTED   8

◆ HA_MRR_SUPPORT_SORTED

#define HA_MRR_SUPPORT_SORTED   256

◆ HA_MRR_USE_DEFAULT_IMPL

#define HA_MRR_USE_DEFAULT_IMPL   64

◆ HA_MULTI_VALUED_KEY_SUPPORT

#define HA_MULTI_VALUED_KEY_SUPPORT   (1LL << 55)

Supports multi-valued index.

◆ HA_NO_AUTO_INCREMENT

#define HA_NO_AUTO_INCREMENT   (1 << 23)

◆ HA_NO_BLOBS

#define HA_NO_BLOBS   (1 << 9) /* Doesn't support blobs */

◆ HA_NO_COPY_ON_ALTER

#define HA_NO_COPY_ON_ALTER   (1LL << 31)

◆ HA_NO_INDEX_ACCESS

#define HA_NO_INDEX_ACCESS   (1LL << 54)

The storage engine does not support using indexes for access.

Indexes can only be used for estimating cost.

◆ HA_NO_PREFIX_CHAR_KEYS

#define HA_NO_PREFIX_CHAR_KEYS   (1 << 20)

◆ HA_NO_READ_LOCAL_LOCK

#define HA_NO_READ_LOCAL_LOCK   (1LL << 44)

Storage engine doesn't support LOCK TABLE ... READ LOCAL locks but doesn't want to use handler::store_lock() API for upgrading them to LOCK TABLE ... READ locks, for example, because it doesn't use THR_LOCK locks at all.

◆ HA_NO_TRANSACTIONS

#define HA_NO_TRANSACTIONS   (1 << 0) /* Doesn't support transactions */

◆ HA_NO_VARCHAR

#define HA_NO_VARCHAR   (1 << 27)

◆ HA_NULL_IN_KEY

#define HA_NULL_IN_KEY   (1 << 7)

◆ HA_ONLY_WHOLE_INDEX

#define HA_ONLY_WHOLE_INDEX   16

◆ HA_OPEN_KEYFILE

#define HA_OPEN_KEYFILE   1

◆ HA_OPEN_RNDFILE

#define HA_OPEN_RNDFILE   2

◆ HA_OPEN_TEMPORARY

#define HA_OPEN_TEMPORARY   512

◆ HA_PARTIAL_COLUMN_READ

#define HA_PARTIAL_COLUMN_READ   (1 << 1) /* read may not return all columns */

◆ HA_PRIMARY_KEY_IN_READ_INDEX

#define HA_PRIMARY_KEY_IN_READ_INDEX   (1 << 15)

◆ HA_PRIMARY_KEY_REQUIRED_FOR_DELETE

#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE   (1 << 19)

◆ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION

#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION   (1 << 16)

◆ HA_READ_BEFORE_WRITE_REMOVAL

#define HA_READ_BEFORE_WRITE_REMOVAL   (1LL << 38)

The handler supports read before write removal optimization.

Read before write removal may be used for storage engines which support write without previous read of the row to be updated. Handler returning this flag must implement start_read_removal() and end_read_removal(). The handler may return "fake" rows constructed from the key of the row asked for. This is used to optimize UPDATE and DELETE by reducing the number of round-trips between handler and storage engine.

Example: UPDATE a=1 WHERE pk IN (<keys>)

mysql_update()
{
  if (<conditions for starting read removal>)
    start_read_removal()
    -> handler returns true if read removal supported for this table/query

  while(read_record("pk=<key>"))
    -> handler returns fake row with column "pk" set to <key>

    ha_update_row()
    -> handler sends write "a=1" for row with "pk=<key>"

  end_read_removal()
  -> handler returns the number of rows actually written
}
Note
This optimization in combination with batching may be used to remove even more round-trips.

◆ HA_READ_NEXT

#define HA_READ_NEXT   1 /* TODO really use this flag */

◆ HA_READ_ONLY

#define HA_READ_ONLY   16 /* File opened as readonly */

◆ HA_READ_ORDER

#define HA_READ_ORDER   4

◆ HA_READ_OUT_OF_SYNC

#define HA_READ_OUT_OF_SYNC   (1LL << 40)

◆ HA_READ_PREV

#define HA_READ_PREV   2

◆ HA_READ_RANGE

#define HA_READ_RANGE   8

◆ HA_REQUIRE_PRIMARY_KEY

#define HA_REQUIRE_PRIMARY_KEY   (1 << 12)

◆ HA_REQUIRES_KEY_COLUMNS_FOR_DELETE

#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE   (1 << 6)

◆ HA_SLOT_UNDEF

#define HA_SLOT_UNDEF   ((uint)-1)

◆ HA_STATS_RECORDS_IS_EXACT

#define HA_STATS_RECORDS_IS_EXACT   (1 << 13)

◆ HA_SUPPORTS_DEFAULT_EXPRESSION

#define HA_SUPPORTS_DEFAULT_EXPRESSION   (1LL << 51)

Handler supports expressions as DEFAULT for a column.

◆ HA_SUPPORTS_GEOGRAPHIC_GEOMETRY_COLUMN

#define HA_SUPPORTS_GEOGRAPHIC_GEOMETRY_COLUMN   (1LL << 50)

If this isn't defined, only columns/indexes with Cartesian coordinate systems (projected SRS or SRID 0) is supported.

Columns/indexes without SRID restriction is also supported if this isn't defined.

◆ HA_TABLE_SCAN_ON_INDEX

#define HA_TABLE_SCAN_ON_INDEX   (1 << 2)

◆ HA_TABLE_SCAN_ON_NULL

#define HA_TABLE_SCAN_ON_NULL   32

◆ HA_TRY_READ_ONLY

#define HA_TRY_READ_ONLY   32

◆ HA_UNUSED14

#define HA_UNUSED14   (1 << 14)

Not in use.

◆ HA_UNUSED18

#define HA_UNUSED18

Not in use.

◆ HA_UNUSED3

#define HA_UNUSED3   (1 << 3)

Not in use.

◆ HA_UPDATE_NOT_SUPPORTED

#define HA_UPDATE_NOT_SUPPORTED   (1LL << 52)

Handlers with this flag set do not support UPDATE operations.

◆ HA_WAIT_IF_LOCKED

#define HA_WAIT_IF_LOCKED   64 /* Wait if locked on open */

◆ HTON_ALTER_NOT_SUPPORTED

#define HTON_ALTER_NOT_SUPPORTED   (1 << 1)

◆ HTON_CAN_RECREATE

#define HTON_CAN_RECREATE   (1 << 2)

◆ HTON_CLOSE_CURSORS_AT_COMMIT

#define HTON_CLOSE_CURSORS_AT_COMMIT   (1 << 0)

◆ HTON_HIDDEN

#define HTON_HIDDEN   (1 << 3)

◆ HTON_IS_SECONDARY_ENGINE

#define HTON_IS_SECONDARY_ENGINE   (1 << 14)

Engine is a secondary storage engine.

◆ HTON_NO_BINLOG_ROW_OPT

#define HTON_NO_BINLOG_ROW_OPT   (1 << 9)

◆ HTON_NO_FLAGS

#define HTON_NO_FLAGS   0

◆ HTON_NO_PARTITION

#define HTON_NO_PARTITION   (1 << 8)

◆ HTON_NO_TRIGGER_SUPPORT

#define HTON_NO_TRIGGER_SUPPORT   (1 << 20)

Whether the engine does not support triggers.

◆ HTON_NOT_USER_SELECTABLE

#define HTON_NOT_USER_SELECTABLE   (1 << 5)

◆ HTON_SECONDARY_ENGINE_SUPPORTS_DDL

#define HTON_SECONDARY_ENGINE_SUPPORTS_DDL   (1 << 19)

Whether the secondary engine supports DDLs.

No meaning if the engine is not secondary.

◆ HTON_SUPPORT_LOG_TABLES

#define HTON_SUPPORT_LOG_TABLES   (1 << 7)

◆ HTON_SUPPORTS_ATOMIC_DDL

#define HTON_SUPPORTS_ATOMIC_DDL   (1 << 12)

Engine supports atomic DDL.

That is rollback of transaction for DDL statement will also rollback all changes in SE, commit of transaction of DDL statement will make it durable.

◆ HTON_SUPPORTS_EXTENDED_KEYS

#define HTON_SUPPORTS_EXTENDED_KEYS   (1 << 10)

Engine supports extended keys.

The flag allows to use 'extended key' feature if the engine is able to do it (has primary key values in the secondary key). Note that handler flag HA_PRIMARY_KEY_IN_READ_INDEX is actually partial case of HTON_SUPPORTS_EXTENDED_KEYS.

◆ HTON_SUPPORTS_EXTERNAL_SOURCE

#define HTON_SUPPORTS_EXTERNAL_SOURCE   (1 << 21)

Whether the primary engine supports external data sources.

This case refers to having tables with data in object store and the engine does not store any of those data, only metadata. Table contents can be accessed only after loading the table in the secondary storage engine. The flag is used for a primary engine only.

◆ HTON_SUPPORTS_FOREIGN_KEYS

#define HTON_SUPPORTS_FOREIGN_KEYS   (1 << 11)

◆ HTON_SUPPORTS_PACKED_KEYS

#define HTON_SUPPORTS_PACKED_KEYS   (1 << 13)

◆ HTON_SUPPORTS_SECONDARY_ENGINE

#define HTON_SUPPORTS_SECONDARY_ENGINE   (1 << 15)

Engine supports secondary storage engines.

◆ HTON_SUPPORTS_TABLE_ENCRYPTION

#define HTON_SUPPORTS_TABLE_ENCRYPTION   (1 << 16)

Engine supports table or tablespace encryption .

◆ HTON_TEMPORARY_NOT_SUPPORTED

#define HTON_TEMPORARY_NOT_SUPPORTED    (1 << 6)

◆ make_keypart_map

#define make_keypart_map (   N)    (((key_part_map)2 << (N)) - 1)

◆ make_prev_keypart_map

#define make_prev_keypart_map (   N)    (((key_part_map)1 << (N)) - 1)

◆ MAXBQUALSIZE

#define MAXBQUALSIZE   64

◆ MAXGTRIDSIZE

#define MAXGTRIDSIZE   64

◆ UNDEF_NODEGROUP

#define UNDEF_NODEGROUP   65535

Typedef Documentation

◆ acl_notify_t

typedef void(* acl_notify_t) (THD *thd, const class Acl_change_notification *notice)

◆ alter_tablespace_t

typedef int(* alter_tablespace_t) (handlerton *hton, THD *thd, st_alter_tablespace *ts_info, const dd::Tablespace *old_ts_def, dd::Tablespace *new_ts_def)

Create/drop or alter tablespace in the storage engine.

Parameters
htonHadlerton of the SE.
thdThread context.
ts_infoDescription of tablespace and specific operation on it.
old_ts_defdd::Tablespace object describing old version of tablespace.
[in,out]new_ts_defdd::Tablespace object describing new version of tablespace. Engines which support atomic DDL can adjust this object. The updated information will be saved to the data-dictionary.
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned).

◆ binlog_func_t

typedef int(* binlog_func_t) (handlerton *hton, THD *thd, enum_binlog_func fn, void *arg)

◆ binlog_log_query_t

typedef void(* binlog_log_query_t) (handlerton *hton, THD *thd, enum_binlog_command binlog_command, const char *query, uint query_length, const char *db, const char *table_name)

◆ check_fk_column_compat_t

typedef bool(* check_fk_column_compat_t) (const Ha_fk_column_type *child_column_type, const Ha_fk_column_type *parent_column_type, bool check_charsets)

Check SE considers types of child and parent columns in foreign key to be compatible.

Parameters
child_column_typeChild column type description.
parent_column_typeParent column type description.
check_charsetsIndicates whether we need to check that charsets of string columns match. Which is true in most cases.
Returns
True if types are compatible, False if not.

◆ Clone_ack_t

using Clone_ack_t = int (*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)

Acknowledge data transfer to source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errinform any error occurred
[in]cbkcallback interface
Returns
error code

◆ Clone_apply_begin_t

using Clone_apply_begin_t = int (*)(handlerton *hton, THD *thd, const uchar *&loc, uint &loc_len, uint &task_id, Ha_clone_mode mode, const char *data_dir)

Begin apply to destination database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in,out]loclocator
[in,out]loc_lenlocator length
[in]task_idtask identifier
[in]modemode for starting clone
[in]data_dirtarget data directory
Returns
error code

◆ Clone_apply_end_t

using Clone_apply_end_t = int (*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err)

End apply to destination database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errerror code when ending after error
Returns
error code

◆ Clone_apply_t

using Clone_apply_t = int (*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)

Apply data to destination database in chunks via callback.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errinform any error occurred
[in]cbkcallback interface for receiving data
Returns
error code

◆ Clone_begin_t

using Clone_begin_t = int (*)(handlerton *hton, THD *thd, const uchar *&loc, uint &loc_len, uint &task_id, Ha_clone_type type, Ha_clone_mode mode)

Begin copy from source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in,out]loclocator
[in,out]loc_lenlocator length
[out]task_idtask identifier
[in]typeclone type
[in]modemode for starting clone
Returns
error code

◆ Clone_capability_t

Get capability flags for clone operation.

Parameters
[out]flagscapability flag

◆ Clone_copy_t

using Clone_copy_t = int (*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, Ha_clone_cbk *cbk)

Copy data from source database in chunks via callback.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]cbkcallback interface for sending data
Returns
error code

◆ Clone_end_t

using Clone_end_t = int (*)(handlerton *hton, THD *thd, const uchar *loc, uint loc_len, uint task_id, int in_err)

End copy from source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errerror code when ending after error
Returns
error code

◆ close_connection_t

typedef int(* close_connection_t) (handlerton *hton, THD *thd)

close_connection is only called if thd->ha_data[xxx_hton.slot] is non-zero, so even if you don't need this storage area - set it to something, so that MySQL would know this storage engine was accessed in this connection

◆ collect_hton_log_info_t

typedef bool(* collect_hton_log_info_t) (handlerton *hton, Json_dom *json)

Collect a handlerton (resource) log information.

◆ commit_by_xid_t

typedef xa_status_code(* commit_by_xid_t) (handlerton *hton, XID *xid)

◆ commit_t

typedef int(* commit_t) (handlerton *hton, THD *thd, bool all)

'all' is true if it's a real commit, that makes persistent changes 'all' is false if it's not in fact a commit but an end of the statement that is part of the transaction.

NOTE 'all' is also false in auto-commit mode where 'end of statement' and 'real commit' mean the same event.

◆ compare_secondary_engine_cost_t

using compare_secondary_engine_cost_t = bool (*)(THD *thd, const JOIN &join, double optimizer_cost, bool *use_best_so_far, bool *cheaper, double *secondary_engine_cost)

Compares the cost of two join plans in the secondary storage engine.

The cost of the current candidate is compared with the cost of the best plan seen so far.

Parameters
thdthread context
jointhe candidate plan to evaluate
optimizer_costthe cost estimate calculated by the optimizer
[out]use_best_so_fartrue if the optimizer should stop searching for a better plan and use the best plan it has seen so far
[out]cheapertrue if the candidate is the best plan seen so far for this JOIN (must be true if it is the first plan seen), false otherwise
[out]secondary_engine_costthe cost estimated by the secondary engine
Returns
false on success, or true if an error has been raised

◆ create_t

typedef handler *(* create_t) (handlerton *hton, TABLE_SHARE *table, bool partitioned, MEM_ROOT *mem_root)

Create handler object for the table in the storage engine.

Parameters
htonHandlerton object for the storage engine.
tableTABLE_SHARE for the table, can be NULL if caller didn't perform full-blown open of table definition.
partitionedIndicates whether table is partitioned.
mem_rootMemory root to be used for allocating handler object.

◆ ddse_dict_init_t

typedef bool(* ddse_dict_init_t) (dict_init_mode_t dict_init_mode, uint version, List< const dd::Object_table > *DDSE_tables, List< const Plugin_tablespace > *DDSE_tablespaces)

◆ dict_cache_reset_t

typedef void(* dict_cache_reset_t) (const char *schema_name, const char *table_name)

Invalidate an entry in the local dictionary cache.

Needed during bootstrap to make sure the contents in the DDSE dictionary cache is in sync with the global DD.

Parameters
schema_nameSchema name.
table_nameTable name.

◆ dict_cache_reset_tables_and_tablespaces_t

typedef void(* dict_cache_reset_tables_and_tablespaces_t) ()

Invalidate all table and tablespace entries in the local dictionary cache.

Needed for recovery during server restart.

◆ dict_get_server_version_t

typedef bool(* dict_get_server_version_t) (uint *version)

Get the server version id stored in the header of the dictionary tablespace.

Parameters
[out]versionVersion number from the DD tablespace header.
Return values
Operationoutcome, false if no error, otherwise true.

◆ dict_init_t

typedef bool(* dict_init_t) (dict_init_mode_t dict_init_mode, uint version, List< const Plugin_table > *DDSE_tables, List< const Plugin_tablespace > *DDSE_tablespaces)

Initialize the SE for being used to store the DD tables.

Create the required files according to the dict_init_mode. Create strings representing the required DDSE tables, i.e., tables that the DDSE expects to exist in the DD, and add them to the appropriate out parameter.

Note
There are two variants of this function type, one is to be used by the DDSE, and has a different type of output parameters because the SQL layer needs more information about the DDSE tables in order to support upgrade.
Parameters
dict_init_modeHow to initialize files
versionTarget DD version if a new server is being installed. 0 if restarting an existing server.
[out]DDSE_tablesList of SQL DDL statements for creating DD tables that are needed by the DDSE.
[out]DDSE_tablespacesList of meta data for predefined tablespaces created by the DDSE.
Return values
trueAn error occurred.
falseSuccess - no errors.

◆ dict_recover_t

typedef bool(* dict_recover_t) (dict_recovery_mode_t dict_recovery_mode, uint version)

Do recovery in the DDSE as part of initializing the data dictionary.

The dict_recovery_mode indicates what kind of recovery should be done.

Parameters
dict_recovery_modeHow to do recovery
versionTarget DD version if a new server is being installed. Actual DD version if restarting an existing server.
Return values
trueAn error occurred.
falseSuccess - no errors.

◆ dict_register_dd_table_id_t

typedef void(* dict_register_dd_table_id_t) (dd::Object_id hard_coded_tables)

Initialize the set of hard coded DD table ids.

◆ dict_set_server_version_t

typedef bool(* dict_set_server_version_t) ()

Store the current server version number into the header of the dictionary tablespace.

Return values
Operationoutcome, false if no error, otherwise true.

◆ discover_t

typedef int(* discover_t) (handlerton *hton, THD *thd, const char *db, const char *name, uchar **frmblob, size_t *frmlen)

◆ drop_database_t

typedef void(* drop_database_t) (handlerton *hton, char *path)

◆ external_engine_explain_check_t

using external_engine_explain_check_t = bool (*)(THD *thd)

Checks whether the tables used in an explain query are loaded in the secondary engine.

Parameters
thdthread context.
Return values
trueif there is a table not loaded to the secondary engine, false otherwise

◆ fill_is_table_t

typedef int(* fill_is_table_t) (handlerton *hton, THD *thd, Table_ref *tables, class Item *cond, enum enum_schema_tables)

◆ find_files_t

typedef int(* find_files_t) (handlerton *hton, THD *thd, const char *db, const char *path, const char *wild, bool dir, List< LEX_STRING > *files)

◆ find_secondary_engine_offload_fail_reason_t

using find_secondary_engine_offload_fail_reason_t = std::string_view (*)(THD *thd)

Finds and returns a specific secondary engine query offload failure reason as a string given a thread context (representing the query) whenever get_secondary_engine_offload_or_exec_fail_reason_t returns an empty reason.

Parameters
thdthread context.
Return values
std::string_viewas the offload failure reason.

◆ finish_upgrade_t

typedef int(* finish_upgrade_t) (THD *thd, bool failed_upgrade)

Finish upgrade process inside storage engines.

This includes resetting flags to indicate upgrade process and cleanup after upgrade.

Parameters
thdThread context
failed_upgradeTrue if the upgrade failed.
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned)

◆ flush_logs_t

typedef bool(* flush_logs_t) (handlerton *hton, bool binlog_group_flush)

Flush the log(s) of storage engine(s).

Parameters
htonHandlerton of storage engine.
binlog_group_flushtrue if we got invoked by binlog group commit during flush stage, false in other cases.
Return values
falseSucceed
trueError

◆ get_cost_constants_t

typedef SE_cost_constants *(* get_cost_constants_t) (uint storage_category)

Retrieve cost constants to be used for this storage engine.

A storage engine that wants to provide its own cost constants to be used in the optimizer cost model, should implement this function. The server will call this function to get a cost constant object that will be used for tables stored in this storage engine instead of using the default cost constants.

Life cycle for the cost constant object: The storage engine must allocate the cost constant object on the heap. After the function returns, the server takes over the ownership of this object. The server will eventually delete the object by calling delete.

Note
In the initial version the storage_category parameter will not be used. The only valid value this will have is DEFAULT_STORAGE_CLASS (see declaration in opt_costconstants.h).
Parameters
storage_categorythe storage type that the cost constants will be used for
Returns
a pointer to the cost constant object, if NULL is returned the default cost constants will be used

◆ get_index_column_cardinality_t

typedef bool(* get_index_column_cardinality_t) (const char *db_name, const char *table_name, const char *index_name, uint index_ordinal_position, uint column_ordinal_position, dd::Object_id se_private_id, ulonglong *cardinality)

Retrieve index column cardinality from SE.

Parameters
db_nameName of schema
table_nameName of table
index_nameName of index
index_ordinal_positionPosition of index.
column_ordinal_positionPosition of column in index.
se_private_idSE private id of the table.
[out]cardinalitycardinality being returned by SE.
Note
Handlers that implement this callback/API should adhere to servers expectation that, the implementation would invoke my_error() before returning 'true'/failure from this function.
Returns
false on success, true on failure

◆ get_secondary_engine_offload_or_exec_fail_reason_t

using get_secondary_engine_offload_or_exec_fail_reason_t = std::string_view (*)(const THD *thd)

Looks up and returns a specific secondary engine query offload or exec failure reason as a string given a thread context (representing the query) when the offloaded query fails in the secondary storage engine.

Parameters
thdthread context.
Return values
std::string_viewas the offload failure reason. The memory pointed to is managed by the handlerton and may be freed when the statement completes.

◆ get_table_statistics_t

typedef bool(* get_table_statistics_t) (const char *db_name, const char *table_name, dd::Object_id se_private_id, const dd::Properties &ts_se_private_data, const dd::Properties &tbl_se_private_data, uint flags, ha_statistics *stats)

Retrieve ha_statistics from SE.

Parameters
db_nameName of schema
table_nameName of table
se_private_idSE private id of the table.
ts_se_private_dataTablespace SE private data.
tbl_se_private_dataTable SE private data.
flagsType of statistics to retrieve.
[out]statsContains statistics read from SE.
Note
Handlers that implement this callback/API should adhere to servers expectation that, the implementation would invoke my_error() before returning 'true'/failure from this function.
Returns
false on success, true on failure

◆ get_tablespace_filename_ext_t

typedef const char *(* get_tablespace_filename_ext_t) ()

SE interface for getting tablespace extension.

Returns
Extension of tablespace datafile name.

◆ get_tablespace_statistics_t

typedef bool(* get_tablespace_statistics_t) (const char *tablespace_name, const char *file_name, const dd::Properties &ts_se_private_data, ha_tablespace_statistics *stats)

Retrieve ha_tablespace_statistics from SE.

Parameters
tablespace_nameTablespace_name
file_nameTablespace file name.
ts_se_private_dataTablespace SE private data.
[out]statsContains tablespace statistics read from SE.
Note
Handlers that implement this callback/API should adhere to servers expectation that, the implementation would invoke my_error() before returning 'true'/failure from this function.
Returns
false on success, true on failure

◆ get_tablespace_t

typedef int(* get_tablespace_t) (THD *thd, LEX_CSTRING db_name, LEX_CSTRING table_name, LEX_CSTRING *tablespace_name)

Get the tablespace name from the SE for the given schema and table.

Parameters
thdThread context.
db_nameName of the relevant schema.
table_nameName of the relevant table.
[out]tablespace_nameName of the tablespace containing the table.
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned).

◆ get_tablespace_type_by_name_t

typedef bool(* get_tablespace_type_by_name_t) (const char *tablespace_name, Tablespace_type *space_type)

Get the tablespace type given the name, from the SE.

Parameters
[in]tablespace_nametablespace name
[out]space_typetype of space
Returns
Operation status.
Return values
falseon success and true for failure.

◆ get_tablespace_type_t

typedef bool(* get_tablespace_type_t) (const dd::Tablespace &space, Tablespace_type *space_type)

Get the tablespace type from the SE.

Parameters
[in]spacetablespace object
[out]space_typetype of space
Returns
Operation status.
Return values
falseon success and true for failure.

◆ Ha_clone_flagset

using Ha_clone_flagset = std::bitset<HA_CLONE_TYPE_MAX>

◆ is_dict_readonly_t

typedef bool(* is_dict_readonly_t) ()

Check if the DDSE is started in a way that leaves thd DD being read only.

Return values
trueThe data dictionary can only be read.
falseThe data dictionary can be read and written.

◆ is_reserved_db_name_t

typedef bool(* is_reserved_db_name_t) (handlerton *hton, const char *name)

◆ is_supported_system_table_t

typedef bool(* is_supported_system_table_t) (const char *db, const char *table_name, bool is_sql_layer_system_table)

Check if the given db.tablename is a system table for this SE.

Parameters
dbDatabase name to check.
table_nametable name to check.
is_sql_layer_system_tableif the supplied db.table_name is a SQL layer system table.
See also
example_is_supported_system_table in ha_example.cc

is_sql_layer_system_table is supplied to make more efficient checks possible for SEs that support all SQL layer tables.

This interface is optional, so every SE need not implement it.

◆ is_valid_tablespace_name_t

typedef bool(* is_valid_tablespace_name_t) (ts_command_type ts_cmd, const char *tablespace_name)

SE specific validation of the tablespace name.

This function will ask the relevant SE whether the submitted tablespace name is valid.

Parameters
ts_cmdPurpose of usage - is this tablespace DDL?
tablespace_nameName of the tablespace.
Returns
Tablespace name validity.
Return values
Whetherthe tablespace name is valid.

◆ kill_connection_t

typedef void(* kill_connection_t) (handlerton *hton, THD *thd)

Terminate connection/statement notification.

◆ lock_hton_log_t

typedef bool(* lock_hton_log_t) (handlerton *hton)

Lock a handlerton (resource) log to collect log information.

◆ Log_func

typedef bool Log_func(THD *, TABLE *, bool, const uchar *, const uchar *)

◆ my_xid

typedef ulonglong my_xid

◆ notify_after_select_t

using notify_after_select_t = void (*)(THD *thd, SelectExecutedIn executed_in)

Notify plugins when a SELECT query was executed.

The plugins will be notified only if the query is not considered secondary engine relevant, i.e.:

  1. for a query with missing secondary_engine_statement_ctx, its estimated cost is greater than the currently configured 'secondary_engine_cost_threshold'
  2. for queries with secondary_engine_statement_ctx, wherever secondary_engine_statement_ctx::is_primary_engine_optimal() returns False indicating secondary engine relevance.

◆ notify_alter_table_t

typedef bool(* notify_alter_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type)

Notify/get permission from storage engine before or after execution of ALTER TABLE operation on the table identified by the MDL key.

Parameters
thdThread context.
mdl_keyMDL key identifying table which is going to be or was ALTERed.
notification_typeIndicates whether this is pre-ALTER TABLE or post-ALTER TABLE notification.
Note
This hook is necessary because for ALTER TABLE upgrade to X metadata lock happens fairly late during the execution process, so it can be expensive to abort ALTER TABLE operation at this stage by returning failure from notify_exclusive_mdl() hook.
This hook follows the same error reporting convention as
See also
notify_exclusive_mdl().
Note
Similarly to notify_exclusive_mdl() in some cases post-ALTER notification might happen even if there were no prior pre-ALTER notification.
Post-ALTER notification can happen before post-release notification for exclusive metadata lock acquired by this ALTER TABLE.
Returns
False - if notification was successful/ALTER TABLE can proceed. True - if it has failed/ALTER TABLE should be aborted.

◆ notify_create_table_t

using notify_create_table_t = void (*)(struct HA_CREATE_INFO *create_info, const char *db, const char *table_name)

Notify plugins when a table is created.

◆ notify_drop_table_t

using notify_drop_table_t = void (*)(Table_ref *tab)

Notify plugins when a table is dropped.

◆ notify_exclusive_mdl_t

typedef bool(* notify_exclusive_mdl_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, bool *victimized)

Notify/get permission from storage engine before acquisition or after release of exclusive metadata lock on object represented by key.

Parameters
thdThread context.
mdl_keyMDL key identifying object on which exclusive lock is to be acquired/was released.
notification_typeIndicates whether this is pre-acquire or post-release notification.
victimized'true' if locking failed as we were selected as a victim in order to avoid possible deadlocks.
Note
Notification is done only for objects from TABLESPACE, SCHEMA, TABLE, FUNCTION, PROCEDURE, TRIGGER and EVENT namespaces.
Problems during notification are to be reported as warnings, MDL subsystem will report generic error if pre-acquire notification fails/SE refuses lock acquisition.
Return value is ignored/error is not reported in case of post-release notification.
In some cases post-release notification might happen even if there were no prior pre-acquire notification. For example, when SE was loaded after exclusive lock acquisition, or when we need notify SEs which permitted lock acquisition that it didn't happen because one of SEs didn't allow it (in such case we will do post-release notification for all SEs for simplicity).
Returns
False - if notification was successful/lock can be acquired, True - if it has failed/lock should not be acquired.

◆ notify_rename_table_t

typedef bool(* notify_rename_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type, const char *old_db_name, const char *old_table_name, const char *new_db_name, const char *new_table_name)

Notify/get permission from storage engine before or after execution of RENAME TABLE operation on the table identified by the MDL key.

Parameters
thdThread context.
mdl_keyMDL key identifying table which is going to be or was RENAMEd.
notification_typeIndicates whether this is pre-RENAME TABLE or post-RENAME TABLE notification.
old_db_nameold db name
old_table_nameold table name
new_db_namenew db name
new_table_namenew table name

◆ notify_truncate_table_t

typedef bool(* notify_truncate_table_t) (THD *thd, const MDL_key *mdl_key, ha_notification_type notification_type)

Notify/get permission from storage engine before or after execution of TRUNCATE TABLE operation on the table identified by the MDL key.

Parameters
thdThread context.
mdl_keyMDL key identifying table which is going to be or was TRUNCATEd.
notification_typeIndicates whether this is pre-TRUNCATE TABLE or post-TRUNCATE TABLE notification.

◆ optimize_secondary_engine_t

using optimize_secondary_engine_t = bool (*)(THD *thd, LEX *lex)

Optimize a statement for execution on a secondary storage engine.

This function is called when the optimization of a statement has completed, just before the statement is executed. Secondary engines can use this function to apply engine-specific optimizations to the execution plan. They can also reject executing the query by raising an error, in which case the query will be reprepared and executed by the primary storage engine.

Parameters
thdthread context
lexthe statement being optimized
Returns
true on error, false on success

◆ page_track_get_num_page_ids_t

using page_track_get_num_page_ids_t = int (*)(uint64_t *start_id, uint64_t *stop_id, uint64_t *num_pages)

Fetch approximate number of tracked pages in the given range.

Parameters
[in,out]start_idSE specific sequence number [LSN for InnoDB] from where the pages tracked would be returned.
Note
the range might get expanded and the actual start_id used for the querying will be updated.
Parameters
[in,out]stop_idSE specific sequence number [LSN for InnoDB] until where the pages tracked would be returned.
Note
the range might get expanded and the actual stop_id used for the querying will be updated.
Parameters
[out]num_pagesnumber of pages tracked
Returns
Operation status.
Return values
0Success
otherER_* mysql error. Get error details from THD.

◆ page_track_get_page_ids_t

using page_track_get_page_ids_t = int (*)(Page_Track_Callback cbk_func, void *cbk_ctx, uint64_t *start_id, uint64_t *stop_id, unsigned char *buffer, size_t buffer_len)

Fetch tracked pages.

Parameters
[in]cbk_funccallback function return page IDs
[in]cbk_ctxcaller's context for callback
[in,out]start_idSE specific sequence number [LSN for InnoDB] from where the pages tracked would be returned.
Note
The range might get expanded and the actual start_id used for the querying will be updated.
Parameters
[in,out]stop_idSE specific sequence number [LSN for InnoDB] until where the pages tracked would be returned.
Note
The range might get expanded and the actual stop_id used for the querying will be updated.
Parameters
[out]bufferallocated buffer to copy page IDs
[in]buffer_lenlength of buffer in bytes
Returns
Operation status.
Return values
0Success
otherER_* mysql error. Get error details from THD.

◆ page_track_get_status_t

using page_track_get_status_t = void (*)(std::vector<std::pair<uint64_t, bool> > &status)

Fetch the status of the page tracking system.

Parameters
[out]statusvector of a pair of (ID, bool) where ID is the start/stop point and bool is true if the ID is a start point else false

◆ page_track_purge_t

using page_track_purge_t = int (*)(uint64_t *purge_id)

Purge page tracking data.

Parameters
[in,out]purge_idSE specific sequence number [LSN for InnoDB] initially indicating till where the data needs to be purged and finally updated to until where it was actually purged
Returns
Operation status.
Return values
0Success
otherER_* mysql error. Get error details from THD.

◆ page_track_start_t

using page_track_start_t = int (*)(uint64_t *start_id)

Start page tracking.

Parameters
[out]start_idSE specific sequence number [LSN for InnoDB] indicating when the tracking was started
Returns
Operation status.
Return values
0Success
otherER_* mysql error. Get error details from THD.

◆ page_track_stop_t

using page_track_stop_t = int (*)(uint64_t *stop_id)

Stop page tracking.

Parameters
[out]stop_idSE specific sequence number [LSN for InnoDB] indicating when the tracking was stopped
Returns
Operation status.
Return values
0Success
otherER_* mysql error. Get error details from THD.

◆ panic_t

typedef int(* panic_t) (handlerton *hton, enum ha_panic_function flag)

◆ partition_flags_t

typedef uint(* partition_flags_t) ()

The flag values are defined in sql_partition.h.

If this function is set, then it implies that the handler supports partitioned tables. If this function exists, then handler::get_partition_handler must also be implemented.

◆ post_ddl_t

typedef void(* post_ddl_t) (THD *thd)

Perform post-commit/rollback cleanup after DDL statement (e.g.

in case of DROP TABLES really remove table files from disk).

Note
This hook will be invoked after DDL commit or rollback only for storage engines supporting atomic DDL.
Problems during execution of this method should be reported to error log and as warnings/notes to user. Since this method is called after successful commit of the statement we can't fail statement with error.

◆ post_recover_t

typedef void(* post_recover_t) (void)

Perform SE-specific cleanup after recovery of transactions.

Note
Particularly SEs supporting atomic DDL can use this call to perform post-DDL actions for DDL statements which were committed or rolled back during recovery stage.

◆ pre_dd_shutdown_t

typedef void(* pre_dd_shutdown_t) (handlerton *hton)

Shut down all storage engine background tasks that might access the data dictionary, before the main shutdown.

◆ prepare_secondary_engine_t

using prepare_secondary_engine_t = bool (*)(THD *thd, LEX *lex)

Prepare the secondary engine for executing a statement.

This function is called right after the secondary engine TABLE objects have been opened by open_secondary_engine_tables(), before the statement is optimized and executed. Secondary engines will typically create a context object in this function, which they can use to store state that is needed during the optimization and execution phases.

Parameters
thdthread context
lexthe statement to execute
Returns
true on error, false on success

◆ prepare_t

typedef int(* prepare_t) (handlerton *hton, THD *thd, bool all)

◆ push_to_engine_t

using push_to_engine_t = int (*)(THD *thd, AccessPath *query, JOIN *join)

Let storage engine inspect the query Accesspath and pick whatever it like for being pushed down to the engine.

(Join, conditions, ..)

The handler implementation should itself keep track of what it 'pushed', such that later calls to the handlers access methods should activate the pushed parts of the execution plan on the storage engines.

Parameters
thdThread context
queryThe AccessPath for the entire query.
joinThe JOIN to be pushed
Returns
0 on success error otherwise

◆ qc_engine_callback

typedef bool(* qc_engine_callback) (THD *thd, const char *table_key, uint key_length, ulonglong *engine_data)

◆ range_seq_t

typedef void* range_seq_t

◆ recover_prepared_in_tc_t

using recover_prepared_in_tc_t = int (*)(handlerton *hton, Xa_state_list &xa_list)

Retrieves information about externally coordinated transactions for which the two-phase prepare was finished and transactions were prepared in the server TC.

◆ recover_t

typedef int(* recover_t) (handlerton *hton, XA_recover_txn *xid_list, uint len, MEM_ROOT *mem_root)

◆ redo_log_set_state_t

typedef bool(* redo_log_set_state_t) (THD *thd, bool enable)

Enable or Disable SE write ahead logging.

Parameters
[in]thdserver thread handle
[in]enableenable/disable redo logging
Returns
true iff failed.

◆ replace_native_transaction_in_thd_t

typedef void(* replace_native_transaction_in_thd_t) (THD *thd, void *new_trx_arg, void **ptr_trx_arg)
Parameters
[in,out]thdpointer to THD
[in]new_trx_argpointer to replacement transaction
[out]ptr_trx_argdouble pointer to being replaced transaction

Associated with THD engine's native transaction is replaced with new_trx_arg. The old value is returned through a buffer if non-null pointer is provided with ptr_trx_arg. The method is adapted by XA start and XA prepare handlers to handle XA transaction that is logged as two parts by slave applier.

This interface concerns engines that are aware of XA transaction.

◆ reset_plugin_vars_t

typedef void(* reset_plugin_vars_t) (THD *thd)

Some plugin session variables may require some special handling upon clean up.

Reset appropriately these variables before ending the THD connection

◆ rm_tmp_tables_t

typedef bool(* rm_tmp_tables_t) (handlerton *hton, THD *thd, List< LEX_STRING > *files)

Drop all temporary tables which have been left from previous server run belonging to this SE.

Used on server start-up.

Parameters
[in]htonHandlerton for storage engine.
[in]thdThread context.
[in,out]filesList of files in directories for temporary files which match tmp_file_prefix and thus can belong to temporary tables (but not necessarily in this SE). It is recommended to remove file from the list if SE recognizes it as belonging to temporary table in this SE and deletes it.

◆ rollback_by_xid_t

typedef xa_status_code(* rollback_by_xid_t) (handlerton *hton, XID *xid)

◆ rollback_t

typedef int(* rollback_t) (handlerton *hton, THD *thd, bool all)

◆ rotate_encryption_master_key_t

typedef bool(* rotate_encryption_master_key_t) (void)

Initiate master key rotation.

Returns
false on success, true on failure

◆ savepoint_release_t

typedef int(* savepoint_release_t) (handlerton *hton, THD *thd, void *sv)

◆ savepoint_rollback_can_release_mdl_t

typedef bool(* savepoint_rollback_can_release_mdl_t) (handlerton *hton, THD *thd)

Check if storage engine allows to release metadata locks which were acquired after the savepoint if rollback to savepoint is done.

Returns
true - If it is safe to release MDL locks. false - If it is not.

◆ savepoint_rollback_t

typedef int(* savepoint_rollback_t) (handlerton *hton, THD *thd, void *sv)

sv points to a storage area, that was earlier passed to the savepoint_set call

◆ savepoint_set_t

typedef int(* savepoint_set_t) (handlerton *hton, THD *thd, void *sv)

sv points to an uninitialized storage area of requested size (see savepoint_offset description)

◆ sdi_container

using sdi_container = std::vector<sdi_key_t>

◆ sdi_create_t

typedef bool(* sdi_create_t) (dd::Tablespace *tablespace)

Create SDI in a tablespace.

This API should be used when upgrading a tablespace with no SDI or after invoking sdi_drop().

Parameters
[in]tablespacetablespace object
Return values
falsesuccess
truefailure

◆ sdi_delete_t

typedef bool(* sdi_delete_t) (const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key)

Delete SDI for a given SDI key.

Parameters
[in]tablespacetablespace object
[in]tabletable object
[in]sdi_keySDI key to uniquely identify SDI obj
Return values
falsesuccess
truefailure, my_error() should be called by SE

◆ sdi_drop_t

typedef bool(* sdi_drop_t) (dd::Tablespace *tablespace)

Drop SDI in a tablespace.

This API should be used only when SDI is corrupted.

Parameters
[in]tablespacetablespace object
Return values
falsesuccess
truefailure

◆ sdi_get_keys_t

typedef bool(* sdi_get_keys_t) (const dd::Tablespace &tablespace, sdi_vector_t &vector)

Get the SDI keys in a tablespace into vector.

Parameters
[in]tablespacetablespace object
[in,out]vectorvector of SDI Keys
Return values
falsesuccess
truefailure

◆ sdi_get_t

typedef bool(* sdi_get_t) (const dd::Tablespace &tablespace, const sdi_key_t *sdi_key, void *sdi, uint64 *sdi_len)

Retrieve SDI for a given SDI key.

Since the caller of this api will not know the SDI length, SDI retrieval should be done in the following way.

i. Allocate initial memory of some size (Lets say 64KB) ii. Pass the allocated memory to the below api. iii. If passed buffer is sufficient, sdi_get_by_id() copies the sdi to the buffer passed and returns success, else sdi_len is modified with the actual length of the SDI (and returns false on failure). For genuine errors, sdi_len is returned as UINT64_MAX iv. If sdi_len != UINT64_MAX, retry the call after allocating the memory of sdi_len v. Free the memory after using SDI (responsibility of caller)

Parameters
[in]tablespacetablespace object
[in]sdi_keySDI key to uniquely identify SDI obj
[in,out]sdiSDI retrieved from tablespace A non-null pointer must be passed in
[in,out]sdi_lenin: length of the memory allocated out: actual length of SDI
Return values
falsesuccess
truefailure

◆ sdi_set_t

typedef bool(* sdi_set_t) (handlerton *hton, const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key, const void *sdi, uint64 sdi_len)

Insert/Update SDI for a given SDI key.

Parameters
[in]htonhandlerton object
[in]tablespacetablespace object
[in]tabletable object
[in]sdi_keySDI key to uniquely identify SDI obj
[in]sdiSDI to write into the tablespace
[in]sdi_lenlength of SDI BLOB returned
Return values
falsesuccess
truefailure, my_error() should be called by SE

◆ se_after_commit_t

using se_after_commit_t = void (*)(void *arg)

◆ se_before_commit_t

using se_before_commit_t = void (*)(void *arg)

◆ se_before_rollback_t

using se_before_rollback_t = void (*)(void *arg)

◆ secondary_engine_check_optimizer_request_t

using secondary_engine_check_optimizer_request_t = SecondaryEngineGraphSimplificationRequestParameters (*)( THD *thd, const JoinHypergraph &hypergraph, const AccessPath *access_path, int current_subgraph_pairs, int current_subgraph_pairs_limit, bool is_root_access_path, std::string *trace)

Hook for secondary engine to evaluate the current hypergraph optimization state, and returns the state that hypergraph should transition to.

Usually invoked after secondary_engine_modify_access_path_cost_t is invoked via the optimizer. The state is returned as object of type SecondaryEngineGraphSimplificationRequestParameters, and can lead to simplification of hypergraph search space, or resetting the graph and starting search afresh.

Parameters
thdThe thread context.
hypergraphThe hypergraph that represents the search space.
access_pathThe AccessPath to evaluate.
current_subgraph_pairsCount of subgraph pairs explored so far.
current_subgraph_pairs_limitLimit for current hypergraph.
is_root_access_pathIndicating if access_path is root.
traceOptimizer trace string.
Returns
instance of SecondaryEngineGraphSimplificationRequestParameters which contains description of the state hypergraph optimizer should transition to.

◆ secondary_engine_modify_access_path_cost_t

using secondary_engine_modify_access_path_cost_t = bool (*)( THD *thd, const JoinHypergraph &hypergraph, AccessPath *access_path)

Evaluates the cost of executing the given access path in this secondary storage engine, and potentially modifies the cost estimates that are in the access path.

This function is only called from the hypergraph join optimizer.

The function is called on every access path that the join optimizer might compare to an alternative access path. This includes both paths that represent complete execution plans and paths that represent partial plans. It is not guaranteed to be called on every child path. For example, if GROUP BY is done by sorting first and then aggregating the sorted results, the function will only be called on the aggregation path, and not on the sort path, because only the aggregation path will be compared to other paths.

The secondary engine is allowed to modify the estimates in the access path to better match the costs of the access path in the secondary engine. It can change any of the following AccessPath members:

  • init_once_cost
  • init_cost
  • cost
  • cost_before_filter
  • num_output_rows
  • num_output_rows_before_filter
  • secondary_engine_data

Any other members should be left unchanged. The AccessPath must be in an internally consistent state when the function returns, and satisfy invariants expected by the hypergraph join optimizer, such as:

  • init_cost <= cost_before_filter <= cost
  • num_output_rows <= num_output_rows_before_filter

The secondary engine can also reject an access path altogether, by returning true, in which case the join optimizer will not use that path in the final plan. Since the secondary engine can reject any partial or complete plan, it is possible that the join optimizer does not find any valid plan that is accepted. In this case, the join optimizer will raise an error.

If the secondary encounters an error when evaluating the cost of the path, it can signal an error by calling my_error() and return true, in which case the join optimizer will not suggest any plan for the query.

Parameters
thdThe thread context.
hypergraphThe hypergraph that represents the search space.
[in,out]access_pathThe AccessPath to evaluate.
Return values
falseon success.
trueif the plan is to be rejected, or if an error was raised.

◆ secondary_engine_pre_prepare_hook_t

using secondary_engine_pre_prepare_hook_t = bool (*)(THD *thd)

Secondary engine hook called after PRIMARY_TENTATIVELY optimization is complete, and decides if secondary engine optimization will be performed, and comparison of primary engine cost and secondary engine cost will determine which engine to use for execution.

Parameters
[in]thdcurrent thd.
Returns
:
Return values
trueWhen secondary_engine's prepare hook is to be further called
falseWhen secondary_engine's prepare hook is NOT to be further called

◆ SecondaryEngineFlags

using SecondaryEngineFlags = uint64_t

◆ set_prepared_in_tc_by_xid_t

Instructs the storage engine to mark the externally coordinated transactions identified by the XID parameters as prepared in the server TC.

◆ set_prepared_in_tc_t

using set_prepared_in_tc_t = int (*)(handlerton *hton, THD *thd)

Instructs the storage engine to mark the externally coordinated transactions held by the THD parameters as prepared in the server TC.

◆ set_secondary_engine_offload_fail_reason_t

using set_secondary_engine_offload_fail_reason_t = bool (*)(const THD *thd, std::string_view reason)

Sets a specific secondary engine offload failure reason for a query represented by the thread context when the offloaded query fails in the secondary storage engine.

Parameters
thdthread context.
reasonoffload failure reason.
Return values
boolto indicate if the setting succeeded or failed

◆ show_status_t

typedef bool(* show_status_t) (handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat)

◆ start_consistent_snapshot_t

typedef int(* start_consistent_snapshot_t) (handlerton *hton, THD *thd)

◆ stat_print_fn

typedef bool() stat_print_fn(THD *thd, const char *type, size_t type_len, const char *file, size_t file_len, const char *status, size_t status_len)

◆ table_exists_in_engine_t

typedef int(* table_exists_in_engine_t) (handlerton *hton, THD *thd, const char *db, const char *name)

◆ unlock_hton_log_t

typedef bool(* unlock_hton_log_t) (handlerton *hton)

Unlock a handlerton (resource) log after collecting log information.

◆ upgrade_logs_t

typedef int(* upgrade_logs_t) (THD *thd)

Upgrade logs after the checkpoint from where upgrade process can only roll forward.

Parameters
thdThread context
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned)

◆ upgrade_space_version_t

typedef bool(* upgrade_space_version_t) (dd::Tablespace *tablespace)

Get the tablespace data from SE and insert it into Data dictionary.

Parameters
[in]tablespacetablespace object
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned)

◆ upgrade_tablespace_t

typedef int(* upgrade_tablespace_t) (THD *thd)

Get the tablespace data from SE and insert it into Data dictionary.

Parameters
thdThread context
Returns
Operation status.
Return values
==0 Success.
!=0 Error (handler error code returned)

◆ XA_recover_txn

◆ XID

typedef struct xid_t XID

◆ Xid_commit_list

using Xid_commit_list = std::unordered_set<my_xid, std::hash<my_xid>, std::equal_to<my_xid>, Mem_root_allocator<my_xid> >

Single occurrence set of XIDs of internally coordinated transactions found as been committed in the transaction coordinator state.

Enumeration Type Documentation

◆ dict_init_mode_t

Mode for initializing the data dictionary.

Enumerator
DICT_INIT_CREATE_FILES 

Create all required SE files.

DICT_INIT_CHECK_FILES 

Verify existence of expected files.

◆ dict_recovery_mode_t

Mode for data dictionary recovery.

Enumerator
DICT_RECOVERY_INITIALIZE_SERVER 

First start of a new server.

DICT_RECOVERY_INITIALIZE_TABLESPACES 

First start, create tablespaces.

DICT_RECOVERY_RESTART_SERVER 

Restart of an existing server.

◆ enum_alter_inplace_result

Return values for check_if_supported_inplace_alter().

See also
check_if_supported_inplace_alter() for description of the individual values.
Enumerator
HA_ALTER_ERROR 
HA_ALTER_INPLACE_NOT_SUPPORTED 
HA_ALTER_INPLACE_EXCLUSIVE_LOCK 
HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE 
HA_ALTER_INPLACE_SHARED_LOCK 
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE 
HA_ALTER_INPLACE_NO_LOCK 
HA_ALTER_INPLACE_INSTANT 

◆ enum_binlog_command

Enumerator
LOGCOM_CREATE_TABLE 
LOGCOM_ALTER_TABLE 
LOGCOM_RENAME_TABLE 
LOGCOM_DROP_TABLE 
LOGCOM_CREATE_DB 
LOGCOM_ALTER_DB 
LOGCOM_DROP_DB 

◆ enum_binlog_func

Enumerator
BFN_RESET_LOGS 
BFN_RESET_SLAVE 
BFN_BINLOG_WAIT 
BFN_BINLOG_END 
BFN_BINLOG_PURGE_FILE 
BFN_BINLOG_PURGE_WAIT 

◆ enum_ha_recover_xa_state

enum class enum_ha_recover_xa_state : int
strong

Enumeration of possible states for externally coordinated transactions (XA).

Enumerator
NOT_FOUND 
PREPARED_IN_SE 
PREPARED_IN_TC 
COMMITTED_WITH_ONEPHASE 
COMMITTED 
ROLLEDBACK 

◆ enum_sampling_method

enum class enum_sampling_method
strong
Enumerator
SYSTEM 
NONE 

◆ enum_schema_tables

enum enum_schema_tables : int
Enumerator
SCH_FIRST 
SCH_COLUMN_PRIVILEGES 
SCH_ENGINES 
SCH_OPEN_TABLES 
SCH_OPTIMIZER_TRACE 
SCH_PLUGINS 
SCH_PROCESSLIST 
SCH_PROFILES 
SCH_SCHEMA_PRIVILEGES 
SCH_TABLE_PRIVILEGES 
SCH_USER_PRIVILEGES 
SCH_TMP_TABLE_COLUMNS 
SCH_TMP_TABLE_KEYS 
SCH_LAST 

◆ enum_stats_auto_recalc

Enumerator
HA_STATS_AUTO_RECALC_DEFAULT 
HA_STATS_AUTO_RECALC_ON 
HA_STATS_AUTO_RECALC_OFF 

◆ enum_tx_isolation

enum enum_tx_isolation : int
Enumerator
ISO_READ_UNCOMMITTED 
ISO_READ_COMMITTED 
ISO_REPEATABLE_READ 
ISO_SERIALIZABLE 

◆ Ha_clone_mode

Clone start operation mode.

Enumerator
HA_CLONE_MODE_START 

Start a new clone operation.

HA_CLONE_MODE_RESTART 

Re-start a clone operation after failure.

HA_CLONE_MODE_ADD_TASK 

Add a new task to a running clone operation.

HA_CLONE_MODE_VERSION 

Get version for transfer data format.

HA_CLONE_MODE_MAX 

Max value for clone mode.

◆ Ha_clone_type

enum Ha_clone_type : size_t

Clone operation types.

Enumerator
HA_CLONE_BLOCKING 

Caller must block all write operation to the SE.

HA_CLONE_REDO 

For transactional SE, archive redo to support concurrent dml.

HA_CLONE_PAGE 

For transactional SE, track page changes to support concurrent dml.

HA_CLONE_HYBRID 

For transactional SE, use both page tracking and redo to optimize clone with concurrent dml.

Currently supported by Innodb.

HA_CLONE_MULTI_TASK 

SE supports multiple threads for clone.

HA_CLONE_RESTART 

SE supports restarting clone after network failure.

HA_CLONE_TYPE_MAX 

Maximum value of clone type.

◆ ha_ddl_type

enum ha_ddl_type : int
Enumerator
HA_INVALID_DDL 
HA_ALTER_DDL 
HA_TRUNCATE_DDL 
HA_RENAME_DDL 

◆ ha_notification_type

Enumerator
HA_NOTIFY_PRE_EVENT 
HA_NOTIFY_POST_EVENT 

◆ ha_stat_type

Enumerator
HA_ENGINE_STATUS 
HA_ENGINE_LOGS 
HA_ENGINE_MUTEX 

◆ legacy_db_type

Enumerator
DB_TYPE_UNKNOWN 
DB_TYPE_DIAB_ISAM 
DB_TYPE_HASH 
DB_TYPE_MISAM 
DB_TYPE_PISAM 
DB_TYPE_RMS_ISAM 
DB_TYPE_HEAP 
DB_TYPE_ISAM 
DB_TYPE_MRG_ISAM 
DB_TYPE_MYISAM 
DB_TYPE_MRG_MYISAM 
DB_TYPE_BERKELEY_DB 
DB_TYPE_INNODB 
DB_TYPE_GEMINI 
DB_TYPE_NDBCLUSTER 
DB_TYPE_EXAMPLE_DB 
DB_TYPE_ARCHIVE_DB 
DB_TYPE_CSV_DB 
DB_TYPE_FEDERATED_DB 
DB_TYPE_BLACKHOLE_DB 
DB_TYPE_PARTITION_DB 
DB_TYPE_BINLOG 
DB_TYPE_SOLID 
DB_TYPE_PBXT 
DB_TYPE_TABLE_FUNCTION 
DB_TYPE_MEMCACHE 
DB_TYPE_FALCON 
DB_TYPE_MARIA 
DB_TYPE_PERFORMANCE_SCHEMA 

Performance schema engine.

DB_TYPE_TEMPTABLE 
DB_TYPE_FIRST_DYNAMIC 
DB_TYPE_DEFAULT 

◆ row_type

enum row_type : int
Enumerator
ROW_TYPE_NOT_USED 
ROW_TYPE_DEFAULT 
ROW_TYPE_FIXED 
ROW_TYPE_DYNAMIC 
ROW_TYPE_COMPRESSED 
ROW_TYPE_REDUNDANT 
ROW_TYPE_COMPACT 
ROW_TYPE_PAGED 

Unused.

Reserved for future versions.

◆ SecondaryEngineFlag

Enumerator
SUPPORTS_HASH_JOIN 
SUPPORTS_NESTED_LOOP_JOIN 
AGGREGATION_IS_UNORDERED 
USE_EXTERNAL_EXECUTOR 

This flag can be set to signal that a secondary storage engine will not use MySQL's executor (see JOIN::override_executor_func).

In this case, it doesn't need MySQL's execution data structures, like internal temporary tables, filesort objects or iterators. If the flag is set, FinalizePlanForQueryBlock() will not make any changes to the plan, and CreateIteratorFromAccessPath() will not be called.

◆ SecondaryEngineGraphSimplificationRequest

Enumerator
kContinue 

Continue optimization phase with current hypergraph.

kRestart 

Trigger restart of hypergraph with provided number of subgraph pairs.

◆ SelectExecutedIn

enum class SelectExecutedIn : bool
strong

Used to identify which engine executed a SELECT query.

Enumerator
kPrimaryEngine 
kSecondaryEngine 

◆ Tablespace_type

enum class Tablespace_type
strong
Enumerator
SPACE_TYPE_DICTIONARY 
SPACE_TYPE_SYSTEM 
SPACE_TYPE_UNDO 
SPACE_TYPE_TEMPORARY 
SPACE_TYPE_SHARED 
SPACE_TYPE_IMPLICIT 

◆ ts_alter_tablespace_type

Enumerator
TS_ALTER_TABLESPACE_TYPE_NOT_DEFINED 
ALTER_TABLESPACE_ADD_FILE 
ALTER_TABLESPACE_DROP_FILE 
ALTER_TABLESPACE_RENAME 
ALTER_TABLESPACE_OPTIONS 
ALTER_UNDO_TABLESPACE_SET_ACTIVE 
ALTER_UNDO_TABLESPACE_SET_INACTIVE 

◆ ts_command_type

Enumerator
TS_CMD_NOT_DEFINED 
CREATE_TABLESPACE 
ALTER_TABLESPACE 
CREATE_LOGFILE_GROUP 
ALTER_LOGFILE_GROUP 
DROP_TABLESPACE 
DROP_LOGFILE_GROUP 
CHANGE_FILE_TABLESPACE 
ALTER_ACCESS_MODE_TABLESPACE 
CREATE_UNDO_TABLESPACE 
ALTER_UNDO_TABLESPACE 
DROP_UNDO_TABLESPACE 

◆ xa_status_code

X/Open XA distributed transaction status codes.

Enumerator
XA_OK 

normal execution

XAER_ASYNC 

asynchronous operation already outstanding

XAER_RMERR 

a resource manager error occurred in the transaction branch

XAER_NOTA 

the XID is not valid

XAER_INVAL 

invalid arguments were given

XAER_PROTO 

routine invoked in an improper context

XAER_RMFAIL 

resource manager unavailable

XAER_DUPID 

the XID already exists

XAER_OUTSIDE 

resource manager doing work outside transaction

Function Documentation

◆ binlog_log_row()

int binlog_log_row ( TABLE table,
const uchar before_record,
const uchar after_record,
Log_func log_func 
)

◆ calculate_key_len()

uint calculate_key_len ( TABLE table,
uint  key,
key_part_map  keypart_map 
)

Calculates length of key.

Given a key index and a map of key parts return length of buffer used by key parts.

Parameters
tableTable containing the key
keyKey index
keypart_mapwhich key parts that is used
Returns
Length of used key parts.

◆ check_table_for_old_types()

int check_table_for_old_types ( const TABLE table)

Function identifies any old data type present in table.

This function was handler::check_old_types(). Function is not part of SE API. It is now converted to auxiliary standalone function.

Parameters
[in]tableTABLE object
Return values
0ON SUCCESS
errorcode ON FAILURE

◆ commit_owned_gtids()

std::pair< int, bool > commit_owned_gtids ( THD thd,
bool  all 
)

The function computes condition to call gtid persistor wrapper, and executes it.

It is invoked at committing a statement or transaction, including XA, and also at XA prepare handling.

Parameters
thdThread context.
allThe execution scope, true for the transaction one, false for the statement one.
Returns
std::pair containing: Error and Owned GTID release status Error
Return values
0Ok
!0Error

Owned GTID release status

Return values
trueremove the GTID owned by thread from owned GTIDs
falseremoval of the GTID owned by thread from owned GTIDs is not required

◆ ddl_is_atomic()

bool ddl_is_atomic ( const handlerton hton)
inline

◆ default_rm_tmp_tables()

bool default_rm_tmp_tables ( handlerton hton,
THD thd,
List< LEX_STRING > *  files 
)

Default implementation for handlerton::rm_tmp_tables() method which simply removes all files from "files" list which have one of SE's extensions.

This implementation corresponds to default implementation of handler::delete_table() method.

◆ get_canonical_filename()

const char * get_canonical_filename ( handler file,
const char *  path,
char *  tmp_path 
)

make canonical filename

Parameters
[in]filetable handler
[in]pathoriginal path
[out]tmp_pathbuffer for canonized path

Lower case db name and table name path parts for non file based tables when lower_case_table_names is 2 (store as is, compare in lower case). Filesystem path prefix (mysql_data_home or tmpdir) is left intact.

Note
tmp_path may be left intact if no conversion was performed.
Return values
canonizedpath

◆ get_default_handlerton()

handlerton * get_default_handlerton ( THD thd,
handlerton hton 
)
inline

Get default handlerton, if handler supplied is null.

Parameters
thdThread context.
htonThe handlerton passed.
Returns
pointer to handlerton.

◆ get_new_handler()

handler * get_new_handler ( TABLE_SHARE share,
bool  partitioned,
MEM_ROOT alloc,
handlerton db_type 
)

Create handler object for the table in the storage engine.

Parameters
shareTABLE_SHARE for the table, can be NULL if caller didn't perform full-blown open of table definition.
partitionedIndicates whether table is partitioned.
allocMemory root to be used for allocating handler object.
db_typeTable's storage engine.
Note
This function will try to use default storage engine if one which was specified through db_type parameter is not available.

◆ get_sweep_read_cost()

void get_sweep_read_cost ( TABLE table,
ha_rows  nrows,
bool  interrupted,
Cost_estimate cost 
)

Get cost of reading nrows table records in a "disk sweep".

A disk sweep read is a sequence of handler->rnd_pos(rowid) calls that made for an ordered sequence of rowids.

We take into account that some of the records might be in a memory buffer while others need to be read from a secondary storage device. The model for this assumes hard disk IO. A disk read is performed as follows:

  1. The disk head is moved to the needed cylinder
  2. The controller waits for the plate to rotate
  3. The data is transferred

Time to do #3 is insignificant compared to #2+#1.

Time to move the disk head is proportional to head travel distance.

Time to wait for the plate to rotate depends on whether the disk head was moved or not.

If disk head wasn't moved, the wait time is proportional to distance between the previous block and the block we're reading.

If the head was moved, we don't know how much we'll need to wait for the plate to rotate. We assume the wait time to be a variate with a mean of 0.5 of full rotation time.

Our cost units are "random disk seeks". The cost of random disk seek is actually not a constant, it depends one range of cylinders we're going to access. We make it constant by introducing a fuzzy concept of "typical datafile length" (it's fuzzy as it's hard to tell whether it should include index file, temp.tables etc). Then random seek cost is:

1 = half_rotation_cost + move_cost * 1/3 * typical_data_file_length

We define half_rotation_cost as disk_seek_base_cost() (see Cost_model_server::disk_seek_base_cost()).

Parameters
tableTable to be accessed
nrowsNumber of rows to retrieve
interruptedtrue <=> Assume that the disk sweep will be interrupted by other disk IO. false - otherwise.
[out]costthe cost

◆ ha_acl_notify()

void ha_acl_notify ( THD thd,
class Acl_change_notification data 
)

◆ ha_binlog_end()

int ha_binlog_end ( THD thd)

◆ ha_binlog_index_purge_file()

int ha_binlog_index_purge_file ( THD thd,
const char *  file 
)

Inform storage engine(s) that a binary log file will be purged and any references to it should be removed.

The function is called for all purged files, regardless if it is an explicit PURGE BINARY LOGS statement, or an automatic purge performed by the server.

Note
Since function is called with the LOCK_index mutex held the work performed in this callback should be kept at minimum. One way to defer work is to schedule work and use the ha_binlog_index_purge_wait callback to wait for completion.
Parameters
thdThread handle of session purging file. The nullptr value indicates that purge is done at server startup.
fileName of file being purged.
Returns
Always 0, return value are ignored by caller.

◆ ha_binlog_index_purge_wait()

void ha_binlog_index_purge_wait ( THD thd)

Request the storage engine to complete any operations that were initiated by ha_binlog_index_purge_file and which need to complete before PURGE BINARY LOGS completes.

The function is called only from PURGE BINARY LOGS. Each PURGE BINARY LOGS statement will result in 0, 1 or more calls to ha_binlog_index_purge_file, followed by exactly 1 call to ha_binlog_index_purge_wait.

Note
This function is called without LOCK_index mutex held and thus any waiting performed will only affect the current session.
Parameters
thdThread handle of session.

◆ ha_binlog_log_query()

void ha_binlog_log_query ( THD thd,
handlerton db_type,
enum_binlog_command  binlog_command,
const char *  query,
size_t  query_length,
const char *  db,
const char *  table_name 
)

◆ ha_binlog_wait()

void ha_binlog_wait ( THD thd)

◆ ha_change_key_cache()

int ha_change_key_cache ( KEY_CACHE old_key_cache,
KEY_CACHE new_key_cache 
)

Move all tables from one key cache to another one.

◆ ha_check_if_supported_system_table()

bool ha_check_if_supported_system_table ( handlerton hton,
const char *  db,
const char *  table_name 
)

Check if a given table is a system table.

The primary purpose of introducing this function is to stop system tables to be created or being moved to undesired storage engines.

Parameters
htonHandlerton of new engine.
dbDatabase name.
table_nameTable name to be checked.
Returns
Operation status
Return values
trueIf the table name is a valid system table or if its a valid user table.
falseIf the table name is a system table name and does not belong to engine specified in the command.

◆ ha_check_if_table_exists()

bool ha_check_if_table_exists ( THD thd,
const char *  db,
const char *  name,
bool *  exists 
)

Try to find a table in a storage engine.

Parameters
thdThread handle
dbNormalized table schema name
nameNormalized table name.
[out]existsOnly valid if the function succeeded.
Return values
trueAn error is found
falseSuccess, check *exists

◆ ha_check_reserved_db_name()

bool ha_check_reserved_db_name ( const char *  name)

Check if the database name is reserved word used by SE.

Parameters
nameDatabase name.
Return values
trueIf the name is a reserved word.
falseIf the name is not a reserved word.

◆ ha_check_storage_engine_flag()

static bool ha_check_storage_engine_flag ( const handlerton db_type,
uint32  flag 
)
inlinestatic

◆ ha_checktype()

handlerton * ha_checktype ( THD thd,
enum legacy_db_type  database_type,
bool  no_substitute,
bool  report_error 
)

Use other database handler if databasehandler is not compiled in.

◆ ha_close_connection()

void ha_close_connection ( THD thd)
Note
don't bother to rollback here, it's done already

◆ ha_commit_attachable()

int ha_commit_attachable ( THD thd)

Commit the attachable transaction in storage engines.

Note
This is slimmed down version of ha_commit_trans()/ha_commit_low() which commits attachable transaction but skips code which is unnecessary and unsafe for them (like dealing with GTIDs). Since attachable transactions are read-only their commit only needs to release resources and cleanup state in SE.
Parameters
thdCurrent thread
Return values
0- Success
non-0- Failure

◆ ha_commit_low()

int ha_commit_low ( THD thd,
bool  all,
bool  run_after_commit 
)

Commit the sessions outstanding transaction.

Precondition
thd->transaction.flags.commit_low == true
Postcondition
thd->transaction.flags.commit_low == false
Note
This function does not care about global read lock; the caller should.
Parameters
[in]thdThread handle.
[in]allIs set in case of explicit commit (COMMIT statement), or implicit commit issued by DDL. Is not set when called at the end of statement, even if autocommit=1.
[in]run_after_commitTrue by default, otherwise, does not execute the after_commit hook in the function.

◆ ha_commit_trans()

int ha_commit_trans ( THD thd,
bool  all,
bool  ignore_global_read_lock 
)
Parameters
[in]thdThread handle.
[in]allSession transaction if true, statement otherwise.
[in]ignore_global_read_lockAllow commit to complete even if a global read lock is active. This can be used to allow changes to internal tables (e.g. slave status tables).
Return values
0ok
1transaction was rolled back
2error during commit, data may be inconsistent

◆ ha_create_table()

int ha_create_table ( THD thd,
const char *  path,
const char *  db,
const char *  table_name,
HA_CREATE_INFO create_info,
bool  update_create_info,
bool  is_temp_table,
dd::Table table_def 
)

Initiates table-file and calls appropriate database-creator.

Parameters
thdThread context.
pathPath to table file (without extension).
dbDatabase name.
table_nameTable name.
create_infoHA_CREATE_INFO describing table.
update_create_infoIndicates that create_info needs to be updated from table share.
is_temp_tableIndicates that this is temporary table (for cases when this info is not available from HA_CREATE_INFO).
table_defData-dictionary object describing table to be used for table creation. Can be adjusted by storage engine if it supports atomic DDL. For non-temporary tables these changes will be saved to the data-dictionary by this call.
Return values
0ok
1error

◆ ha_create_table_from_engine()

int ha_create_table_from_engine ( THD thd,
const char *  db,
const char *  name 
)

Try to discover table from engine.

Note
If found, import the serialized dictionary information.
Return values
-1Table did not exists
0Table created ok
<blockquote>0Error, table existed but could not be created

◆ ha_default_handlerton()

handlerton * ha_default_handlerton ( THD thd)

Return the default storage engine handlerton used for non-temp tables for thread.

SYNOPSIS ha_default_handlerton(thd) thd current thread

RETURN pointer to handlerton

◆ ha_default_temp_handlerton()

handlerton * ha_default_temp_handlerton ( THD thd)

Return the default storage engine handlerton used for explicitly created temp tables for a thread.

SYNOPSIS ha_default_temp_handlerton(thd) thd current thread

RETURN pointer to handlerton

◆ ha_delete_table()

int ha_delete_table ( THD thd,
handlerton table_type,
const char *  path,
const char *  db,
const char *  alias,
const dd::Table table_def,
bool  generate_warning 
)

Delete table from the storage engine.

Parameters
thdThread context.
table_typeHandlerton for table's SE.
pathPath to table (without extension).
dbTable database.
aliasTable name.
table_defdd::Table object describing the table.
generate_warningIndicates whether errors during deletion should be reported as warnings.
Returns
0 - in case of success, non-0 in case of failure, ENOENT if the file doesn't exists.

◆ ha_drop_database()

void ha_drop_database ( char *  path)

◆ ha_enable_transaction()

int ha_enable_transaction ( THD thd,
bool  on 
)

Tell the storage engine that it is allowed to "disable transaction" in the handler.

It is a hint that ACID is not required - it is used in NDB for ALTER TABLE, for example, when data are copied to temporary table. A storage engine may treat this hint any way it likes. NDB for example starts to commit every now and then automatically. This hint can be safely ignored.

◆ ha_end()

void ha_end ( )

◆ ha_finalize_handlerton()

int ha_finalize_handlerton ( st_plugin_int plugin)

◆ ha_find_files()

int ha_find_files ( THD thd,
const char *  db,
const char *  path,
const char *  wild,
bool  dir,
List< LEX_STRING > *  files 
)

◆ ha_flush_logs()

bool ha_flush_logs ( bool  binlog_group_flush = false)

Flush the log(s) of storage engine(s).

Parameters
binlog_group_flushtrue if we got invoked by binlog group commit during flush stage, false in other cases.
Return values
falseSucceed
trueError

◆ ha_init()

int ha_init ( void  )

◆ ha_init_errors()

int ha_init_errors ( void  )

Register handler error messages for use with my_error().

Return values
0OK
!=0Error

◆ ha_init_key_cache()

int ha_init_key_cache ( std::string_view  name,
KEY_CACHE key_cache 
)

Init a key cache if it has not been initied before.

◆ ha_initialize_handlerton()

int ha_initialize_handlerton ( st_plugin_int plugin)

◆ ha_is_externally_disabled()

bool ha_is_externally_disabled ( const handlerton htnr)

Returns true if the storage engine of the handlerton argument has been listed in the disabled_storage_engines system variable.

Note
that the SE may still be internally enabled, that is HaIsInternallyEnabled may return true.

◆ ha_is_storage_engine_disabled()

bool ha_is_storage_engine_disabled ( handlerton se_engine)

◆ ha_kill_connection()

void ha_kill_connection ( THD thd)

◆ ha_known_exts()

TYPELIB * ha_known_exts ( )

◆ ha_legacy_type()

static enum legacy_db_type ha_legacy_type ( const handlerton db_type)
inlinestatic

◆ ha_lock_engine()

plugin_ref ha_lock_engine ( THD thd,
const handlerton hton 
)

◆ ha_notify_exclusive_mdl()

bool ha_notify_exclusive_mdl ( THD thd,
const MDL_key mdl_key,
ha_notification_type  notification_type,
bool *  victimized 
)

Notify/get permission from all interested storage engines before acquisition or after release of exclusive metadata lock on object represented by key.

Parameters
thdThread context.
mdl_keyMDL key identifying object on which exclusive lock is to be acquired/was released.
notification_typeIndicates whether this is pre-acquire or post-release notification.
victimized'true' if locking failed as we were selected as a victim in order to avoid possible deadlocks.

See

See also
handlerton::notify_exclusive_mdl for details about calling convention and error reporting.
Returns
False - if notification was successful/lock can be acquired, True - if it has failed/lock should not be acquired.

◆ ha_notify_table_ddl()

bool ha_notify_table_ddl ( THD thd,
const MDL_key mdl_key,
ha_notification_type  notification_type,
ha_ddl_type  ddl_type,
const char *  old_db_name,
const char *  old_table_name,
const char *  new_db_name,
const char *  new_table_name 
)

Notify/get permission from all interested storage engines before or after executed DDL (ALTER TABLE, RENAME TABLE, TRUNCATE TABLE) on the table identified by key.

Parameters
thdThread context.
mdl_keyMDL key identifying table.
notification_typeIndicates whether this is pre-DDL or post-DDL notification.
old_db_nameOld db name, used in RENAME DDL
old_table_nameOld table name, used in RENAME DDL
new_db_nameNew db name, used in RENAME DDL
new_table_nameNew table name, used in RENAME DDL

See

See also
handlerton::notify_alter_table for rationale, details about calling convention and error reporting.
Returns
False - if notification was successful/DDL can proceed. True - if it has failed/DDL should fail.

◆ ha_panic()

int ha_panic ( enum ha_panic_function  flag)

◆ ha_post_recover()

void ha_post_recover ( )

Perform SE-specific cleanup after recovery of transactions.

Note
SE supporting atomic DDL can use this method to perform post-DDL actions for DDL statements which were committed or rolled back during recovery stage.

◆ ha_pre_dd_shutdown()

void ha_pre_dd_shutdown ( void  )

Invoke handlerton::pre_dd_shutdown() on every storage engine plugin.

◆ ha_prepare_low()

int ha_prepare_low ( THD thd,
bool  all 
)

Prepares the underlying transaction of the THD session object parameter in the storage engines that participate in the transaction.

In case of failure, an error will be emitted by the function in the case of internally coordinated transactions. In the case of externally coordinated transactions (XA), the error treatment must follow the XA/Open specification and is handled by the Sql_cmd_xa_prepare class.

Parameters
thdThe THD session object holding the transaction to be prepared.
allWhether or not the prepare regards a full transaction or the statement being executed..
Returns
0 if the transaction was successfully prepared, non-zero otherwise.

◆ ha_recover()

int ha_recover ( Xid_commit_list commit_list = nullptr,
Xa_state_list xa_state_list = nullptr 
)

Stage of the recovery process where information is collected from the storage engines (SE), merged with information from the transaction coordinator (TC) and transactions states are determined and enforced.

Implemented heuristics is as follows:

  1. The commit_list parameter contains the set of internally coordinated transactions that the TC ensures were marked as committed.
  2. The xa_state_list parameter contains the list of externally coordinated transactions and their states, as recorded by the TC.
  3. For each SE: a. Collect list of transactions found in PREPARED_IN_TC state in the SE and merge it with the information collected from the TC, in xa_state_list. b. Retrieve the list of transactions found in prepared state in the SE.

    c. For each internally coordinated transactions found in prepared state:

    1. If the transaction is found in commit_list, commit it.
    2. If the transaction is NOT found in commit_list but tc_heuristic_recover = TC_HEURISTIC_RECOVER_COMMIT, commit it.
    3. Otherwise, roll it back.

    d. For each externally coordinated transactions found in prepared state:

    1. If the transaction isn't found in xa_state_list, roll it back.
    2. If the transaction is found in xa_state_list in COMMITTED state, commit it.
    3. If the transaction is found in xa_state_list in ROLLEDBACK state, roll it back.
    4. If the transaction is found in xa_state_list in PREPARED state, ensure that the transaction state in the SE is PREPARED_IN_TC.
Parameters
commit_listSet of XIDs of internally coordinated transactions found as been committed in the transaction coordinator state.
xa_state_listMap between XIDs and states of externally coordinated transactions as found in the internal transaction coordinator state.
Returns
0 if recovery was successful, non-zero otherwise.

◆ ha_release_savepoint()

int ha_release_savepoint ( THD thd,
SAVEPOINT sv 
)

◆ ha_reset_logs()

int ha_reset_logs ( THD thd)

◆ ha_reset_plugin_vars()

void ha_reset_plugin_vars ( THD thd)

◆ ha_reset_slave()

void ha_reset_slave ( THD thd)

◆ ha_resize_key_cache()

int ha_resize_key_cache ( KEY_CACHE key_cache)

Resize key cache.

◆ ha_resolve_by_legacy_type()

handlerton * ha_resolve_by_legacy_type ( THD thd,
enum legacy_db_type  db_type 
)

◆ ha_resolve_by_name()

plugin_ref ha_resolve_by_name ( THD thd,
const LEX_CSTRING name,
bool  is_temp_table 
)

Return the storage engine handlerton for the supplied name.

Parameters
thdCurrent thread. May be nullptr, (e.g. during initialize).
nameName of storage engine.
is_temp_tabletrue if table is a temporary table.
Returns
Pointer to storage engine plugin handle.

◆ ha_resolve_by_name_raw()

plugin_ref ha_resolve_by_name_raw ( THD thd,
const LEX_CSTRING name 
)

Resolve handlerton plugin by name, without checking for "DEFAULT" or HTON_NOT_USER_SELECTABLE.

Parameters
thdThread context.
namePlugin name.
Returns
plugin or NULL if not found.

◆ ha_resolve_storage_engine_name()

const char * ha_resolve_storage_engine_name ( const handlerton db_type)

◆ ha_rm_tmp_tables()

bool ha_rm_tmp_tables ( THD thd,
List< LEX_STRING > *  files 
)

Ask all SEs to drop all temporary tables which have been left from previous server run.

Used on server start-up.

Parameters
[in]thdThread context.
[in,out]filesList of files in directories for temporary files which match tmp_file_prefix and thus can belong to temporary tables. If any SE recognizes some file as belonging to temporary table in this SE and deletes the file it is also supposed to remove file from this list.

◆ ha_rollback_low()

int ha_rollback_low ( THD thd,
bool  all 
)

◆ ha_rollback_to_savepoint()

int ha_rollback_to_savepoint ( THD thd,
SAVEPOINT sv 
)

◆ ha_rollback_to_savepoint_can_release_mdl()

bool ha_rollback_to_savepoint_can_release_mdl ( THD thd)

Check if all storage engines used in transaction agree that after rollback to savepoint it is safe to release MDL locks acquired after savepoint creation.

Parameters
thdThe client thread that executes the transaction.
Returns
true - It is safe to release MDL locks. false - If it is not.

Checking whether it is safe to release metadata locks after rollback to savepoint in all the storage engines that are part of the transaction.

◆ ha_rollback_trans()

int ha_rollback_trans ( THD thd,
bool  all 
)

◆ ha_savepoint()

int ha_savepoint ( THD thd,
SAVEPOINT sv 
)
Note
according to the sql standard (ISO/IEC 9075-2:2003) section "4.33.4 SQL-statements and transaction states", SAVEPOINT is not transaction-initiating SQL-statement

◆ ha_secondary_engine_supports_ddl()

bool ha_secondary_engine_supports_ddl ( THD thd,
const LEX_CSTRING secondary_engine 
)
noexcept

◆ ha_show_status()

bool ha_show_status ( THD thd,
handlerton db_type,
enum ha_stat_type  stat 
)

◆ ha_start_consistent_snapshot()

int ha_start_consistent_snapshot ( THD thd)

◆ ha_storage_engine_is_enabled()

bool ha_storage_engine_is_enabled ( const handlerton db_type)
inline

Predicate to determine if a storage engine, represented by a handlerton*, is enabled.

Note
"Enabled" in this context refers only the state of the handlerton object, and does not consider the disabled_storage_engines system variable. This leads to the very counter-intuitive and confusing situation that it is possible for a storage engine to be enabled, but at the same time also be disabled.

◆ ha_table_exists_in_engine()

int ha_table_exists_in_engine ( THD thd,
const char *  db,
const char *  name 
)

◆ hton2plugin()

st_plugin_int * hton2plugin ( uint  slot)

Maps from slot to plugin. May return NULL if plugin has been unloaded.

◆ insert_hton2plugin()

st_plugin_int * insert_hton2plugin ( uint  slot,
st_plugin_int plugin 
)

For unit testing.

Insert plugin into arbitrary slot in array. Remove plugin from arbitrary slot in array.

◆ is_index_access_error()

bool is_index_access_error ( int  error)

Check whether an error is index access error or not after an index read.

Error other than HA_ERR_END_OF_FILE or HA_ERR_KEY_NOT_FOUND will stop next index read.

Parameters
errorHandler error code.
Return values
trueif error is different from HA_ERR_END_OF_FILE or HA_ERR_KEY_NOT_FOUND.
falseif error is HA_ERR_END_OF_FILE or HA_ERR_KEY_NOT_FOUND.

◆ MakeSecondaryEngineFlags() [1/2]

constexpr SecondaryEngineFlags MakeSecondaryEngineFlags ( )
inlineconstexpr

Creates an empty bitmap of access path types.

This is the base case for the function template with the same name below.

◆ MakeSecondaryEngineFlags() [2/2]

template<typename... Args>
constexpr SecondaryEngineFlags MakeSecondaryEngineFlags ( SecondaryEngineFlag  flag1,
Args...  rest 
)
constexpr

Creates a bitmap representing a set of access path types.

◆ num_hton2plugins()

size_t num_hton2plugins ( )

Returns the size of the array holding pointers to plugins.

◆ print_keydup_error() [1/4]

void print_keydup_error ( TABLE table,
KEY key,
const char *  msg,
myf  errflag 
)
inline

◆ print_keydup_error() [2/4]

void print_keydup_error ( TABLE table,
KEY key,
const char *  msg,
myf  errflag,
const char *  org_table_name 
)

Construct and emit duplicate key error message using information from table's record buffer.

Parameters
tableTABLE object which record buffer should be used as source for column values.
keyKey description.
msgError message template to which key value should be added.
errflagFlags for my_error() call.
org_table_nameThe original table name (if any)

◆ print_keydup_error() [3/4]

void print_keydup_error ( TABLE table,
KEY key,
myf  errflag 
)
inline

◆ print_keydup_error() [4/4]

void print_keydup_error ( TABLE table,
KEY key,
myf  errflag,
const char *  org_table_name 
)

Construct and emit duplicate key error message using information from table's record buffer.

See also
print_keydup_error(table, key, msg, errflag).

◆ remove_hton2plugin()

st_plugin_int * remove_hton2plugin ( uint  slot)

◆ secondary_engine_supports_ddl()

bool secondary_engine_supports_ddl ( const handlerton hton)
inline

◆ SecondaryEngineHandlerton()

const handlerton * SecondaryEngineHandlerton ( const THD thd)

Returns the handlerton of the secondary engine that is used in the session, or nullptr if a secondary engine is not used.

◆ set_externally_disabled_storage_engine_names()

void set_externally_disabled_storage_engine_names ( const char *  disabled_list)

Read a comma-separated list of storage engine names.

Look up each in the known list of canonical and legacy names. In case of a match; add both the canonical and the legacy name to disabled_se_names, which is a static vector of disabled storage engine names. If there is no match, the unmodified name is added to the vector.

◆ set_tx_isolation()

bool set_tx_isolation ( THD thd,
enum_tx_isolation  tx_isolation,
bool  one_shot 
)

Set the transaction isolation level for the next transaction and update session tracker information about the transaction isolation level.

Parameters
thdTHD session setting the tx_isolation.
tx_isolationThe isolation level to be set.
one_shotTrue if the isolation level should be restored to session default after finishing the transaction.

◆ table_case_name()

const char * table_case_name ( const HA_CREATE_INFO info,
const char *  name 
)

◆ trans_register_ha()

void trans_register_ha ( THD thd,
bool  all,
handlerton ht_arg,
const ulonglong trxid 
)

Register a storage engine for a transaction.

Transaction handling in the server

In each client connection, MySQL maintains two transactional states:

  • a statement transaction,
  • a standard, also called normal transaction.

Historical note

"Statement transaction" is a non-standard term that comes from the times when MySQL supported BerkeleyDB storage engine.

First of all, it should be said that in BerkeleyDB auto-commit mode auto-commits operations that are atomic to the storage engine itself, such as a write of a record, and are too high-granular to be atomic from the application perspective (MySQL). One SQL statement could involve many BerkeleyDB auto-committed operations and thus BerkeleyDB auto-commit was of little use to MySQL.

Secondly, instead of SQL standard savepoints, BerkeleyDB provided the concept of "nested transactions". In a nutshell, transactions could be arbitrarily nested, but when the parent transaction was committed or aborted, all its child (nested) transactions were handled committed or aborted as well. Commit of a nested transaction, in turn, made its changes visible, but not durable: it destroyed the nested transaction, all its changes would become available to the parent and currently active nested transactions of this parent.

So the mechanism of nested transactions was employed to provide "all or nothing" guarantee of SQL statements required by the standard. A nested transaction would be created at start of each SQL statement, and destroyed (committed or aborted) at statement end. Such nested transaction was internally referred to as a "statement transaction" and gave birth to the term.

(Historical note ends)

Since then a statement transaction is started for each statement that accesses transactional tables or uses the binary log. If the statement succeeds, the statement transaction is committed. If the statement fails, the transaction is rolled back. Commits of statement transactions are not durable – each such transaction is nested in the normal transaction, and if the normal transaction is rolled back, the effects of all enclosed statement transactions are undone as well. Technically, a statement transaction can be viewed as a savepoint which is maintained automatically in order to make effects of one statement atomic.

The normal transaction is started by the user and is ended usually upon a user request as well. The normal transaction encloses transactions of all statements issued between its beginning and its end. In autocommit mode, the normal transaction is equivalent to the statement transaction.

Since MySQL supports PSEA (pluggable storage engine architecture), more than one transactional engine can be active at a time. Hence transactions, from the server point of view, are always distributed. In particular, transactional state is maintained independently for each engine. In order to commit a transaction the two phase commit protocol is employed.

Not all statements are executed in context of a transaction. Administrative and status information statements do not modify engine data, and thus do not start a statement transaction and also have no effect on the normal transaction. Examples of such statements are SHOW STATUS and RESET REPLICA.

Similarly DDL statements are not transactional, and therefore a transaction is [almost] never started for a DDL statement. The difference between a DDL statement and a purely administrative statement though is that a DDL statement always commits the current transaction before proceeding, if there is any.

At last, SQL statements that work with non-transactional engines also have no effect on the transaction state of the connection. Even though they are written to the binary log, and the binary log is, overall, transactional, the writes are done in "write-through" mode, directly to the binlog file, followed with a OS cache sync, in other words, bypassing the binlog undo log (translog). They do not commit the current normal transaction. A failure of a statement that uses non-transactional tables would cause a rollback of the statement transaction, but in case there no non-transactional tables are used, no statement transaction is started.

Data layout

The server stores its transaction-related data in thd->transaction. This structure has two members of type THD_TRANS. These members correspond to the statement and normal transactions respectively:

  • thd->transaction.stmt contains a list of engines that are participating in the given statement
  • thd->transaction.all contains a list of engines that have participated in any of the statement transactions started within the context of the normal transaction. Each element of the list contains a pointer to the storage engine, engine-specific transactional data, and engine-specific transaction flags.

In autocommit mode thd->transaction.all is empty. Instead, data of thd->transaction.stmt is used to commit/rollback the normal transaction.

The list of registered engines has a few important properties:

  • no engine is registered in the list twice
  • engines are present in the list a reverse temporal order – new participants are always added to the beginning of the list.

Transaction life cycle

When a new connection is established, thd->transaction members are initialized to an empty state. If a statement uses any tables, all affected engines are registered in the statement engine list. In non-autocommit mode, the same engines are registered in the normal transaction list. At the end of the statement, the server issues a commit or a roll back for all engines in the statement list. At this point transaction flags of an engine, if any, are propagated from the statement list to the list of the normal transaction. When commit/rollback is finished, the statement list is cleared. It will be filled in again by the next statement, and emptied again at the next statement's end.

The normal transaction is committed in a similar way (by going over all engines in thd->transaction.all list) but at different times:

  • upon COMMIT SQL statement is issued by the user
  • implicitly, by the server, at the beginning of a DDL statement or SET AUTOCOMMIT={0|1} statement.

The normal transaction can be rolled back as well:

  • if the user has requested so, by issuing ROLLBACK SQL statement
  • if one of the storage engines requested a rollback by setting thd->transaction_rollback_request. This may happen in case, e.g., when the transaction in the engine was chosen a victim of the internal deadlock resolution algorithm and rolled back internally. When such a situation happens, there is little the server can do and the only option is to rollback transactions in all other participating engines. In this case the rollback is accompanied by an error sent to the user.

As follows from the use cases above, the normal transaction is never committed when there is an outstanding statement transaction. In most cases there is no conflict, since commits of the normal transaction are issued by a stand-alone administrative or DDL statement, thus no outstanding statement transaction of the previous statement exists. Besides, all statements that manipulate with the normal transaction are prohibited in stored functions and triggers, therefore no conflicting situation can occur in a sub-statement either. The remaining rare cases when the server explicitly has to commit the statement transaction prior to committing the normal one cover error-handling scenarios (see for example SQLCOM_LOCK_TABLES).

When committing a statement or a normal transaction, the server either uses the two-phase commit protocol, or issues a commit in each engine independently. The two-phase commit protocol is used only if:

  • all participating engines support two-phase commit (provide handlerton::prepare PSEA API call) and
  • transactions in at least two engines modify data (i.e. are not read-only).

Note that the two phase commit is used for statement transactions, even though they are not durable anyway. This is done to ensure logical consistency of data in a multiple- engine transaction. For example, imagine that some day MySQL supports unique constraint checks deferred till the end of statement. In such case a commit in one of the engines may yield ER_DUP_KEY, and MySQL should be able to gracefully abort statement transactions of other participants.

After the normal transaction has been committed, thd->transaction.all list is cleared.

When a connection is closed, the current normal transaction, if any, is rolled back.

Roles and responsibilities

The server has no way to know that an engine participates in the statement and a transaction has been started in it unless the engine says so. Thus, in order to be a part of a transaction, the engine must "register" itself. This is done by invoking trans_register_ha() server call. Normally the engine registers itself whenever handler::external_lock() is called. trans_register_ha() can be invoked many times: if an engine is already registered, the call does nothing. In case autocommit is not set, the engine must register itself twice – both in the statement list and in the normal transaction list. In which list to register is a parameter of trans_register_ha().

Note, that although the registration interface in itself is fairly clear, the current usage practice often leads to undesired effects. E.g. since a call to trans_register_ha() in most engines is embedded into implementation of handler::external_lock(), some DDL statements start a transaction (at least from the server point of view) even though they are not expected to. E.g. CREATE TABLE does not start a transaction, since handler::external_lock() is never called during CREATE TABLE. But CREATE TABLE ... SELECT does, since handler::external_lock() is called for the table that is being selected from. This has no practical effects currently, but must be kept in mind nevertheless.

Once an engine is registered, the server will do the rest of the work.

During statement execution, whenever any of data-modifying PSEA API methods is used, e.g. handler::write_row() or handler::update_row(), the read-write flag is raised in the statement transaction for the involved engine. Currently All PSEA calls are "traced", and the data can not be changed in a way other than issuing a PSEA call. Important: unless this invariant is preserved the server will not know that a transaction in a given engine is read-write and will not involve the two-phase commit protocol!

At the end of a statement, server call trans_commit_stmt is invoked. This call in turn invokes handlerton::prepare() for every involved engine. Prepare is followed by a call to handlerton::commit_one_phase() If a one-phase commit will suffice, handlerton::prepare() is not invoked and the server only calls handlerton::commit_one_phase(). At statement commit, the statement-related read-write engine flag is propagated to the corresponding flag in the normal transaction. When the commit is complete, the list of registered engines is cleared.

Rollback is handled in a similar fashion.

Additional notes on DDL and the normal transaction.

DDLs and operations with non-transactional engines do not "register" in thd->transaction lists, and thus do not modify the transaction state. Besides, each DDL in MySQL is prefixed with an implicit normal transaction commit (a call to trans_commit_implicit()), and thus leaves nothing to modify. However, as it has been pointed out with CREATE TABLE .. SELECT, some DDL statements can start a new transaction.

Behaviour of the server in this case is currently badly defined. DDL statements use a form of "semantic" logging to maintain atomicity: if CREATE TABLE .. SELECT failed, the newly created table is deleted. In addition, some DDL statements issue interim transaction commits: e.g. ALTER TABLE issues a commit after data is copied from the original table to the internal temporary table. Other statements, e.g. CREATE TABLE ... SELECT do not always commit after itself. And finally there is a group of DDL statements such as RENAME/DROP TABLE that doesn't start a new transaction and doesn't commit.

This diversity makes it hard to say what will happen if by chance a stored function is invoked during a DDL – whether any modifications it makes will be committed or not is not clear. Fortunately, SQL grammar of few DDLs allows invocation of a stored function.

A consistent behaviour is perhaps to always commit the normal transaction after all DDLs, just like the statement transaction is always committed at the end of all statements.

Every storage engine MUST call this function when it starts a transaction or a statement (that is it must be called both for the "beginning of transaction" and "beginning of statement"). Only storage engines registered for the transaction/statement will know when to commit/rollback it.

Note
trans_register_ha is idempotent - storage engine may register many times per transaction.

Variable Documentation

◆ binlog_format_names

const char* binlog_format_names[]
extern

◆ EXTRA_RECORDS

constexpr const ha_rows EXTRA_RECORDS {10}
constexpr

◆ FK_NAME_DEFAULT_SUFFIX

const LEX_CSTRING FK_NAME_DEFAULT_SUFFIX = {STRING_WITH_LEN("_fk_")}
static

Suffix for auto-generated foreign key names for tables in SE's which don't specify own suffix.

I.e. for foreign keys on tables in such SE's generated names follow (table name)FK_NAME_DEFAULT_SUFFIX(FK number) pattern.

◆ HA_CREATE_USED_AUTOEXTEND_SIZE

constexpr const uint64_t HA_CREATE_USED_AUTOEXTEND_SIZE {1ULL << 35}
constexpr

These flags convey that the options AUTOEXTEND_SIZE has been specified in the CREATE TABLE statement.

◆ HA_CREATE_USED_ENGINE_ATTRIBUTE

constexpr const uint64_t HA_CREATE_USED_ENGINE_ATTRIBUTE {1ULL << 32}
constexpr

◆ HA_CREATE_USED_READ_ONLY

constexpr const uint64_t HA_CREATE_USED_READ_ONLY {1ULL << 34}
constexpr

ALTER SCHEMA|DATABASE has an explicit READ_ONLY clause.

Implies HA_CREATE_USED_READ_ONLY.

◆ HA_CREATE_USED_SECONDARY_ENGINE_ATTRIBUTE

constexpr const uint64_t HA_CREATE_USED_SECONDARY_ENGINE_ATTRIBUTE {1ULL << 33}
constexpr

◆ HA_CREATE_USED_START_TRANSACTION

constexpr const uint64_t HA_CREATE_USED_START_TRANSACTION {1ULL << 31}
constexpr

This option is used to convey that the create table should not commit the operation and keep the transaction started.

◆ ha_row_type

const char* ha_row_type[]
extern

◆ HTON_FKS_NEED_DIFFERENT_PARENT_AND_SUPPORTING_KEYS

const uint32 HTON_FKS_NEED_DIFFERENT_PARENT_AND_SUPPORTING_KEYS
static
Initial value:
=
(1 << 3)

Storage engine does not support using the same key for both parent and supporting key, but requires the two to be different.

◆ HTON_FKS_WITH_ANY_PREFIX_SUPPORTING_KEYS

const uint32 HTON_FKS_WITH_ANY_PREFIX_SUPPORTING_KEYS = (1 << 2)
static

Storage engine supports non-hash keys which have common prefix with the foreign key as supporting keys for it.

If there are several such keys, one which shares biggest prefix with FK is chosen.

Storage engines which support foreign keys but do not have this flag set are assumed to require that supporting key contains full foreign key as its prefix.

◆ HTON_FKS_WITH_EXTENDED_PARENT_KEYS

const uint32 HTON_FKS_WITH_EXTENDED_PARENT_KEYS = (1 << 4)
static

Engine takes into account hidden part of key (coming from primary key) when determines if it can serve as parent key for a foreign key.

Implies HTON_FKS_WITH_PREFIX_PARENT_KEYS and is related to HTON_SUPPORTS_EXTENDED_KEYS.

◆ HTON_FKS_WITH_PREFIX_PARENT_KEYS

const uint32 HTON_FKS_WITH_PREFIX_PARENT_KEYS = (1 << 0)
static

Engine supports both unique and non-unique parent keys for foreign keys which contain full foreign key as its prefix.

Storage engines which support foreign keys but do not have this flag set are assumed to support only parent keys which are primary/unique and contain exactly the same columns as the foreign key, possibly, in different order.

◆ HTON_FKS_WITH_SUPPORTING_HASH_KEYS

const uint32 HTON_FKS_WITH_SUPPORTING_HASH_KEYS = (1 << 1)
static

Storage engine supports hash keys as supporting keys for foreign keys.

Hash key should contain all foreign key columns and only them (although in any order).

Storage engines which support foreign keys but do not have this flag set are assumed to not allow hash keys as supporting keys.

◆ HTON_NO_DEFAULT_ENGINE_SUPPORT

constexpr const decltype(handlerton::flags) HTON_NO_DEFAULT_ENGINE_SUPPORT {1 << 24}
inlineconstexpr

◆ HTON_SUPPORTS_BULK_LOAD

constexpr const decltype(handlerton::flags) HTON_SUPPORTS_BULK_LOAD {1 << 22}
constexpr

◆ HTON_SUPPORTS_DISTANCE_SCAN

constexpr const decltype(handlerton::flags) HTON_SUPPORTS_DISTANCE_SCAN
inlineconstexpr
Initial value:
{
1 << 23}

Engine supports index distance scan.

◆ HTON_SUPPORTS_ENGINE_ATTRIBUTE

constexpr const decltype(handlerton::flags) HTON_SUPPORTS_ENGINE_ATTRIBUTE
constexpr
Initial value:
{
1 << 17}

◆ HTON_SUPPORTS_GENERATED_INVISIBLE_PK

constexpr const decltype( handlerton::flags) HTON_SUPPORTS_GENERATED_INVISIBLE_PK {1 << 18}
constexpr

Engine supports Generated invisible primary key.

◆ MAX_FK_NAME_SUFFIX_LENGTH

const size_t MAX_FK_NAME_SUFFIX_LENGTH = 16
static

Maximum possible length of SE-specific suffixes for auto-generated foreign key names.

◆ MYSQL_START_TRANS_OPT_HIGH_PRIORITY

const uint MYSQL_START_TRANS_OPT_HIGH_PRIORITY = 8
static

◆ MYSQL_START_TRANS_OPT_READ_ONLY

const uint MYSQL_START_TRANS_OPT_READ_ONLY = 2
static

◆ MYSQL_START_TRANS_OPT_READ_WRITE

const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4
static

◆ MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT

const uint MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT = 1
static

Options for the START TRANSACTION statement.

Note that READ ONLY and READ WRITE are logically mutually exclusive. This is enforced by the parser and depended upon by trans_begin().

We need two flags instead of one in order to differentiate between situation when no READ WRITE/ONLY clause were given and thus transaction is implicitly READ WRITE and the case when READ WRITE clause was used explicitly.

◆ savepoint_alloc_size

ulong savepoint_alloc_size
extern

◆ SDI_TYPE_TABLE

constexpr const uint32 SDI_TYPE_TABLE = 1
constexpr

Id for identifying Table SDIs.

◆ SDI_TYPE_TABLESPACE

constexpr const uint32 SDI_TYPE_TABLESPACE = 2
constexpr

Id for identifying Tablespace SDIs.

◆ total_ha_2pc

ulong total_ha_2pc
extern

◆ tx_isolation_names

const char* tx_isolation_names[]
extern

◆ tx_isolation_typelib

TYPELIB tx_isolation_typelib
extern