MySQL 8.0.40
Source Code Documentation
|
The class defining a handle to an InnoDB table. More...
#include <ha_innodb.h>
Public Types | |
using | Reader = Parallel_reader_adapter |
Public Types inherited from handler | |
enum | enum_range_scan_direction { RANGE_SCAN_ASC , RANGE_SCAN_DESC } |
enum | { NONE = 0 , INDEX , RND , SAMPLING } |
typedef ulonglong | Table_flags |
using | Load_init_cbk = std::function< bool(void *cookie, ulong ncols, ulong row_len, const ulong *col_offsets, const ulong *null_byte_offsets, const ulong *null_bitmasks)> |
This callback is called by each parallel load thread at the beginning of the parallel load for the adapter scan. More... | |
using | Load_cbk = std::function< bool(void *cookie, uint nrows, void *rowdata, uint64_t partition_id)> |
This callback is called by each parallel load thread when processing of rows is required for the adapter scan. More... | |
using | Load_end_cbk = std::function< void(void *cookie)> |
This callback is called by each parallel load thread when processing of rows has ended for the adapter scan. More... | |
typedef void(* | my_gcolumn_template_callback_t) (const TABLE *, void *) |
Callback function that will be called by my_prepare_gcolumn_template once the table has been opened. More... | |
Public Member Functions | |
ha_innobase (handlerton *hton, TABLE_SHARE *table_arg) | |
Construct ha_innobase handler. More... | |
~ha_innobase () override=default | |
row_type | get_real_row_type (const HA_CREATE_INFO *create_info) const override |
Get real row type for the table created based on one specified by user, CREATE TABLE options and SE capabilities. More... | |
const char * | table_type () const override |
Returns the table type (storage engine name). More... | |
enum ha_key_alg | get_default_index_algorithm () const override |
Get default key algorithm for SE. More... | |
bool | is_index_algorithm_supported (enum ha_key_alg key_alg) const override |
Check if SE supports specific key algorithm. More... | |
Table_flags | table_flags () const override |
Get the table flags to use for the statement. More... | |
ulong | index_flags (uint idx, uint part, bool all_parts) const override |
Returns the operations supported for indexes. More... | |
uint | max_supported_keys () const override |
Returns the maximum number of keys. More... | |
uint | max_supported_key_length () const override |
Returns the maximum key length. More... | |
uint | max_supported_key_part_length (HA_CREATE_INFO *create_info) const override |
int | open (const char *name, int, uint open_flags, const dd::Table *table_def) override |
Open an InnoDB table. More... | |
handler * | clone (const char *name, MEM_ROOT *mem_root) override |
int | close (void) override |
Closes a handle to an InnoDB table. More... | |
double | scan_time () override |
How many seeks it will take to read through the table. More... | |
double | read_time (uint index, uint ranges, ha_rows rows) override |
Calculate the time it takes to read a set of ranges through an index This enables us to optimise reads for clustered indexes. More... | |
longlong | get_memory_buffer_size () const override |
Return the size of the InnoDB memory buffer. More... | |
int | write_row (uchar *buf) override |
Stores a row in an InnoDB database, to the table specified in this handle. More... | |
int | update_row (const uchar *old_data, uchar *new_data) override |
Updates a row given as a parameter to a new value. More... | |
int | delete_row (const uchar *buf) override |
Deletes a row given as the parameter. More... | |
int | delete_all_rows () override |
Delete all rows from the table. More... | |
bool | was_semi_consistent_read () override |
void | try_semi_consistent_read (bool yes) override |
Tell the engine whether it should avoid unnecessary lock waits. More... | |
void | unlock_row () override |
Removes a new lock set on a row, if it was not read optimistically. More... | |
int | index_init (uint index, bool sorted) override |
Initializes a handle to use an index. More... | |
int | index_end () override |
Currently does nothing. More... | |
int | index_read (uchar *buf, const uchar *key, uint key_len, ha_rkey_function find_flag) override |
Positions an index cursor to the index specified in the handle. More... | |
int | index_read_last (uchar *buf, const uchar *key, uint key_len) override |
The following functions works like index_read, but it find the last row with the current key value or prefix. More... | |
int | index_next (uchar *buf) override |
Reads the next row from a cursor, which must have previously been positioned using index_read. More... | |
int | index_next_same (uchar *buf, const uchar *key, uint keylen) override |
Reads the next row matching to the key value given as the parameter. More... | |
int | index_prev (uchar *buf) override |
Reads the previous row from a cursor, which must have previously been positioned using index_read. More... | |
int | index_first (uchar *buf) override |
Positions a cursor on the first record in an index and reads the corresponding row to buf. More... | |
int | index_last (uchar *buf) override |
Positions a cursor on the last record in an index and reads the corresponding row to buf. More... | |
int | read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range_arg, bool sorted) override |
Read first row between two ranges. More... | |
int | read_range_next () override |
Read next row between two endpoints. More... | |
int | rnd_init (bool scan) override |
Initialize a table scan. More... | |
int | rnd_end () override |
Ends a table scan. More... | |
int | rnd_next (uchar *buf) override |
Reads the next row in a table scan (also used to read the FIRST row in a table scan). More... | |
int | rnd_pos (uchar *buf, uchar *pos) override |
Fetches a row from the table based on a row reference. More... | |
int | ft_init () override |
Initialize FT index scan. More... | |
void | ft_end () |
FT_INFO * | ft_init_ext (uint flags, uint inx, String *key) override |
Initialize FT index scan. More... | |
FT_INFO * | ft_init_ext_with_hints (uint inx, String *key, Ft_hints *hints) override |
Initialize FT index scan. More... | |
int | ft_read (uchar *buf) override |
Fetch next result from the FT result set. More... | |
void | position (const uchar *record) override |
Store a reference to the current row to 'ref' field of the handle. More... | |
int | info (uint) override |
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. More... | |
int | enable_indexes (uint mode) override |
Enable indexes. More... | |
int | disable_indexes (uint mode) override |
Disable indexes. More... | |
int | analyze (THD *thd, HA_CHECK_OPT *check_opt) override |
Updates index cardinalities of the table, based on random dives into each index tree. More... | |
int | optimize (THD *thd, HA_CHECK_OPT *check_opt) override |
This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds the table in MySQL. More... | |
int | discard_or_import_tablespace (bool discard, dd::Table *table_def) override |
Discards or imports an InnoDB tablespace. More... | |
int | extra (ha_extra_function operation) override |
Tells something additional to the handler about how to do things. More... | |
int | reset () override |
MySQL calls this method at the end of each statement. More... | |
int | external_lock (THD *thd, int lock_type) override |
As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement (an exception is when MySQL calls start_stmt for the handle) we can use this function to store the pointer to the THD in the handle. More... | |
int | sample_init (void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method, const bool tablesample) override |
Initialize sampling. More... | |
int | sample_next (void *scan_ctx, uchar *buf) override |
Get the next record for sampling. More... | |
int | sample_end (void *scan_ctx) override |
End sampling. More... | |
int | start_stmt (THD *thd, thr_lock_type lock_type) override |
MySQL calls this function at the start of each SQL statement inside LOCK TABLES. More... | |
void | position (uchar *record) |
int | records (ha_rows *num_rows) override |
Returns the exact number of records that this client can see using this handler object. More... | |
ha_rows | records_in_range (uint inx, key_range *min_key, key_range *max_key) override |
Estimates the number of index records in a range. More... | |
ha_rows | estimate_rows_upper_bound () override |
Gives an UPPER BOUND to the number of rows in a table. More... | |
void | update_create_info (HA_CREATE_INFO *create_info) override |
Update create_info. More... | |
bool | get_se_private_data (dd::Table *dd_table, bool reset) override |
Get storage-engine private data for a data dictionary table. More... | |
int | get_extra_columns_and_keys (const HA_CREATE_INFO *, const List< Create_field > *, const KEY *, uint, dd::Table *dd_table) override |
Add hidden columns and indexes to an InnoDB table definition. More... | |
bool | upgrade_table (THD *thd, const char *db_name, const char *table_name, dd::Table *dd_table) override |
Set Engine specific data to dd::Table object for upgrade. More... | |
int | create (const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) override |
Create an InnoDB table. More... | |
int | delete_table (const char *name, const dd::Table *table_def) override |
Drop a table. More... | |
int | rename_table (const char *from, const char *to, const dd::Table *from_table, dd::Table *to_table) override |
Renames an InnoDB table. More... | |
int | check (THD *thd, HA_CHECK_OPT *check_opt) override |
Tries to check that an InnoDB table is not corrupted. More... | |
uint | lock_count (void) const override |
Returns number of THR_LOCK locks used for one instance of InnoDB table. More... | |
THR_LOCK_DATA ** | store_lock (THD *thd, THR_LOCK_DATA **to, thr_lock_type lock_type) override |
Supposed to convert a MySQL table lock stored in the 'lock' field of the handle to a proper type before storing pointer to the lock into an array of pointers. More... | |
void | init_table_handle_for_HANDLER () override |
Call this when you have opened a new table handle in HANDLER, before you call index_read_map() etc. More... | |
void | get_auto_increment (ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values) override |
Returns the value of the auto-inc counter in *first_value and ~0 on failure. More... | |
void | release_auto_increment () override |
Do cleanup for auto increment calculation. More... | |
bool | get_error_message (int error, String *buf) override |
See comment in handler.cc. More... | |
bool | get_foreign_dup_key (char *, uint, char *, uint) override |
Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_ERR_FOREIGN_DUPLICATE_KEY. More... | |
bool | primary_key_is_clustered () const override |
Determines if the primary key is clustered index. More... | |
int | cmp_ref (const uchar *ref1, const uchar *ref2) const override |
Compares two 'refs'. More... | |
enum_alter_inplace_result | check_if_supported_inplace_alter (TABLE *altered_table, Alter_inplace_info *ha_alter_info) override |
Check if InnoDB supports a particular alter table in-place. More... | |
bool | prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override |
Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK). More... | |
bool | inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override |
Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information. More... | |
bool | commit_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override |
Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine. More... | |
int | parallel_scan_init (void *&scan_ctx, size_t *num_threads, bool use_reserved_threads) override |
Initializes a parallel scan. More... | |
int | parallel_scan (void *scan_ctx, void **thread_ctxs, Reader::Init_fn init_fn, Reader::Load_fn load_fn, Reader::End_fn end_fn) override |
Start parallel read of InnoDB records. More... | |
void | parallel_scan_end (void *scan_ctx) override |
End of the parallel scan. More... | |
bool | check_if_incompatible_data (HA_CREATE_INFO *info, uint table_changes) override |
Part of old, deprecated in-place ALTER API. More... | |
Public Member Functions inherited from handler | |
void | unbind_psi () |
void | rebind_psi () |
void | start_psi_batch_mode () |
Put the handler in 'batch' mode when collecting table io instrumented events. More... | |
void | end_psi_batch_mode () |
End a batch started with start_psi_batch_mode . More... | |
bool | end_psi_batch_mode_if_started () |
If a PSI batch was started, turn if off. More... | |
handler (handlerton *ht_arg, TABLE_SHARE *share_arg) | |
virtual | ~handler (void) |
virtual std::string | explain_extra () const |
Return extra handler specific text for EXPLAIN. More... | |
void | init () |
This is called after create to allow us to set up cached variables. More... | |
void | ha_set_record_buffer (Record_buffer *buffer) |
Set a record buffer that the storage engine can use for multi-row reads. More... | |
Record_buffer * | ha_get_record_buffer () const |
Get the record buffer that was set with ha_set_record_buffer(). More... | |
bool | ha_is_record_buffer_wanted (ha_rows *const max_rows) const |
Does this handler want to get a Record_buffer for multi-row reads via the ha_set_record_buffer() function? And if so, what is the maximum number of records to allocate space for in the buffer? More... | |
int | ha_open (TABLE *table, const char *name, int mode, int test_if_locked, const dd::Table *table_def) |
int | ha_close (void) |
Close handler. More... | |
int | ha_index_init (uint idx, bool sorted) |
Initialize use of index. More... | |
int | ha_index_end () |
End use of index. More... | |
int | ha_rnd_init (bool scan) |
Initialize table for random read or scan. More... | |
int | ha_rnd_end () |
End use of random access. More... | |
int | ha_rnd_next (uchar *buf) |
Read next row via random scan. More... | |
int | ha_rnd_pos (uchar *buf, uchar *pos) |
Read row via random scan from position. More... | |
int | ha_index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Read [part of] row via [part of] index. More... | |
int | ha_index_read_last_map (uchar *buf, const uchar *key, key_part_map keypart_map) |
int | ha_index_read_idx_map (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Initializes an index and read it. More... | |
int | ha_index_next (uchar *buf) |
Reads the next row via index. More... | |
int | ha_index_prev (uchar *buf) |
Reads the previous row via index. More... | |
int | ha_index_first (uchar *buf) |
Reads the first row via index. More... | |
int | ha_index_last (uchar *buf) |
Reads the last row via index. More... | |
int | ha_index_next_same (uchar *buf, const uchar *key, uint keylen) |
Reads the next same row via index. More... | |
int | ha_reset () |
Check handler usage and reset state of file to after 'open'. More... | |
int | ha_index_or_rnd_end () |
Table_flags | ha_table_flags () const |
The cached_table_flags is set at ha_open and ha_external_lock. More... | |
int | ha_external_lock (THD *thd, int lock_type) |
These functions represent the public interface to users of the handler class, hence they are not virtual. More... | |
int | ha_write_row (uchar *buf) |
int | ha_update_row (const uchar *old_data, uchar *new_data) |
Update the current row. More... | |
int | ha_delete_row (const uchar *buf) |
void | ha_release_auto_increment () |
int | ha_check_for_upgrade (HA_CHECK_OPT *check_opt) |
int | ha_check (THD *thd, HA_CHECK_OPT *check_opt) |
to be actually called to get 'check()' functionality More... | |
int | ha_repair (THD *thd, HA_CHECK_OPT *check_opt) |
Repair table: public interface. More... | |
void | ha_start_bulk_insert (ha_rows rows) |
Start bulk insert. More... | |
int | ha_end_bulk_insert () |
End bulk insert. More... | |
int | ha_bulk_update_row (const uchar *old_data, uchar *new_data, uint *dup_key_found) |
Bulk update row: public interface. More... | |
int | ha_delete_all_rows () |
Delete all rows: public interface. More... | |
int | ha_truncate (dd::Table *table_def) |
Truncate table: public interface. More... | |
int | ha_optimize (THD *thd, HA_CHECK_OPT *check_opt) |
Optimize table: public interface. More... | |
int | ha_analyze (THD *thd, HA_CHECK_OPT *check_opt) |
Analyze table: public interface. More... | |
bool | ha_check_and_repair (THD *thd) |
Check and repair table: public interface. More... | |
int | ha_disable_indexes (uint mode) |
Disable indexes: public interface. More... | |
int | ha_enable_indexes (uint mode) |
Enable indexes: public interface. More... | |
int | ha_discard_or_import_tablespace (bool discard, dd::Table *table_def) |
Discard or import tablespace: public interface. More... | |
int | ha_rename_table (const char *from, const char *to, const dd::Table *from_table_def, dd::Table *to_table_def) |
Rename table: public interface. More... | |
int | ha_delete_table (const char *name, const dd::Table *table_def) |
Delete table: public interface. More... | |
void | ha_drop_table (const char *name) |
Drop table in the engine: public interface. More... | |
int | ha_create (const char *name, TABLE *form, HA_CREATE_INFO *info, dd::Table *table_def) |
Create a table in the engine: public interface. More... | |
int | ha_load_table (const TABLE &table) |
Loads a table into its defined secondary storage engine: public interface. More... | |
int | ha_unload_table (const char *db_name, const char *table_name, bool error_if_not_loaded) |
Unloads a table from its defined secondary storage engine: public interface. More... | |
bool | ha_get_se_private_data (dd::Table *dd_table, bool reset) |
Submit a dd::Table object representing a core DD table having hardcoded data to be filled in by the DDSE. More... | |
void | adjust_next_insert_id_after_explicit_value (ulonglong nr) |
int | update_auto_increment () |
virtual void | print_error (int error, myf errflag) |
Print error that we got from handler function. More... | |
uint | get_dup_key (int error) |
virtual void | change_table_ptr (TABLE *table_arg, TABLE_SHARE *share) |
Change the internal TABLE_SHARE pointer. More... | |
const TABLE_SHARE * | get_table_share () const |
virtual double | index_only_read_time (uint keynr, double records) |
Calculate cost of 'index only' scan for given index and number of records. More... | |
virtual Cost_estimate | table_scan_cost () |
Cost estimate for doing a complete table scan. More... | |
virtual Cost_estimate | index_scan_cost (uint index, double ranges, double rows) |
Cost estimate for reading a number of ranges from an index. More... | |
virtual Cost_estimate | read_cost (uint index, double ranges, double rows) |
Cost estimate for reading a set of ranges from the table using an index to access it. More... | |
virtual double | page_read_cost (uint index, double reads) |
Cost estimate for doing a number of non-sequentially accesses against the storage engine. More... | |
virtual double | worst_seek_times (double reads) |
Provide an upper cost-limit of doing a specified number of seek-and-read key lookups. More... | |
double | table_in_memory_estimate () const |
Return an estimate of how much of the table that is currently stored in main memory. More... | |
double | index_in_memory_estimate (uint keyno) const |
Return an estimate of how much of the index that is currently stored in main memory. More... | |
int | ha_sample_init (void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method, const bool tablesample) |
Initialize sampling. More... | |
int | ha_sample_next (void *scan_ctx, uchar *buf) |
Get the next record for sampling. More... | |
int | ha_sample_end (void *scan_ctx) |
End sampling. More... | |
int | ha_multi_range_read_next (char **range_info) |
int | ha_read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted) |
int | ha_read_range_next () |
bool | has_transactions () |
virtual uint | extra_rec_buf_length () const |
virtual bool | is_ignorable_error (int error) |
Determine whether an error can be ignored or not. More... | |
virtual bool | is_fatal_error (int error) |
Determine whether an error is fatal or not. More... | |
int | ha_records (ha_rows *num_rows) |
Wrapper function to call records() in storage engine. More... | |
int | ha_records (ha_rows *num_rows, uint index) |
Wrapper function to call records_from_index() in storage engine. More... | |
virtual void | column_bitmaps_signal () |
Signal that the table->read_set and table->write_set table maps changed The handler is allowed to set additional bits in the above map in this call. More... | |
uint | get_index (void) const |
virtual bool | start_bulk_update () |
virtual bool | start_bulk_delete () |
virtual int | exec_bulk_update (uint *dup_key_found) |
After this call all outstanding updates must be performed. More... | |
virtual void | end_bulk_update () |
Perform any needed clean-up, no outstanding updates are there at the moment. More... | |
virtual int | end_bulk_delete () |
Execute all outstanding deletes and close down the bulk delete. More... | |
void | set_end_range (const key_range *range, enum_range_scan_direction direction) |
Set the end position for a range scan. More... | |
int | compare_key (key_range *range) |
Compare if found key (in row) is over max-value. More... | |
int | compare_key_icp (const key_range *range) const |
int | compare_key_in_buffer (const uchar *buf) const |
Check if the key in the given buffer (which is not necessarily TABLE::record[0]) is within range. More... | |
int | ha_ft_read (uchar *buf) |
int | ha_read_first_row (uchar *buf, uint primary_key) |
Read first row (only) from a table. More... | |
virtual int | rnd_pos_by_record (uchar *record) |
This function only works for handlers having HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set. More... | |
virtual uint32 | calculate_key_hash_value (Field **field_array) |
int | ha_extra (enum ha_extra_function operation) |
Request storage engine to do an extra operation: enable,disable or run some functionality. More... | |
virtual int | extra_opt (enum ha_extra_function operation, ulong cache_size) |
virtual const handlerton * | hton_supporting_engine_pushdown () |
Get the handlerton of the storage engine if the SE is capable of pushing down some of the AccessPath functionality. More... | |
virtual bool | start_read_removal (void) |
Start read (before write) removal on the current table. More... | |
virtual ha_rows | end_read_removal (void) |
End read (before write) removal and return the number of rows really written. More... | |
void | set_next_insert_id (ulonglong id) |
void | restore_auto_increment (ulonglong prev_insert_id) |
virtual int | assign_to_keycache (THD *, HA_CHECK_OPT *) |
virtual int | preload_keys (THD *, HA_CHECK_OPT *) |
virtual int | indexes_are_disabled (void) |
Check if indexes are disabled. More... | |
virtual void | append_create_info (String *packet) |
uint | max_record_length () const |
uint | max_keys () const |
uint | max_key_parts () const |
uint | max_key_length () const |
uint | max_key_part_length (HA_CREATE_INFO *create_info) const |
virtual uint | max_supported_record_length () const |
virtual uint | max_supported_key_parts () const |
virtual uint | min_record_length (uint options) const |
virtual bool | low_byte_first () const |
virtual ha_checksum | checksum () const |
virtual bool | is_crashed () const |
Check if the table is crashed. More... | |
virtual bool | auto_repair () const |
Check if the table can be automatically repaired. More... | |
virtual const Item * | cond_push (const Item *cond) |
Push condition down to the table handler. More... | |
virtual void | cancel_pushed_idx_cond () |
Reset information about pushed index conditions. More... | |
virtual uint | number_of_pushed_joins () const |
Reports number of tables included in pushed join which this handler instance is part of. More... | |
virtual const TABLE * | member_of_pushed_join () const |
If this handler instance is part of a pushed join sequence returned TABLE instance being root of the pushed query? More... | |
virtual const TABLE * | parent_of_pushed_join () const |
If this handler instance is a child in a pushed join sequence returned TABLE instance being my parent? More... | |
virtual table_map | tables_in_pushed_join () const |
int | ha_index_read_pushed (uchar *buf, const uchar *key, key_part_map keypart_map) |
int | ha_index_next_pushed (uchar *buf) |
bool | ha_prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) |
Public functions wrapping the actual handler call. More... | |
bool | ha_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) |
Public function wrapping the actual handler call. More... | |
bool | ha_commit_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_table_def, dd::Table *new_table_def) |
Public function wrapping the actual handler call. More... | |
void | ha_notify_table_changed (Alter_inplace_info *ha_alter_info) |
Public function wrapping the actual handler call. More... | |
virtual void | use_hidden_primary_key () |
use_hidden_primary_key() is called in case of an update/delete when (table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined but we don't have a primary key More... | |
virtual int | bulk_update_row (const uchar *old_data, uchar *new_data, uint *dup_key_found) |
This method is similar to update_row, however the handler doesn't need to execute the updates at this point in time. More... | |
virtual int | truncate (dd::Table *table_def) |
Quickly remove all rows from a table. More... | |
virtual bool | check_and_repair (THD *thd) |
Check and repair the table if necessary. More... | |
virtual void | drop_table (const char *name) |
virtual bool | set_ha_share_ref (Handler_share **arg_ha_share) |
void | set_ha_table (TABLE *table_arg) |
int | get_lock_type () const |
virtual Partition_handler * | get_partition_handler () |
bool | ha_upgrade_table (THD *thd, const char *dbname, const char *table_name, dd::Table *dd_table, TABLE *table_arg) |
Set se_private_id and se_private_data during upgrade. More... | |
void | ha_set_primary_handler (handler *primary_handler) |
Store a pointer to the handler of the primary table that corresponds to the secondary table in this handler. More... | |
handler * | ha_get_primary_handler () const |
Get a pointer to a handler for the table in the primary storage engine, if this handler is for a table in a secondary storage engine. More... | |
void | ha_mv_key_capacity (uint *num_keys, size_t *keys_length) const |
Return max limits for a single set of multi-valued keys. More... | |
virtual void | set_external_table_offload_error (const char *) |
Propagates the secondary storage engine offload failure reason for a query to the external engine when the offloaded query fails in the secondary storage engine. More... | |
virtual void | external_table_offload_error () const |
Identifies and throws the propagated external engine query offload or exec failure reason given by the external engine handler. More... | |
Protected Member Functions | |
int | delete_table (const char *name, const dd::Table *table_def, enum enum_sql_command sqlcom) |
Drop a table. More... | |
int | srv_concurrency_enter () |
Enter InnoDB engine after checking max allowed threads. More... | |
void | srv_concurrency_exit () |
Leave Innodb, if no more tickets are left. More... | |
void | update_thd (THD *thd) |
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed, and updates the transaction fields in the m_prebuilt struct. More... | |
int | general_fetch (uchar *buf, uint direction, uint match_mode) |
Reads the next or previous row from a cursor, which must have previously been positioned using index_read. More... | |
virtual dict_index_t * | innobase_get_index (uint keynr) |
Get the index for a handle. More... | |
void | build_template (bool whole_row) |
Builds a 'template' to the m_prebuilt struct. More... | |
virtual int | info_low (uint flag, bool is_analyze) |
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. More... | |
int | end_stmt () |
MySQL calls this method at the end of each statement. More... | |
template<typename Table > | |
bool | prepare_inplace_alter_table_impl (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const Table *old_dd_tab, Table *new_dd_tab) |
Implementation of prepare_inplace_alter_table() More... | |
template<typename Table > | |
bool | inplace_alter_table_impl (TABLE *altered_table, Alter_inplace_info *ha_alter_info) |
Implementation of inplace_alter_table() More... | |
template<typename Table > | |
bool | commit_inplace_alter_table_impl (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, Table *new_dd_tab) |
Implementation of commit_inplace_alter_table() More... | |
void | mv_key_capacity (uint *num_keys, size_t *keys_length) const override |
Return max limits for a single set of multi-valued keys. More... | |
virtual bool | can_reuse_mysql_template () const |
Can reuse the template. More... | |
Protected Member Functions inherited from handler | |
virtual int | records_from_index (ha_rows *num_rows, uint index) |
Number of rows in table counted using the secondary index chosen by optimizer. More... | |
virtual int | index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Positions an index cursor to the index specified in the handle ('active_index'). More... | |
virtual int | index_read_idx_map (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Positions an index cursor to the index specified in argument. More... | |
virtual int | index_read_last_map (uchar *buf, const uchar *key, key_part_map keypart_map) |
The following functions works like index_read, but it find the last row with the current key value or prefix. More... | |
virtual int | index_read_pushed (uchar *, const uchar *, key_part_map) |
virtual int | index_next_pushed (uchar *) |
virtual void | notify_table_changed (Alter_inplace_info *ha_alter_info) |
Notify the storage engine that the table definition has been updated. More... | |
void | ha_statistic_increment (ulonglong System_status_var::*offset) const |
THD * | ha_thd () const |
PSI_table_share * | ha_table_share_psi (const TABLE_SHARE *share) const |
Acquire the instrumented table information from a table share. More... | |
Handler_share * | get_ha_share_ptr () |
Get an initialized ha_share. More... | |
void | set_ha_share_ptr (Handler_share *arg_ha_share) |
Set ha_share to be used by all instances of the same table/partition. More... | |
void | lock_shared_ha_data () |
Take a lock for protecting shared handler data. More... | |
void | unlock_shared_ha_data () |
Release lock for protecting ha_share. More... | |
Protected Attributes | |
DsMrr_impl | m_ds_mrr |
The multi range read session object. More... | |
row_prebuilt_t * | m_prebuilt |
Save CPU time with prebuilt/cached data structures. More... | |
THD * | m_user_thd |
Thread handle of the user currently using the handler; this is set in external_lock function. More... | |
INNOBASE_SHARE * | m_share |
information for MySQL table locking More... | |
uchar * | m_upd_buf |
buffer used in updates More... | |
ulint | m_upd_buf_size |
the size of upd_buf in bytes More... | |
Table_flags | m_int_table_flags |
Flags that specify the handler instance (table) capability. More... | |
bool | m_start_of_scan |
this is set to 1 when we are starting a table scan but have not yet fetched any row, else false More... | |
uint | m_last_match_mode {0} |
ulint | m_stored_select_lock_type |
this field is used to remember the original select_lock_type that was decided in ha_innodb.cc,":: store_lock()", "::external_lock()", etc. More... | |
bool | m_mysql_has_locked |
If mysql has locked with external_lock() More... | |
Protected Attributes inherited from handler | |
TABLE_SHARE * | table_share |
TABLE * | table |
Table_flags | cached_table_flags {0} |
ha_rows | estimation_rows_to_insert |
KEY_PART_INFO * | range_key_part |
bool | eq_range |
bool | in_range_check_pushed_down |
Private Member Functions | |
void | update_thd () |
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed, and updates the transaction fields in the m_prebuilt struct. More... | |
int | change_active_index (uint keynr) |
Changes the active index of a handle. More... | |
dberr_t | innobase_lock_autoinc () |
This special handling is really to overcome the limitations of MySQL's binlogging. More... | |
dberr_t | innobase_set_max_autoinc (ulonglong auto_inc) |
Store the autoinc value in the table. More... | |
dberr_t | innobase_get_autoinc (ulonglong *value) |
Read the next autoinc value. More... | |
void | innobase_initialize_autoinc () |
Set the autoinc column max value. More... | |
void | reset_template () |
Resets a query execution 'template'. More... | |
int | intrinsic_table_write_row (uchar *record) |
Write Row Interface optimized for Intrinsic table. More... | |
bool | is_record_buffer_wanted (ha_rows *const max_rows) const override |
Find out if a Record_buffer is wanted by this handler, and what is the maximum buffer size the handler wants. More... | |
int | truncate_impl (const char *name, TABLE *form, dd::Table *table_def) |
TRUNCATE an InnoDB table. More... | |
Multi Range Read interface | |
int | multi_range_read_init (RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf) override |
Initialize multi range read. More... | |
int | multi_range_read_next (char **range_info) override |
Process next multi range read. More... | |
ha_rows | multi_range_read_info_const (uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, bool *force_default_mrr, Cost_estimate *cost) override |
Initialize multi range read and get information. More... | |
ha_rows | multi_range_read_info (uint keyno, uint n_ranges, uint keys, uint *bufsz, uint *flags, Cost_estimate *cost) override |
Initialize multi range read and get information. More... | |
Item * | idx_cond_push (uint keyno, Item *idx_cond) override |
Attempt to push down an index condition. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from handler | |
static bool | my_prepare_gcolumn_template (THD *thd, const char *db_name, const char *table_name, my_gcolumn_template_callback_t myc, void *ib_table) |
Callback to allow InnoDB to prepare a template for generated column processing. More... | |
static bool | my_eval_gcolumn_expr_with_open (THD *thd, const char *db_name, const char *table_name, const MY_BITMAP *const fields, uchar *record, const char **mv_data_ptr, ulong *mv_length) |
Callback for generated columns processing. More... | |
static bool | my_eval_gcolumn_expr (THD *thd, TABLE *table, const MY_BITMAP *const fields, uchar *record, const char **mv_data_ptr, ulong *mv_length) |
Callback for computing generated column values. More... | |
Public Attributes inherited from handler | |
handlerton * | ht |
uchar * | ref |
Pointer to current row. More... | |
uchar * | dup_ref |
Pointer to duplicate row. More... | |
ha_statistics | stats |
range_seq_t | mrr_iter |
RANGE_SEQ_IF | mrr_funcs |
HANDLER_BUFFER * | multi_range_buffer |
uint | ranges_in_seq |
bool | mrr_is_output_sorted |
bool | mrr_have_range |
KEY_MULTI_RANGE | mrr_cur_range |
key_range * | end_range |
End value for a range scan. More... | |
bool | m_virt_gcol_in_end_range = false |
Flag which tells if end_range contains a virtual generated column. More... | |
uint | errkey |
uint | key_used_on_scan |
uint | active_index |
uint | ref_length |
Length of ref (1-8 or the clustered key length) More... | |
FT_INFO * | ft_handler |
enum handler:: { ... } | inited |
bool | implicit_emptied |
const Item * | pushed_cond |
Item * | pushed_idx_cond |
uint | pushed_idx_cond_keyno |
ulonglong | next_insert_id |
next_insert_id is the next value which should be inserted into the auto_increment column: in a inserting-multi-row statement (like INSERT SELECT), for the first row where the autoinc value is not specified by the statement, get_auto_increment() called and asked to generate a value, next_insert_id is set to the next value, then for all other rows next_insert_id is used (and increased each time) without calling get_auto_increment(). More... | |
ulonglong | insert_id_for_cur_row |
insert id for the current row (autogenerated; if not autogenerated, it's 0). More... | |
Discrete_interval | auto_inc_interval_for_cur_row |
Interval returned by get_auto_increment() and being consumed by the inserter. More... | |
uint | auto_inc_intervals_count |
Number of reserved auto-increment intervals. More... | |
PSI_table * | m_psi |
Instrumented table associated with this handler. More... | |
std::mt19937 | m_random_number_engine |
double | m_sampling_percentage |
The class defining a handle to an InnoDB table.
ha_innobase::ha_innobase | ( | handlerton * | hton, |
TABLE_SHARE * | table_arg | ||
) |
Construct ha_innobase handler.
|
overridedefault |
|
overridevirtual |
Updates index cardinalities of the table, based on random dives into each index tree.
This does NOT calculate exact statistics on the table.
thd | in: connection thread handle |
check_opt | in: currently ignored |
Reimplemented from handler.
|
protected |
Builds a 'template' to the m_prebuilt struct.
The template is used in fast retrieval of just those column values MySQL needs in its processing.
[in] | whole_row | true if access is needed to a whole row, false if accessing individual fields is enough |
|
inlineprotectedvirtual |
Can reuse the template.
Mainly used for partition.
true | Can reuse the mysql_template |
Reimplemented in ha_innopart.
|
private |
Changes the active index of a handle.
keynr | in: use this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB |
|
overridevirtual |
Tries to check that an InnoDB table is not corrupted.
If corruption is noticed, prints to stderr information about it. In case of corruption may also assert a failure and crash the server.
thd | in: user thread handle |
check_opt | in: check options |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Part of old, deprecated in-place ALTER API.
Reimplemented from handler.
Reimplemented in ha_innopart.
name | in: table name |
mem_root | in: memory context |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Compares two 'refs'.
A 'ref' is the (internal) primary key value of the row. If there is no explicitly declared non-null unique key or a primary key, then InnoDB internally uses the row id as the primary key.
ref1 | in: an (internal) primary key value in the MySQL key value format |
ref2 | in: an (internal) primary key value in the MySQL key value format |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
protected |
Implementation of commit_inplace_alter_table()
Table | dd::Table or dd::Partition |
[in] | altered_table | TABLE object for new version of table. |
[in,out] | ha_alter_info | Structure describing changes to be done by ALTER TABLE and holding data used during in-place alter. |
[in] | commit | True to commit or false to rollback. |
[in,out] | new_dd_tab | Table object for the new version of the table. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement version of it. |
true | Failure |
false | Success |
|
overridevirtual |
Create an InnoDB table.
[in] | name | table name in filename-safe encoding |
[in] | form | table structure |
[in] | create_info | more information on the table |
[in,out] | table_def | dd::Table describing table to be created. Can be adjusted by SE, the changes will be saved into data-dictionary at statement commit time. |
0 | on success |
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Delete all rows from the table.
HA_ERR_WRONG_COMMAND | if the table is transactional |
0 | on success |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Deletes a row given as the parameter.
record | in: a row in MySQL format |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Drop a table.
[in] | name | table name |
[in] | table_def | dd::Table describing table to be dropped |
0 | on success |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
protected |
Drop a table.
[in] | name | table name |
[in] | table_def | dd::Table describing table to be dropped |
[in] | sqlcom | type of operation that the DROP is part of |
0 | on success |
|
overridevirtual |
Disable indexes.
[in] | mode | disable index mode. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Discards or imports an InnoDB tablespace.
[in] | discard | true if discard, else import |
[in,out] | table_def | dd::Table describing table which tablespace is to be imported or discarded. Can be adjusted by SE, the changes will be saved into the data-dictionary at statement commit time. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Enable indexes.
[in] | mode | enable index mode. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
protected |
MySQL calls this method at the end of each statement.
This method exists for readability only, called from reset(). The name reset() doesn't give any clue that it is called at the end of a statement.
This method exists for readability only. ha_innobase::reset() doesn't give any clue about the method.
|
overridevirtual |
Gives an UPPER BOUND to the number of rows in a table.
This is used in filesort.cc.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement (an exception is when MySQL calls start_stmt for the handle) we can use this function to store the pointer to the THD in the handle.
We will also use this function to communicate to InnoDB that a new SQL statement has started and that we must store a savepoint to our transaction handle, so that we are able to roll back the SQL statement in case of an error.
To limit range of circumstances under which transaction's isolation level can be compromised, we allow disabling readlocks only for DD and ACL tables.
thd | in: handle to the user thread |
lock_type | in: lock type |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Tells something additional to the handler about how to do things.
operation | in: HA_EXTRA_FLUSH or some other flag |
Reimplemented from handler.
Reimplemented in ha_innopart.
void ha_innobase::ft_end | ( | ) |
|
overridevirtual |
Initialize FT index scan.
Reimplemented from handler.
Reimplemented in ha_innopart.
Initialize FT index scan.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Initialize FT index scan.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Fetch next result from the FT result set.
buf | in/out: buf contain result row |
Reimplemented from handler.
Reimplemented in ha_innopart.
Reads the next or previous row from a cursor, which must have previously been positioned using index_read.
buf | in/out: buffer for next row in MySQL format |
direction | in: ROW_SEL_NEXT or ROW_SEL_PREV |
match_mode | in: 0, ROW_SEL_EXACT, or ROW_SEL_EXACT_PREFIX |
|
overridevirtual |
Returns the value of the auto-inc counter in *first_value and ~0 on failure.
The following logic is needed to avoid duplicate key error for autoincrement column.
(1) InnoDB gives the current autoincrement value with respect to increment and offset value.
(2) Basically it does compute_next_insert_id() logic inside InnoDB to avoid the current auto increment value changed by handler layer.
(3) It is restricted only for insert operations.
offset | in: table autoinc offset |
increment | in: table autoinc increment |
nb_desired_values | in: number of values reqd |
first_value | out: the autoinc value |
nb_reserved_values | out: count of reserved values |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
inlineoverridevirtual |
Get default key algorithm for SE.
It is used when user has not provided algorithm explicitly or when algorithm specified is not supported by SE.
Reimplemented from handler.
|
overridevirtual |
See comment in handler.cc.
Reimplemented from handler.
|
overridevirtual |
Add hidden columns and indexes to an InnoDB table definition.
[in,out] | dd_table | data dictionary cache object |
0 | on success |
Reimplemented from handler.
|
overridevirtual |
Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_ERR_FOREIGN_DUPLICATE_KEY.
If any of the names is not available, then this method will return false and will not change any of child_table_name or child_key_name.
[out] | child_table_name | Table name |
[in] | child_table_name_len | Table name buffer size |
[out] | child_key_name | Key name |
[in] | child_key_name_len | Key name buffer size |
true | table and key names were available and were written into the corresponding out parameters. |
false | table and key names were not available, the out parameters were not touched. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Return the size of the InnoDB memory buffer.
Reimplemented from handler.
|
overridevirtual |
Get real row type for the table created based on one specified by user, CREATE TABLE options and SE capabilities.
Reimplemented from handler.
|
overridevirtual |
Get storage-engine private data for a data dictionary table.
[in,out] | dd_table | data dictionary table definition |
reset | reset counters |
true | an error occurred |
false | success |
Reimplemented from handler.
Attempt to push down an index condition.
[in] | keyno | MySQL key number |
[in] | idx_cond | Index condition to be checked |
Reimplemented from handler.
|
overridevirtual |
|
overridevirtual |
Positions a cursor on the first record in an index and reads the corresponding row to buf.
buf | in/out: buffer for the row |
Reimplemented from handler.
Reimplemented in ha_innopart.
Returns the operations supported for indexes.
Implements handler.
|
overridevirtual |
Initializes a handle to use an index.
keynr | in: key (index) number |
sorted | in: 1 if result MUST be sorted according to index |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Positions a cursor on the last record in an index and reads the corresponding row to buf.
buf | in/out: buffer for the row |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Reads the next row from a cursor, which must have previously been positioned using index_read.
buf | in/out: buffer for next row in MySQL format |
Reimplemented from handler.
Reimplemented in ha_innopart.
Reads the next row matching to the key value given as the parameter.
buf | in/out: buffer for the row |
key | in: key value |
keylen | in: key value length |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Reads the previous row from a cursor, which must have previously been positioned using index_read.
buf | in/out: buffer for previous row in MySQL format |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Positions an index cursor to the index specified in the handle.
Fetches the row if any.
buf | in/out: buffer for the returned row |
key_ptr | in: key value; if this is NULL we position the cursor at the start or end of index; this can also contain an InnoDB row id, in which case key_len is the InnoDB row id length; the key value can also be a prefix of a full key value, and the last column can be a prefix of a full column |
key_len | in: key value length |
find_flag | in: search flags from my_base.h |
Reimplemented from handler.
|
overridevirtual |
The following functions works like index_read, but it find the last row with the current key value or prefix.
buf | out: fetched row |
key_ptr | in: key value, or a prefix of a full key value |
key_len | in: length of the key val or prefix in bytes |
Reimplemented from handler.
|
overridevirtual |
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object.
flag | in: what information is requested |
Implements handler.
|
protectedvirtual |
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object.
[in] | flag | what information is requested |
[in] | is_analyze | True if called from "::analyze()". |
Reimplemented in ha_innopart.
|
overridevirtual |
Call this when you have opened a new table handle in HANDLER, before you call index_read_map() etc.
Actually, we can let the cursor stay open even over a transaction commit! Then you should call this before every operation, fetch next etc. This function inits the necessary things even after a transaction commit.
Reimplemented from handler.
Read the next autoinc value.
Acquire the relevant locks before reading the AUTOINC value. If SUCCESS then the table AUTOINC mutex will be locked on return and all relevant locks acquired.
value | out: autoinc value |
|
protectedvirtual |
Get the index for a handle.
Does not change active index.
keynr | in: use this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB |
Reimplemented in ha_innopart.
|
private |
Set the autoinc column max value.
This should only be called from ha_innobase::open, therefore there's no need for a covering lock.
|
private |
This special handling is really to overcome the limitations of MySQL's binlogging.
We need to eliminate the non-determinism that will arise in INSERT ... SELECT type of statements, since MySQL binlog only stores the min value of the autoinc interval. Once that is fixed we can get rid of the special lock handling.
Store the autoinc value in the table.
The autoinc value is only set if it's greater than the existing autoinc value in the table.
auto_inc | in: value to store |
|
protected |
Implementation of inplace_alter_table()
Table | dd::Table or dd::Partition |
[in] | altered_table | TABLE object for new version of table. |
[in,out] | ha_alter_info | Structure describing changes to be done by ALTER TABLE and holding data used during in-place alter. the table. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time. |
true | Failure |
false | Success |
|
private |
Write Row Interface optimized for Intrinsic table.
Write Row interface optimized for intrinisc table.
[in] | record | a row in MySQL format. |
|
inlineoverridevirtual |
Check if SE supports specific key algorithm.
Reimplemented from handler.
|
overrideprivatevirtual |
Find out if a Record_buffer is wanted by this handler, and what is the maximum buffer size the handler wants.
[out] | max_rows | gets set to the maximum number of records to allocate space for in the buffer |
true | if the handler wants a buffer |
false | if the handler does not want a buffer |
Reimplemented from handler.
|
overridevirtual |
Returns number of THR_LOCK locks used for one instance of InnoDB table.
InnoDB no longer relies on THR_LOCK locks so 0 value is returned. Instead of THR_LOCK locks InnoDB relies on combination of metadata locks (e.g. for LOCK TABLES and DDL) and its own locking subsystem. Note that even though this method returns 0, SQL-layer still calls "::store_lock()", "::start_stmt()" and "::external_lock()" methods for InnoDB tables.
Reimplemented from handler.
|
overridevirtual |
Returns the maximum key length.
Reimplemented from handler.
|
overridevirtual |
Reimplemented from handler.
|
overridevirtual |
|
overrideprivatevirtual |
Initialize multi range read and get information.
Reimplemented from handler.
|
overrideprivatevirtual |
Initialize multi range read and get information.
Reimplemented from handler.
|
overrideprivatevirtual |
Initialize multi range read.
Multi Range Read interface, DS-MRR calls.
Reimplemented from handler.
|
overrideprivatevirtual |
|
overrideprotectedvirtual |
Return max limits for a single set of multi-valued keys.
[out] | num_keys | number of keys to store |
[out] | keys_length | total length of keys, bytes |
Reimplemented from handler.
|
overridevirtual |
Open an InnoDB table.
[in] | name | table name |
[in] | open_flags | flags for opening table from SQL-layer. |
[in] | table_def | dd::Table object describing table to be opened |
1 | if error |
0 | if success |
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds the table in MySQL.
thd | in: connection thread handle |
check_opt | in: currently ignored |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Start parallel read of InnoDB records.
[in] | scan_ctx | A scan context created by parallel_scan_init |
[in] | thread_ctxs | Context for each of the spawned threads |
[in] | init_fn | Callback called by each parallel load thread at the beginning of the parallel load. |
[in] | load_fn | Callback called by each parallel load thread when processing of rows is required. |
[in] | end_fn | Callback called by each parallel load thread when processing of rows has ended. |
0 | on success |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
End of the parallel scan.
[in] | scan_ctx | A scan context created by parallel_scan_init. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Initializes a parallel scan.
It creates a scan_ctx that has to be used across all parallel_scan methods. Also, gets the number of threads that would be spawned for parallel scan.
[out] | scan_ctx | A scan context created by this method that has to be used in parallel_scan |
[out] | num_threads | Number of threads to be spawned |
[in] | use_reserved_threads | true if reserved threads are to be used if we exhaust the max cap of number of parallel read threads that can be spawned at a time |
0 | on success |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Store a reference to the current row to 'ref' field of the handle.
Note that in the case where we have generated the clustered index for the table, the function parameter is illogical: we MUST ASSUME that 'record' is the current 'position' of the handle, because if row ref is actually the row id internally generated in InnoDB, then 'record' does not contain it. We just guess that the row id must be for the record where the handle was positioned the last time.
[in] | record | row in MySQL format |
Implements handler.
Reimplemented in ha_innopart.
void ha_innobase::position | ( | uchar * | record | ) |
|
protected |
Implementation of prepare_inplace_alter_table()
Table | dd::Table or dd::Partition |
[in] | altered_table | TABLE object for new version of table. |
[in,out] | ha_alter_info | Structure describing changes to be done by ALTER TABLE and holding data used during in-place alter. |
[in] | old_dd_tab | dd::Table object representing old version of the table |
[in,out] | new_dd_tab | dd::Table object representing new version of the table |
true | Failure |
false | Success |
< Index to be dropped
< Number of indexes to drop
< Indexes to be dropped
< Number of indexes to rename
< Foreign key constraints to drop
< Number of foreign keys to drop
< Foreign key constraints to drop
< Number of foreign keys to drop
< Table where indexes are created
|
overridevirtual |
|
overridevirtual |
Read first row between two ranges.
Store ranges for future calls to read_range_next.
start_key | Start key. Is 0 if no min range |
end_key | End key. Is 0 if no max range |
eq_range_arg | Set to 1 if start_key == end_key |
sorted | Set to 1 if result should be sorted per key |
0 | Found row |
HA_ERR_END_OF_FILE | No rows in range |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Read next row between two endpoints.
0 | Found row |
HA_ERR_END_OF_FILE | No rows in range |
Reimplemented from handler.
Reimplemented in ha_innopart.
Calculate the time it takes to read a set of ranges through an index This enables us to optimise reads for clustered indexes.
index | in: key number |
ranges | in: how many ranges |
rows | in: estimated number of rows in the ranges |
Reimplemented from handler.
|
overridevirtual |
Returns the exact number of records that this client can see using this handler object.
num_rows | out: number of rows |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Estimates the number of index records in a range.
keynr | in: index number |
min_key | in: start key value of the range, may also be 0 |
max_key | in: range end key val, may also be 0 |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Do cleanup for auto increment calculation.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Renames an InnoDB table.
[in] | from | Old name of the table. |
[in] | to | New name of the table. |
[in] | from_table_def | dd::Table object describing old version of table. |
[in,out] | to_table_def | dd::Table object describing version of table with new name. Can be updated by SE. Changes are persisted to the dictionary at statement commit time. |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
MySQL calls this method at the end of each statement.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
private |
Resets a query execution 'template'.
Resets some fields of a m_prebuilt struct.
The template is used in fast retrieval of just those column values MySQL needs in its processing.
|
overridevirtual |
Ends a table scan.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Initialize a table scan.
[in] | scan | whether this is a second call to rnd_init() without rnd_end() in between |
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Reads the next row in a table scan (also used to read the FIRST row in a table scan).
buf | in/out: returns the row in this buffer, in MySQL format |
Implements handler.
Reimplemented in ha_innopart.
Fetches a row from the table based on a row reference.
buf | in/out: buffer for the row |
pos | in: primary key value of the row in the MySQL format, or the row id if the clustered index was internally generated by InnoDB; the length of data in pos has to be ref_length |
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
End sampling.
[in] | scan_ctx | Scan context of the sampling |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Initialize sampling.
[out] | scan_ctx | A scan context created by this method that has to be used in sample_next |
[in] | sampling_percentage | percentage of records that need to be sampled |
[in] | sampling_seed | random seed that the random generator will use |
[in] | sampling_method | sampling method to be used; currently only SYSTEM sampling is supported |
[in] | tablesample | true if the sampling is for tablesample |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Get the next record for sampling.
[in] | scan_ctx | Scan context of the sampling |
[in] | buf | buffer to place the read record |
Buffer rows one by one
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
How many seeks it will take to read through the table.
This is to be comparable to the number returned by records_in_range so that we can decide if we should scan the table or use keys.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
protected |
Enter InnoDB engine after checking max allowed threads.
|
protected |
Leave Innodb, if no more tickets are left.
|
overridevirtual |
MySQL calls this function at the start of each SQL statement inside LOCK TABLES.
Inside LOCK TABLES the "::external_lock" method does not work to mark SQL statement borders. Note also a special case: if a temporary table is created inside LOCK TABLES, MySQL has not called external_lock() at all on that table. MySQL-5.0 also calls this before each statement in an execution of a stored procedure. To make the execution more deterministic for binlogging, MySQL-5.0 locks all tables involved in a stored procedure with full explicit table locks (thd_in_lock_tables(thd) holds in store_lock()) before executing the procedure.
[in] | thd | handle to the user thread |
[in] | lock_type | lock type |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Supposed to convert a MySQL table lock stored in the 'lock' field of the handle to a proper type before storing pointer to the lock into an array of pointers.
In practice, since InnoDB no longer relies on THR_LOCK locks and its lock_count() method returns 0 it just informs storage engine about type of THR_LOCK which SQL-layer would have acquired for this specific statement on this specific table. MySQL also calls this if it wants to reset some table locks to a not-locked state during the processing of an SQL query. An example is that during a SELECT the read lock is released early on the 'const' tables where we only fetch one row. MySQL does not call this when it releases all locks at the end of an SQL statement.
thd | in: user thread handle |
to | in: pointer to the current element in an array of pointers to lock structs; only used as return value |
lock_type | in: lock type to store in 'lock'; this may also be TL_IGNORE |
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Get the table flags to use for the statement.
Implements handler.
Reimplemented in ha_innopart.
|
overridevirtual |
TRUNCATE an InnoDB table.
[in] | name | table name |
[in] | form | table definition |
[in,out] | table_def | dd::Table describing table to be truncated. Can be adjusted by SE, the changes will be saved into the data-dictionary at statement commit time. |
0 | on success |
|
overridevirtual |
Tell the engine whether it should avoid unnecessary lock waits.
If yes, in an UPDATE or DELETE, if the row under the cursor was locked by another transaction, the engine may try an optimistic read of the last committed row value under the cursor.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Removes a new lock set on a row, if it was not read optimistically.
This can be called after a row has been read in the processing of an UPDATE or a DELETE query, when the record doesn't match the WHERE condition.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Update create_info.
Used in SHOW CREATE TABLE et al.
create_info | in/out: create info |
Reimplemented from handler.
Reimplemented in ha_innopart.
Updates a row given as a parameter to a new value.
Note that we are given whole rows, not just the fields which are updated: this incurs some overhead for CPU when we check which fields are actually updated. TODO: currently InnoDB does not prevent the 'Halloween problem': in a searched update a single row can get updated several times if its index columns are updated!
[in] | old_row | Old row contents in MySQL format |
[out] | new_row | Updated row contents in MySQL format |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
private |
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed, and updates the transaction fields in the m_prebuilt struct.
|
protected |
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed, and updates the transaction fields in the m_prebuilt struct.
thd | in: thd to use the handle |
|
overridevirtual |
Set Engine specific data to dd::Table object for upgrade.
[in,out] | thd | thread handle |
[in] | db_name | database name |
[in] | table_name | table name |
[in,out] | dd_table | data dictionary cache object |
Reimplemented from handler.
|
overridevirtual |
Normally, when running UPDATE or DELETE queries, we need to wait for other transactions to release their locks on a given row before we can read it and potentially update it. However, in READ UNCOMMITTED and READ COMMITTED, we can ignore these locks if we don't intend to modify the row (e.g., because it failed a WHERE). This is signaled through enabling “semi-consistent read”, by calling try_semi_consistent_read(true) (and then setting it back to false after finishing the query). If semi-consistent read is enabled, and we are in READ UNCOMMITTED or READ COMMITTED, the storage engine is permitted to return rows that are locked and thus un-updatable. If the optimizer doesn't want the row, e.g., because it got filtered out, it can call unlock_row() as usual. However, if it intends to update the row, it needs to call was_semi_consistent_read() before doing so. If was_semi_consistent_read() returns false, the row was never locked to begin with and can be updated as usual. However, if it returns 1, it was read optimistically, must be discarded (ie., do not try to update the row) and must be re-read with locking enabled. The next read call after was_semi_consistent_read() will automatically re-read the same row, this time with locking enabled. Thus, typical use in an UPDATE scenario would look like this: file->try_semi_consistent_read(true); file->ha_rnd_init(true); while (file->ha_rnd_next(table->record[0]) == 0) { if (row is filtered...) { file->unlock_row(); continue; } if (file->was_semi_consistent_read()) {
Discard the row; next ha_rnd_next() will read it again with locking. continue; } Process row here. } file->ha_rnd_end(); file->try_semi_consistent_read(false);
If the transaction isolation level is REPEATABLE READ or SERIALIZABLE, enabling this flag has no effect.
Reimplemented from handler.
Reimplemented in ha_innopart.
|
overridevirtual |
Stores a row in an InnoDB database, to the table specified in this handle.
record | in: a row in MySQL format |
Reimplemented from handler.
Reimplemented in ha_innopart.
|
protected |
The multi range read session object.
|
protected |
Flags that specify the handler instance (table) capability.
|
protected |
|
protected |
If mysql has locked with external_lock()
|
protected |
Save CPU time with prebuilt/cached data structures.
|
protected |
information for MySQL table locking
|
protected |
this is set to 1 when we are starting a table scan but have not yet fetched any row, else false
match mode of the latest search: ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX, or undefined
|
protected |
this field is used to remember the original select_lock_type that was decided in ha_innodb.cc,":: store_lock()", "::external_lock()", etc.
|
protected |
buffer used in updates
|
protected |
the size of upd_buf in bytes
|
protected |
Thread handle of the user currently using the handler; this is set in external_lock function.