MySQL  8.0.20
Source Code Documentation
ha_innopart Class Reference

The class defining a partitioning aware handle to an InnoDB table. More...

#include <ha_innopart.h>

Inheritance diagram for ha_innopart:
ha_innobase Partition_helper Partition_handler handler

Public Types

using Reader = Parallel_reader_adapter
 
- Public Types inherited from ha_innobase
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_innopart (handlerton *hton, TABLE_SHARE *table_arg)
 Construct ha_innopart handler. More...
 
 ~ha_innopart () override
 Destruct ha_innopart handler. More...
 
handlerclone (const char *name, MEM_ROOT *mem_root) override
 Clone this handler, used when needing more than one cursor to the same table. More...
 
bool prepare_inplace_alter_partition (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
 Allows InnoDB to update internal structures with concurrent writes blocked (given that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK). More...
 
bool inplace_alter_partition (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
 Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information. More...
 
bool commit_inplace_alter_partition (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
 Prepare to commit or roll back ALTER TABLE...ALGORITHM=INPLACE. More...
 
int optimize (THD *thd, HA_CHECK_OPT *check_opt) override
 Optimize table. More...
 
int set_dd_discard_attribute (dd::Table *table_def, bool discard)
 Set DD discard attribute for tablespace. More...
 
int discard_or_import_tablespace (bool discard, dd::Table *table_def) override
 Discards or imports an InnoDB tablespace. More...
 
int extra (enum ha_extra_function operation) override
 Extra hints from MySQL. More...
 
void print_error (int error, myf errflag) override
 Print error information. More...
 
bool is_ignorable_error (int error) override
 Can error be ignored. More...
 
int start_stmt (THD *thd, thr_lock_type lock_type) override
 Start statement. 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...
 
uint alter_table_flags (uint flags)
 Returned supported alter table flags. More...
 
void update_create_info (HA_CREATE_INFO *create_info) override
 Update create_info. More...
 
int create (const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) override
 Creates a new table to an InnoDB database. More...
 
int delete_table (const char *name, const dd::Table *dd_table) override
 Drop a table. More...
 
int rename_table (const char *from, const char *to, const dd::Table *from_table, dd::Table *to_table) override
 Rename a table. More...
 
int check (THD *thd, HA_CHECK_OPT *check_opt) override
 Checks a partitioned table. More...
 
int repair (THD *thd, HA_CHECK_OPT *repair_opt) override
 Repair table. More...
 
void get_auto_increment (ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values) override
 Get the current auto_increment value. More...
 
enum row_type get_partition_row_type (const dd::Table *partition_table, uint part_id) override
 Get partition row type from SE. More...
 
int cmp_ref (const uchar *ref1, const uchar *ref2) const override
 Compares two 'refs'. 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...
 
void position (const uchar *record) override
 Store a reference to the current row to 'ref' field of the handle. More...
 
bool check_if_incompatible_data (HA_CREATE_INFO *info, uint table_changes) override
 Part of old, deprecated in-place ALTER API. More...
 
int delete_all_rows () override
 Delete all rows from the table. More...
 
int disable_indexes (uint mode) override
 Disable indexes. More...
 
int enable_indexes (uint mode) override
 Enable indexes. More...
 
int ft_init () override
 Initialize FT index scan. More...
 
FT_INFOft_init_ext (uint flags, uint inx, String *key) override
 Initialize FT index scan. More...
 
FT_INFOft_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...
 
bool get_foreign_dup_key (char *child_table_name, uint child_table_name_len, char *child_key_name, uint child_key_name_len) 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...
 
int read_range_next () override
 Read next row between two endpoints. More...
 
uint32 calculate_key_hash_value (Field **field_array) override
 
Table_flags table_flags () const override
 Get the table flags to use for the statement. More...
 
void release_auto_increment () override
 
int parallel_scan_init (void *&scan_ctx, size_t &num_threads) override
 Get number of threads that would be spawned for parallel read. 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 data. More...
 
void parallel_scan_end (void *parallel_scan_ctx) override
 Run the parallel read of data. More...
 
enum_alter_inplace_result check_if_supported_inplace_alter (TABLE *altered_table, Alter_inplace_info *ha_alter_info) override
 On-line ALTER TABLE interface. More...
 
bool prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) override
 Prepare in-place ALTER for table. More...
 
bool inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) override
 Alter the table structure in-place. More...
 
bool 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) override
 Commit or rollback. More...
 
void get_dynamic_partition_info (ha_statistics *stat_info, ha_checksum *check_sum, uint part_id) override
 Implementing Partition_handler interface. More...
 
uint alter_flags (uint flags) const override
 Alter flags. More...
 
Partition_handlerget_partition_handler () override
 
void set_part_info (partition_info *part_info, bool early) override
 Set the partition info object to be used by the handler. More...
 
void initialize_partitioning (partition_info *part_info, bool early)
 
handlerget_handler () override
 Return the table handler. More...
 
- Public Member Functions inherited from ha_innobase
 ha_innobase (handlerton *hton, TABLE_SHARE *table_arg)
 Construct ha_innobase handler. More...
 
 ~ha_innobase () override
 Destruct ha_innobase handler. More...
 
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...
 
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
 
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 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...
 
void ft_end ()
 
int info (uint) override
 Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. 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...
 
void position (uchar *record)
 
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...
 
uint lock_count (void) const override
 Returns number of THR_LOCK locks used for one instance of InnoDB table. 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...
 
virtual bool get_error_message (int error, String *buf) override
 See comment in handler.cc. More...
 
bool primary_key_is_clustered () const override
 Determines if the primary key is clustered index. 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_bufferha_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_prepare_load_table (const TABLE &table)
 Prepares the secondary engine for table load. 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 ()
 
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_SHAREget_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...
 
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)
 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_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...
 
void ft_end ()
 
int ha_ft_read (uchar *buf)
 
int ha_read_first_row (uchar *buf, uint primary_key)
 Read first row (only) from a table. More...
 
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 int engine_push (AQP::Table_access *table)
 Let storage engine inspect the optimized 'plan' and pick whatever it like for being pushed down to the engine. 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 Itemcond_push (const Item *cond, bool other_tbls_ok)
 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 TABLEmember_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 TABLEparent_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)
 
int get_lock_type () const
 
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...
 
handlerha_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...
 
- Public Member Functions inherited from Partition_helper
 Partition_helper (handler *main_handler)
 
virtual ~Partition_helper ()
 
virtual void set_part_info_low (partition_info *part_info, bool early)
 Set partition info. More...
 
bool init_partitioning (MEM_ROOT *mem_root)
 Initialize variables used before the table is opened. More...
 
void ph_release_auto_increment ()
 Release unused auto increment values. More...
 
int ph_write_row (uchar *buf)
 INSERT/UPDATE/DELETE functions. More...
 
int ph_update_row (const uchar *old_data, uchar *new_data)
 Update an existing row in the partitioned table. More...
 
int ph_delete_row (const uchar *buf)
 Delete an existing row in the partitioned table. More...
 
int ph_rnd_init (bool scan)
 MODULE full table scan. More...
 
int ph_rnd_end ()
 End of a table scan. More...
 
int ph_rnd_next (uchar *buf)
 Read next row during full table scan (scan in random row order). More...
 
void ph_position (const uchar *record)
 Save position of current row. More...
 
int ph_index_init_setup (uint key_nr, bool sorted)
 MODULE index scan. More...
 
int ph_index_first (uchar *buf)
 Start an index scan from leftmost record and return first record. More...
 
int ph_index_last (uchar *buf)
 Start an index scan from rightmost record and return first record. More...
 
int ph_index_next (uchar *buf)
 Read next record in a forward index scan. More...
 
int ph_index_next_same (uchar *buf, uint keylen)
 Read next same record. More...
 
int ph_index_prev (uchar *buf)
 Read next record when performing index scan backwards. More...
 
int ph_index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Read one record in an index scan and start an index scan. More...
 
int ph_index_read_last_map (uchar *buf, const uchar *key, key_part_map keypart_map)
 Read last using key. More...
 
int ph_index_read_idx_map (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Read index by key and keymap. More...
 
int ph_read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range_arg, bool sorted)
 Start a read of one range with start and end key. More...
 
int ph_read_range_next ()
 Read next record in read of a range with start and end key. More...
 
virtual void get_dynamic_partition_info_low (ha_statistics *stat_info, ha_checksum *check_sum, uint part_id)
 Functions matching Partition_handler API. More...
 
void prepare_change_partitions ()
 Prepare for reorganizing partitions by setting up partition_info::read_partitions according to the partition_info mark-up. More...
 
- Public Member Functions inherited from Partition_handler
 Partition_handler ()
 
virtual ~Partition_handler ()
 
virtual int get_default_num_partitions (HA_CREATE_INFO *info)
 Get default number of partitions. More...
 
virtual void set_auto_partitions (partition_info *part_info)
 Setup auto partitioning. More...
 
virtual bool get_num_parts (const char *name, uint *num_parts)
 Get number of partitions for table in SE. More...
 
int truncate_partition (dd::Table *table_def)
 Truncate partitions. More...
 
int exchange_partition (uint part_id, dd::Table *part_table_def, dd::Table *swap_table_def)
 Exchange partition. More...
 

Static Public Member Functions

static int key_and_rowid_cmp (KEY **key_info, uchar *a, uchar *b)
 Compare key and rowid. More...
 
- 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...
 
- Static Public Member Functions inherited from Partition_helper
static uint32 ph_calculate_key_hash_value (Field **field_array)
 Calculate key hash value from an null terminated array of fields. More...
 

Protected Member Functions

int rnd_next (uchar *record) 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 *record, uchar *pos) override
 Get a row from a position. More...
 
int records (ha_rows *num_rows) override
 Total number of rows in all used partitions. More...
 
int records_from_index (ha_rows *num_rows, uint) override
 Number of rows in table counted using the secondary index chosen by optimizer. More...
 
int index_next (uchar *record) override
 Reads the next row from a cursor, which must have previously been positioned using index_read. More...
 
int index_next_same (uchar *record, const uchar *, uint keylen) override
 Reads the next row matching to the key value given as the parameter. More...
 
int index_prev (uchar *record) override
 Reads the previous row from a cursor, which must have previously been positioned using index_read. More...
 
int index_first (uchar *record) override
 Positions a cursor on the first record in an index and reads the corresponding row to buf. More...
 
int index_last (uchar *record) override
 Positions a cursor on the last record in an index and reads the corresponding row to buf. More...
 
int index_read_last_map (uchar *record, const uchar *key, key_part_map keypart_map) override
 The following functions works like index_read, but it find the last row with the current key value or prefix. More...
 
int index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
 Positions an index cursor to the index specified in the handle ('active_index'). More...
 
int index_read_idx_map (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
 Positions an index cursor to the index specified in argument. More...
 
int info_low (uint flag, bool is_analyze) override
 Updates and return statistics. More...
 
- Protected Member Functions inherited from ha_innobase
int delete_table (const char *name, const dd::Table *table_def, enum enum_sql_command sqlcom)
 Drop a table. More...
 
void 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...
 
void build_template (bool whole_row)
 Builds a 'template' to the prebuilt struct. 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, const Table *old_dd_tab, Table *new_dd_tab)
 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, const Table *old_dd_tab, 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...
 
- Protected Member Functions inherited from handler
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
 
THDha_thd (void) const
 
PSI_table_shareha_table_share_psi (const TABLE_SHARE *share) const
 Acquire the instrumented table information from a table share. More...
 
Handler_shareget_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 Member Functions inherited from Partition_helper
bool open_partitioning (Partition_share *part_share)
 Set m_part_share, Allocate internal bitmaps etc. More...
 
void close_partitioning ()
 Close partitioning for a table. More...
 
void lock_auto_increment ()
 Lock auto increment value if needed. More...
 
void unlock_auto_increment ()
 unlock auto increment. More...
 
void get_auto_increment_first_field (ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values)
 Get auto increment. More...
 
int init_record_priority_queue ()
 Initialize the record priority queue used for sorted index scans. More...
 
void destroy_record_priority_queue ()
 Destroy the record priority queue used for sorted index scans. More...
 
bool print_partition_error (int error)
 Print partitioning specific error. More...
 
bool print_admin_msg (THD *thd, uint len, const char *msg_type, const char *db_name, const char *table_name, const char *op_name, const char *fmt,...)
 Print a message row formatted for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE. More...
 
int check_misplaced_rows (uint read_part_id, bool repair)
 Check/fix misplaced rows. More...
 
bool set_altered_partitions ()
 Set used partitions bitmap from Alter_info. More...
 
virtual int copy_partitions (ulonglong *const deleted)
 Copy partitions as part of ALTER TABLE of partitions. More...
 

Private Member Functions

void clear_ins_upd_nodes ()
 Clear used ins_nodes and upd_nodes. More...
 
void clear_blob_heaps ()
 Clear the blob heaps for all partitions. More...
 
int reset () override
 Reset state of file to after 'open'. More...
 
mem_heap_t ** alloc_blob_heap_array ()
 Allocate the array to hold blob heaps for all partitions. More...
 
void free_blob_heap_array ()
 Free the array that holds blob heaps for all partitions. More...
 
int change_active_index (uint part_id, uint keynr)
 Changes the active index of a handle. More...
 
int next_partition_index ()
 Move to next partition and set its index. More...
 
int innobase_initialize_autoinc ()
 Internally called for initializing auto increment value. More...
 
dict_index_tinnobase_get_index (uint keynr) override
 Get the index for the current partition. More...
 
dict_index_tinnopart_get_index (uint part_id, uint keynr)
 Get the index for a handle. More...
 
void set_partition (uint part_id)
 Change active partition. More...
 
void update_partition (uint part_id)
 Update active partition. More...
 
int truncate_impl (const char *name, TABLE *form, dd::Table *table_def)
 TRUNCATE an InnoDB partitioned table. More...
 
int open (const char *name, int mode, uint test_if_locked, const dd::Table *table_def) override
 Open an InnoDB table. More...
 
int close () override
 Closes a handle to an InnoDB table. More...
 
double scan_time () override
 Time estimate for full table scan. More...
 
bool was_semi_consistent_read () override
 Was the last returned row semi consistent read. More...
 
void try_semi_consistent_read (bool yes) override
 Try semi consistent read. More...
 
void unlock_row () override
 Removes a lock on a row. More...
 
int index_init (uint index, bool sorted) override
 Initializes a handle to use an index. More...
 
int index_end () override
 End index cursor. More...
 
int rnd_init (bool scan) override
 Initialize a table scan. More...
 
int rnd_end () override
 Ends a table scan. More...
 
int external_lock (THD *thd, int lock_type) override
 Lock/prepare to lock table. More...
 
THR_LOCK_DATA ** store_lock (THD *thd, THR_LOCK_DATA **to, thr_lock_type lock_type) override
 Function to store lock for all partitions in native partitioned table. More...
 
int write_row (uchar *record) override
 Stores a row in an InnoDB database, to the table specified in this handle. More...
 
int update_row (const uchar *old_record, uchar *new_record) override
 Updates a row given as a parameter to a new value. More...
 
int delete_row (const uchar *record) override
 Deletes a row given as the parameter. More...
 
int truncate_partition_low (dd::Table *dd_table) override
 Truncate partition. More...
 
int exchange_partition_low (uint part_id, dd::Table *part_table, dd::Table *swap_table) override
 Exchange partition. More...
 
void update_part_elem (partition_element *part_elem, dict_table_t *ib_table, bool display_tablespace)
 Fill in data_dir_path and tablespace name from internal data dictionary. More...
 
int initialize_auto_increment (bool no_lock) override
 Helpers needed by Partition_helper,. More...
 
void save_auto_increment (ulonglong nr) override
 Save currently highest auto increment value. More...
 
int init_record_priority_queue_for_parts (uint used_parts) override
 Setup the ordered record buffer and the priority queue. More...
 
void destroy_record_priority_queue_for_parts () override
 Destroy the ordered record buffer and the priority queue. More...
 
bool prepare_for_copy_partitions (Alter_inplace_info *ha_alter_info)
 Create the Altered_partitoins object. More...
 
int write_row_in_new_part (uint new_part) override
 write row to new partition. More...
 
int write_row_in_part (uint part_id, uchar *record) override
 Write a row in specific partition. More...
 
int update_row_in_part (uint part_id, const uchar *old_row, uchar *new_row) override
 Update a row in partition. More...
 
int delete_row_in_part (uint part_id, const uchar *record) override
 Deletes a row in partition. More...
 
int index_first_in_part (uint part, uchar *record) override
 Return first record in index from a partition. More...
 
int index_last_in_part (uint part, uchar *record) override
 Return last record in index from a partition. More...
 
int index_prev_in_part (uint part, uchar *record) override
 Return previous record in index from a partition. More...
 
int index_next_in_part (uint part, uchar *record) override
 Return next record in index from a partition. More...
 
int index_next_same_in_part (uint part, uchar *record, const uchar *key, uint length) override
 Return next same record in index from a partition. More...
 
int index_read_map_in_part (uint part, uchar *record, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
 Start index scan and return first record from a partition. More...
 
int index_read_last_map_in_part (uint part, uchar *record, const uchar *key, key_part_map keypart_map) override
 Return last matching record in index from a partition. More...
 
int read_range_first_in_part (uint part, uchar *record, const key_range *start_key, const key_range *end_key, bool sorted) override
 Start index scan and return first record from a partition. More...
 
int read_range_next_in_part (uint part, uchar *record) override
 Return next record in index range scan from a partition. More...
 
int index_read_idx_map_in_part (uint part, uchar *record, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
 Start index scan and return first record from a partition. More...
 
int sample_init (void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method) 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 rnd_init_in_part (uint part_id, bool scan) override
 Initialize random read/scan of a specific partition. More...
 
int rnd_next_in_part (uint part_id, uchar *buf) override
 Get next row during scan of a specific partition. More...
 
int rnd_end_in_part (uint part_id, bool scan) override
 End random read/scan of a specific partition. More...
 
void position_in_last_part (uchar *ref_arg, const uchar *record) override
 Get a reference to the current cursor position in the last used partition. More...
 
int rnd_pos_by_record (uchar *record) override
 Read row using position using given record to find. More...
 
void copy_cached_row (uchar *buf, const uchar *cached_row) override
 Copy a cached MySQL record. More...
 
THDget_thd () const override
 Access methods to protected areas in handler to avoid adding friend class Partition_helper in class handler. More...
 
TABLEget_table () const override
 
bool get_eq_range () const override
 
void set_eq_range (bool eq_range_arg) override
 
void set_range_key_part (KEY_PART_INFO *key_part) override
 

Private Attributes

Ha_innopart_sharem_part_share
 Pointer to Ha_innopart_share on the TABLE_SHARE. More...
 
ins_node_t ** m_ins_node_parts
 ins_node per partition. More...
 
upd_node_t ** m_upd_node_parts
 upd_node per partition. More...
 
mem_heap_t ** m_blob_heap_parts
 blob_heap per partition. More...
 
trx_id_tm_trx_id_parts
 trx_id from the partitions table->def_trx_id. More...
 
ulint * m_row_read_type_parts
 row_read_type per partition. More...
 
bytem_bitset
 byte array for sql_stat_start bitset More...
 
Sql_stat_start_parts m_sql_stat_start_parts
 sql_stat_start per partition. More...
 
btr_pcur_tm_pcur_parts
 persistent cursors per partition. More...
 
btr_pcur_tm_clust_pcur_parts
 persistent cluster cursors per partition. More...
 
uint16_t * m_pcur_map
 map from part_id to offset in above two arrays. More...
 
btr_pcur_tm_pcur
 Original m_prebuilt->pcur. More...
 
btr_pcur_tm_clust_pcur
 Original m_prebuilt->clust_pcur. More...
 
Altered_partitionsm_new_partitions
 New partitions during ADD/REORG/... More...
 

Additional Inherited Members

- Public Attributes inherited from handler
handlertonht
 
ucharref
 Pointer to current row. More...
 
uchardup_ref
 Pointer to duplicate row. More...
 
ha_statistics stats
 
range_seq_t mrr_iter
 
RANGE_SEQ_IF mrr_funcs
 
HANDLER_BUFFERmulti_range_buffer
 
uint ranges_in_seq
 
bool mrr_is_output_sorted
 
bool mrr_have_range
 
KEY_MULTI_RANGE mrr_cur_range
 
key_rangeend_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_INFOft_handler
 
enum handler:: { ... }  inited
 
bool implicit_emptied
 
const Itempushed_cond
 
Itempushed_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_tablem_psi
 Instrumented table associated with this handler. More...
 
std::mt19937 m_random_number_engine
 
double m_sampling_percentage
 
- Protected Types inherited from Partition_helper
enum  enum_using_ref { REF_NOT_USED = 0, REF_STORED_IN_PQ, REF_USED_FOR_SORT }
 
- Protected Attributes inherited from ha_innobase
DsMrr_impl m_ds_mrr
 The multi range read session object. More...
 
row_prebuilt_tm_prebuilt
 Save CPU time with prebuilt/cached data structures. More...
 
THDm_user_thd
 Thread handle of the user currently using the handler; this is set in external_lock function. More...
 
INNOBASE_SHAREm_share
 information for MySQL table locking More...
 
ucharm_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 specificy 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_SHAREtable_share
 
TABLEtable
 
Table_flags cached_table_flags
 
ha_rows estimation_rows_to_insert
 
KEY_PART_INFOrange_key_part
 
bool eq_range
 
bool in_range_check_pushed_down
 
- Protected Attributes inherited from Partition_helper
TABLEm_table
 Convenience pointer to table from m_handler (i.e. More...
 
partition_infom_part_info
 All internal partitioning data! More...
 
bool m_pkey_is_clustered
 Is primary key clustered. More...
 
bool m_is_sub_partitioned
 Cached value of m_part_info->is_sub_partitioned(). More...
 
uint m_tot_parts
 Total number of partitions. More...
 
uint m_last_part
 
const ucharm_err_rec
 
bool m_auto_increment_safe_stmt_log_lock
 
bool m_auto_increment_lock
 
part_id_range m_part_spec
 
uint m_scan_value
 
key_range m_start_key
 
enum partition_index_scan_type m_index_scan_type
 
uint m_rec_length
 
bool m_ordered
 
bool m_ordered_scan_ongoing
 
bool m_reverse_order
 
ucharm_ordered_rec_buffer
 Row and key buffer for ordered index scan. More...
 
Prio_queuem_queue
 Prio queue used by sorted read. More...
 
uint m_top_entry
 Which partition is to deliver next result. More...
 
uint m_rec_offset
 Offset in m_ordered_rec_buffer from part buffer to its record buffer. More...
 
KEYm_curr_key_info [3]
 Current index used for sorting. More...
 
enum_using_ref m_ref_usage
 How handler::ref is used in the priority queue. More...
 
bool m_key_not_found
 Set if previous index_* call returned HA_ERR_KEY_NOT_FOUND. More...
 
MY_BITMAP m_key_not_found_partitions
 Partitions that returned HA_ERR_KEY_NOT_FOUND. More...
 

Detailed Description

The class defining a partitioning aware handle to an InnoDB table.

Based on ha_innobase and extended with

  • Partition_helper for re-using common partitioning functionality
  • Partition_handler for providing partitioning specific api calls. Generic partitioning functions are implemented in Partition_helper. Lower level storage functions are implemented in ha_innobase. Partition_handler is inherited for implementing the handler level interface for partitioning specific functions, like truncate_partition. InnoDB specific functions related to partitioning is implemented here.

Member Typedef Documentation

◆ Reader

Constructor & Destructor Documentation

◆ ha_innopart()

ha_innopart::ha_innopart ( handlerton hton,
TABLE_SHARE table_arg 
)

Construct ha_innopart handler.

Parameters
[in]htonHandlerton.
[in]table_argMySQL Table.

◆ ~ha_innopart()

ha_innopart::~ha_innopart ( )
override

Destruct ha_innopart handler.

Member Function Documentation

◆ alloc_blob_heap_array()

mem_heap_t ** ha_innopart::alloc_blob_heap_array ( )
private

Allocate the array to hold blob heaps for all partitions.

◆ alter_flags()

uint ha_innopart::alter_flags ( uint  flags) const
inlineoverridevirtual

Alter flags.

Given a set of alter table flags, return which is supported.

Parameters
flagsAlter table operation flags.
Returns
Supported alter table flags.

Reimplemented from Partition_handler.

◆ alter_table_flags()

uint ha_innopart::alter_table_flags ( uint  flags)

Returned supported alter table flags.

Parameters
[in]flagsFlags to support.
Returns
Supported flags.

◆ calculate_key_hash_value()

uint32 ha_innopart::calculate_key_hash_value ( Field **  field_array)
inlineoverridevirtual

Reimplemented from handler.

◆ change_active_index()

int ha_innopart::change_active_index ( uint  part_id,
uint  keynr 
)
private

Changes the active index of a handle.

Parameters
[in]part_idUse this partition.
[in]keynrUse this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB.
Returns
0 or error code.
Parameters
[in]part_idUse this partition.
[in]keynrUse this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB.
Returns
0 or error number.

◆ check()

int ha_innopart::check ( THD thd,
HA_CHECK_OPT check_opt 
)
overridevirtual

Checks a partitioned table.

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. Also checks for records in wrong partition.

Parameters
[in]thdMySQL THD object/thread handle.
[in]check_optCheck options.
Returns
HA_ADMIN_CORRUPT or HA_ADMIN_OK.

Reimplemented from ha_innobase.

◆ check_if_incompatible_data()

bool ha_innopart::check_if_incompatible_data ( HA_CREATE_INFO create_info,
uint  table_changes 
)
inlineoverridevirtual

Part of old, deprecated in-place ALTER API.

Reimplemented from ha_innobase.

◆ check_if_supported_inplace_alter()

enum_alter_inplace_result ha_innopart::check_if_supported_inplace_alter ( TABLE altered_table,
Alter_inplace_info ha_alter_info 
)
overridevirtual

On-line ALTER TABLE interface.

Check if supported inplace alter table.

See also
handler0alter.cc Check if InnoDB supports a particular alter table in-place.
Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
HA_ALTER_INPLACE_NOT_SUPPORTEDNot supported
HA_ALTER_INPLACE_NO_LOCKSupported
HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARESupported, but requires lock during main phase and exclusive lock during prepare phase.
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARESupported, prepare phase requires exclusive lock.
Parameters
[in]altered_tableAltered MySQL table.
[in]ha_alter_infoInformation about inplace operations to do.
Returns
Lock level, not supported or error

Reimplemented from ha_innobase.

◆ clear_blob_heaps()

void ha_innopart::clear_blob_heaps ( )
private

Clear the blob heaps for all partitions.

◆ clear_ins_upd_nodes()

void ha_innopart::clear_ins_upd_nodes ( )
private

Clear used ins_nodes and upd_nodes.

◆ clone()

handler * ha_innopart::clone ( const char *  name,
MEM_ROOT mem_root 
)
overridevirtual

Clone this handler, used when needing more than one cursor to the same table.

Get a cloned ha_innopart handler.

Parameters
[in]nameTable name.
[in]mem_rootmem_root to allocate from.
Return values
Pointerto clone or NULL if error.
Parameters
[in]nameTable name.
[in]mem_rootMySQL mem_root to use.
Returns
new ha_innopart handler.

Reimplemented from ha_innobase.

◆ close()

int ha_innopart::close ( void  )
overrideprivatevirtual

Closes a handle to an InnoDB table.

Returns
0

Reimplemented from ha_innobase.

◆ cmp_ref()

int ha_innopart::cmp_ref ( const uchar ref1,
const uchar ref2 
) const
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. It will use the partition id as secondary compare.

Parameters
[in]ref1An (internal) primary key value in the MySQL key value format.
[in]ref2Reference to compare with (same type as ref1).
Returns
< 0 if ref1 < ref2, 0 if equal, else > 0.

Reimplemented from ha_innobase.

◆ commit_inplace_alter_partition()

bool ha_innopart::commit_inplace_alter_partition ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
bool  commit,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)

Prepare to commit or roll back ALTER TABLE...ALGORITHM=INPLACE.

This is for 'ALTER TABLE ... PARTITION' and a corresponding function to commit_inplace_alter_table().

Parameters
[in,out]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoALGORITHM=INPLACE metadata
[in]committrue=Commit, false=Rollback.
[in]old_dd_tabold table
[in,out]new_dd_tabnew table
Return values
trueon failure (my_error() will have been called)
falseon success

◆ commit_inplace_alter_table()

bool ha_innopart::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 
)
overridevirtual

Commit or rollback.

Commit or rollback inplace alter table.

Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine. Note that the allowed level of concurrency during this operation will be the same as for inplace_alter_table() and thus might be higher than during prepare_inplace_alter_table(). (E.g concurrent writes were blocked during prepare, but might not be during commit).

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]committrue => Commit, false => Rollback.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine. Note that the allowed level of concurrency during this operation will be the same as for inplace_alter_table() and thus might be higher than during prepare_inplace_alter_table(). (E.g concurrent writes were blocked during prepare, but might not be during commit).

Parameters
[in]altered_tableTABLE object for new version of table.
[in]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]committrue => Commit, false => Rollback.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

Reimplemented from ha_innobase.

◆ copy_cached_row()

void ha_innopart::copy_cached_row ( uchar buf,
const uchar cached_row 
)
inlineoverrideprivatevirtual

Copy a cached MySQL record.

Copy a cached MySQL row.

Parameters
[out]bufWhere to copy the MySQL record.
[in]cached_rowWhich record to copy.

If requested, also avoids overwriting non-read columns.

Parameters
[out]bufRow in MySQL format.
[in]cached_rowWhich row to copy.

Reimplemented from Partition_helper.

◆ create()

int ha_innopart::create ( const char *  name,
TABLE form,
HA_CREATE_INFO create_info,
dd::Table table_def 
)
overridevirtual

Creates a new table to an InnoDB database.

Parameters
[in]nameTable name (in filesystem charset).
[in]formMySQL Table containing information of partitions, columns and indexes etc.
[in]create_infoAdditional create information, like create statement string.
[in,out]table_defdd::Table object for table to be created. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time.
Returns
0 or error number.

{database}/{tablename}

absolute path of table

Reimplemented from ha_innobase.

◆ delete_all_rows()

int ha_innopart::delete_all_rows ( void  )
inlineoverridevirtual

Delete all rows from the table.

Return values
HA_ERR_WRONG_COMMANDif the table is transactional
0on success

Reimplemented from ha_innobase.

◆ delete_row()

int ha_innopart::delete_row ( const uchar record)
inlineoverrideprivatevirtual

Deletes a row given as the parameter.

Returns
error number or 0

Reimplemented from ha_innobase.

◆ delete_row_in_part()

int ha_innopart::delete_row_in_part ( uint  part_id,
const uchar record 
)
overrideprivatevirtual

Deletes a row in partition.

Parameters
[in]part_idPartition to delete from.
[in]recordRow to delete in MySQL format.
Returns
error number or 0.
Parameters
[in]part_idPartition to delete from.
[in]recordRow to delete in MySQL format.
Returns
0 or error number.

Implements Partition_helper.

◆ delete_table()

int ha_innopart::delete_table ( const char *  name,
const dd::Table dd_table 
)
overridevirtual

Drop a table.

Parameters
[in]nametable name
[in,out]dd_tabledata dictionary table
Returns
error number
Return values
0on success

Reimplemented from ha_innobase.

◆ destroy_record_priority_queue_for_parts()

void ha_innopart::destroy_record_priority_queue_for_parts ( )
inlineoverrideprivatevirtual

Destroy the ordered record buffer and the priority queue.

Reimplemented from Partition_helper.

◆ disable_indexes()

int ha_innopart::disable_indexes ( uint  mode)
inlineoverridevirtual

Disable indexes.

Parameters
[in]modedisable index mode.
Returns
HA_ERR_* error code or 0

Reimplemented from ha_innobase.

◆ discard_or_import_tablespace()

int ha_innopart::discard_or_import_tablespace ( bool  discard,
dd::Table table_def 
)
overridevirtual

Discards or imports an InnoDB tablespace.

Parameters
[in]discardTrue if discard, else import.
[in,out]table_defdd::Table describing table which tablespaces are to be imported or discarded. Can be adjusted by SE, the changes will be saved into the data-dictionary at statement commit time.
Returns
0 or error number.

Reimplemented from ha_innobase.

◆ enable_indexes()

int ha_innopart::enable_indexes ( uint  mode)
inlineoverridevirtual

Enable indexes.

Parameters
[in]modeenable index mode.
Returns
HA_ERR_* error code or 0

Reimplemented from ha_innobase.

◆ estimate_rows_upper_bound()

ha_rows ha_innopart::estimate_rows_upper_bound ( void  )
overridevirtual

Gives an UPPER BOUND to the number of rows in a table.

This is used in filesort.cc.

Returns
upper bound of rows.

Reimplemented from ha_innobase.

◆ exchange_partition_low()

int ha_innopart::exchange_partition_low ( uint  part_id,
dd::Table part_table,
dd::Table swap_table 
)
overrideprivatevirtual

Exchange partition.

Low-level primitive which implementation is provided here.

Parameters
[in]part_idThe id of the partition to be exchanged
[in,out]part_tablepartitioned table to be exchanged
[in,out]swap_tabletable to be exchanged
Returns
error number
Return values
0on success

Low-level primitive which implementation is provided here.

Parameters
[in]part_idThe id of the partition to be exchanged
[in]part_tablepartitioned table to be exchanged
[in]swap_tabletable to be exchanged
Returns
error number
Return values
0on success

Reimplemented from Partition_handler.

◆ external_lock()

int ha_innopart::external_lock ( THD thd,
int  lock_type 
)
overrideprivatevirtual

Lock/prepare to lock table.

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.

Parameters
[in]thdHandle to the user thread.
[in]lock_typeLock type.
Returns
0 or error number.

Reimplemented from ha_innobase.

◆ extra()

int ha_innopart::extra ( enum ha_extra_function  operation)
overridevirtual

Extra hints from MySQL.

Parameters
[in]operationOperation hint.
Returns
0 or error number.

Reimplemented from ha_innobase.

◆ free_blob_heap_array()

void ha_innopart::free_blob_heap_array ( )
private

Free the array that holds blob heaps for all partitions.

◆ ft_init()

int ha_innopart::ft_init ( )
inlineoverridevirtual

Initialize FT index scan.

Returns
0 or error number

Reimplemented from ha_innobase.

◆ ft_init_ext()

FT_INFO* ha_innopart::ft_init_ext ( uint  flags,
uint  keynr,
String key 
)
inlineoverridevirtual

Initialize FT index scan.

Returns
FT_INFO structure if successful or NULL

Reimplemented from ha_innobase.

◆ ft_init_ext_with_hints()

FT_INFO* ha_innopart::ft_init_ext_with_hints ( uint  keynr,
String key,
Ft_hints hints 
)
inlineoverridevirtual

Initialize FT index scan.

Returns
FT_INFO structure if successful or NULL

Reimplemented from ha_innobase.

◆ ft_read()

int ha_innopart::ft_read ( uchar buf)
inlineoverridevirtual

Fetch next result from the FT result set.

Returns
error code

Reimplemented from ha_innobase.

◆ get_auto_increment()

void ha_innopart::get_auto_increment ( ulonglong  offset,
ulonglong  increment,
ulonglong  nb_desired_values,
ulonglong first_value,
ulonglong nb_reserved_values 
)
overridevirtual

Get the current auto_increment value.

Parameters
[in]offsetTable auto-inc offset.
[in]incrementTable auto-inc increment.
[in]nb_desired_valuesNumber of required values.
[out]first_valueThe auto increment value.
[out]nb_reserved_valuesNumber of reserved values.

Reimplemented from ha_innobase.

◆ get_dynamic_partition_info()

void ha_innopart::get_dynamic_partition_info ( ha_statistics stat_info,
ha_checksum check_sum,
uint  part_id 
)
inlineoverridevirtual

Implementing Partition_handler interface.

See also
partition_handler.hSee Partition_handler.

Implements Partition_handler.

◆ get_eq_range()

bool ha_innopart::get_eq_range ( ) const
inlineoverrideprivatevirtual

Implements Partition_helper.

◆ get_foreign_dup_key()

bool ha_innopart::get_foreign_dup_key ( char *  child_table_name,
uint  child_table_name_len,
char *  child_key_name,
uint  child_key_name_len 
)
inlineoverridevirtual

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.

Parameters
[out]child_table_nameTable name
[in]child_table_name_lenTable name buffer size
[out]child_key_nameKey name
[in]child_key_name_lenKey name buffer size
Return values
truetable and key names were available and were written into the corresponding out parameters.
falsetable and key names were not available, the out parameters were not touched.

Reimplemented from ha_innobase.

◆ get_handler()

handler* ha_innopart::get_handler ( )
inlineoverridevirtual

Return the table handler.

For some partitioning specific functions it is still needed to access the handler directly for transaction handling (mark_trx_read_write()) and to assert correct locking.

Returns
handler or NULL if not supported.

Reimplemented from Partition_handler.

◆ get_partition_handler()

Partition_handler* ha_innopart::get_partition_handler ( )
inlineoverridevirtual

Reimplemented from handler.

◆ get_partition_row_type()

enum row_type ha_innopart::get_partition_row_type ( const dd::Table table,
uint  part_id 
)
overridevirtual

Get partition row type from SE.

Parameters
tablepartition table
part_idId of partition for which row type to be retrieved
Returns
Partition row type.

Implements Partition_handler.

◆ get_table()

TABLE* ha_innopart::get_table ( ) const
inlineoverrideprivatevirtual

Implements Partition_helper.

◆ get_thd()

THD* ha_innopart::get_thd ( ) const
inlineoverrideprivatevirtual

Access methods to protected areas in handler to avoid adding friend class Partition_helper in class handler.

See also
partition_handler.h

Implements Partition_helper.

◆ index_end()

int ha_innopart::index_end ( void  )
overrideprivatevirtual

End index cursor.

Returns
0 or error code.

Reimplemented from ha_innobase.

◆ index_first()

int ha_innopart::index_first ( uchar buf)
inlineoverrideprotectedvirtual

Positions a cursor on the first record in an index and reads the corresponding row to buf.

Returns
0, HA_ERR_END_OF_FILE, or error code

Reimplemented from ha_innobase.

◆ index_first_in_part()

int ha_innopart::index_first_in_part ( uint  part,
uchar record 
)
overrideprivatevirtual

Return first record in index from a partition.

Parameters
[in]partPartition to read from.
[out]recordFirst record in index in the partition.
Returns
error number or 0.

Implements Partition_helper.

◆ index_init()

int ha_innopart::index_init ( uint  keynr,
bool  sorted 
)
overrideprivatevirtual

Initializes a handle to use an index.

Parameters
[in]keynrKey (index) number.
[in]sortedTrue if result MUST be sorted according to index.
Returns
0 or error number.

Reimplemented from ha_innobase.

◆ index_last()

int ha_innopart::index_last ( uchar buf)
inlineoverrideprotectedvirtual

Positions a cursor on the last record in an index and reads the corresponding row to buf.

Returns
0, HA_ERR_END_OF_FILE, or error code

Reimplemented from ha_innobase.

◆ index_last_in_part()

int ha_innopart::index_last_in_part ( uint  part,
uchar record 
)
overrideprivatevirtual

Return last record in index from a partition.

Parameters
[in]partPartition to read from.
[out]recordLast record in index in the partition.
Returns
error number or 0.

Implements Partition_helper.

◆ index_next()

int ha_innopart::index_next ( uchar buf)
inlineoverrideprotectedvirtual

Reads the next row from a cursor, which must have previously been positioned using index_read.

Returns
0, HA_ERR_END_OF_FILE, or error number

Reimplemented from ha_innobase.

◆ index_next_in_part()

int ha_innopart::index_next_in_part ( uint  part,
uchar record 
)
overrideprivatevirtual

Return next record in index from a partition.

Parameters
[in]partPartition to read from.
[out]recordLast record in index in the partition.
Returns
error number or 0.

Implements Partition_helper.

◆ index_next_same()

int ha_innopart::index_next_same ( uchar buf,
const uchar key,
uint  keylen 
)
inlineoverrideprotectedvirtual

Reads the next row matching to the key value given as the parameter.

Returns
0, HA_ERR_END_OF_FILE, or error number

Reimplemented from ha_innobase.

◆ index_next_same_in_part()

int ha_innopart::index_next_same_in_part ( uint  part,
uchar record,
const uchar key,
uint  length 
)
overrideprivatevirtual

Return next same record in index from a partition.

This routine is used to read the next record, but only if the key is the same as supplied in the call.

Parameters
[in]partPartition to read from.
[out]recordLast record in index in the partition.
[in]keyKey to match.
[in]lengthLength of key.
Returns
error number or 0.

Implements Partition_helper.

◆ index_prev()

int ha_innopart::index_prev ( uchar buf)
inlineoverrideprotectedvirtual

Reads the previous row from a cursor, which must have previously been positioned using index_read.

Returns
0, HA_ERR_END_OF_FILE, or error number

Reimplemented from ha_innobase.

◆ index_prev_in_part()

int ha_innopart::index_prev_in_part ( uint  part,
uchar record 
)
overrideprivatevirtual

Return previous record in index from a partition.

Parameters
[in]partPartition to read from.
[out]recordLast record in index in the partition.
Returns
error number or 0.

Implements Partition_helper.

◆ index_read_idx_map()

int ha_innopart::index_read_idx_map ( uchar buf,
uint  index,
const uchar key,
key_part_map  keypart_map,
enum ha_rkey_function  find_flag 
)
inlineoverrideprotectedvirtual

Positions an index cursor to the index specified in argument.

Fetches the row if available. If the key value is null, begin at the first key of the index.

See also
index_read_map()

Reimplemented from handler.

◆ index_read_idx_map_in_part()

int ha_innopart::index_read_idx_map_in_part ( uint  part,
uchar record,
uint  index,
const uchar key,
key_part_map  keypart_map,
enum ha_rkey_function  find_flag 
)
overrideprivatevirtual

Start index scan and return first record from a partition.

This routine starts an index scan using a start key. The calling function will check the end key on its own.

Parameters
[in]partPartition to read from.
[out]recordFirst matching record in index in the partition.
[in]indexIndex to read from.
[in]keyKey to match.
[in]keypart_mapWhich part of the key to use.
[in]find_flagKey condition/direction to use.
Returns
error number or 0.

Implements Partition_helper.

◆ index_read_last_map()

int ha_innopart::index_read_last_map ( uchar buf,
const uchar key,
key_part_map  keypart_map 
)
inlineoverrideprotectedvirtual

The following functions works like index_read, but it find the last row with the current key value or prefix.

See also
index_read_map().

Reimplemented from handler.

◆ index_read_last_map_in_part()

int ha_innopart::index_read_last_map_in_part ( uint  part,
uchar record,
const uchar key,
key_part_map  keypart_map 
)
overrideprivatevirtual

Return last matching record in index from a partition.

Parameters
[in]partPartition to read from.
[out]recordLast matching record in index in the partition.
[in]keyKey to match.
[in]keypart_mapWhich part of the key to use.
Returns
error number or 0.

Implements Partition_helper.

◆ index_read_map()

int ha_innopart::index_read_map ( uchar buf,
const uchar key,
key_part_map  keypart_map,
enum ha_rkey_function  find_flag 
)
inlineoverrideprotectedvirtual

Positions an index cursor to the index specified in the handle ('active_index').

Fetches the row if available. If the key value is null, begin at the first key of the index.

Returns
0 if success (found a record); non-zero if no record.

Reimplemented from handler.

◆ index_read_map_in_part()

int ha_innopart::index_read_map_in_part ( uint  part,
uchar record,
const uchar key,
key_part_map  keypart_map,
enum ha_rkey_function  find_flag 
)
overrideprivatevirtual

Start index scan and return first record from a partition.

This routine starts an index scan using a start key. The calling function will check the end key on its own.

Parameters
[in]partPartition to read from.
[out]recordFirst matching record in index in the partition.
[in]keyKey to match.
[in]keypart_mapWhich part of the key to use.
[in]find_flagKey condition/direction to use.
Returns
error number or 0.

Implements Partition_helper.

◆ info_low()

int ha_innopart::info_low ( uint  flag,
bool  is_analyze 
)
overrideprotectedvirtual

Updates and return statistics.

Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object.

Parameters
[in]flagFlags for what to update and return.
[in]is_analyzeTrue if called from "::analyze()".
Returns
HA_ERR_* error code or 0.

Reimplemented from ha_innobase.

◆ init_record_priority_queue_for_parts()

int ha_innopart::init_record_priority_queue_for_parts ( uint  used_parts)
overrideprivatevirtual

Setup the ordered record buffer and the priority queue.

Parameters
[in]used_partsNumber of used partitions in query.
Returns
false for success, else true.
Parameters
[in]used_partsNumber of used partitions in query.
Returns
false for success else true.

Reimplemented from Partition_helper.

◆ initialize_auto_increment()

int ha_innopart::initialize_auto_increment ( bool  no_lock)
inlineoverrideprivatevirtual

Helpers needed by Partition_helper,.

Set the autoinc column max value.

See also
partition_handler.h Set the autoinc column max value. This should only be called once from ha_innobase::open(). Therefore there's no need for a covering lock.
Parameters
[in]no_lockIf locking should be skipped. Not used!
Returns
0 on success else error code.

This should only be called once from ha_innobase::open(). Therefore there's no need for a covering lock.

Parameters
[in]no_lockIf locking should be skipped. Not used!
Returns
0 for success or error code.

Implements Partition_helper.

◆ initialize_partitioning()

void ha_innopart::initialize_partitioning ( partition_info part_info,
bool  early 
)
inline

◆ innobase_get_index()

dict_index_t * ha_innopart::innobase_get_index ( uint  keynr)
inlineoverrideprivatevirtual

Get the index for the current partition.

Parameters
[in]keynrMySQL index number.
Returns
InnoDB index or NULL.

Reimplemented from ha_innobase.

◆ innobase_initialize_autoinc()

int ha_innopart::innobase_initialize_autoinc ( )
private

Internally called for initializing auto increment value.

Should never be called, but defined to catch such errors.

Returns
0 on success else error code.

Only called from ha_innobase::discard_or_import_table_space() and should not do anything, since it is ha_innopart will initialize it on first usage.

◆ innopart_get_index()

dict_index_t * ha_innopart::innopart_get_index ( uint  part_id,
uint  keynr 
)
inlineprivate

Get the index for a handle.

Does not change active index.

Parameters
[in]keynruse this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB.
[in]part_idFrom this partition.
Returns
NULL or index instance.

Does not change active index.

Parameters
[in]keynrUse this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB.
[in]part_idFrom this partition.
Returns
NULL or index instance.

◆ inplace_alter_partition()

bool ha_innopart::inplace_alter_partition ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)

Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information.

This is for 'ALTER TABLE ... PARTITION' and a corresponding function to inplace_alter_table(). The level of concurrency allowed during this operation depends on the return value from check_if_supported_inplace_alter().

Parameters
[in,out]altered_tableTABLE object for new version of table
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_dd_tabTable definition before the ALTER
[in,out]new_dd_tabTable definition after the ALTER
Return values
trueFailure
falseSuccess

◆ inplace_alter_table()

bool ha_innopart::inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_table_def,
dd::Table new_table_def 
)
overridevirtual

Alter the table structure in-place.

Inplace alter table.

Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information. The level of concurrency allowed during this operation depends on the return value from check_if_supported_inplace_alter().

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

Alter the table structure in-place with operations specified using Alter_inplace_info. The level of concurrency allowed during this operation depends on the return value from check_if_supported_inplace_alter().

Parameters
[in]altered_tableTABLE object for new version of table.
[in]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

Reimplemented from ha_innobase.

◆ is_ignorable_error()

bool ha_innopart::is_ignorable_error ( int  error)
overridevirtual

Can error be ignored.

Parameters
[in]errorError code to check.
Returns
true if ignorable else false.

Reimplemented from handler.

◆ key_and_rowid_cmp()

int ha_innopart::key_and_rowid_cmp ( KEY **  key_info,
uchar a,
uchar b 
)
static

Compare key and rowid.

Helper function for sorting records in the priority queue. a/b points to table->record[0] rows which must have the key fields set. The bytes before a and b store the rowid. This is used for comparing/sorting rows first according to KEY and if same KEY, by rowid (ref).

Parameters
[in]key_infoNull terminated array of index information.
[in]aPointer to record+ref in first record.
[in]bPointer to record+ref in second record.
Returns
Return value is SIGN(first_rec - second_rec)
Return values
0Keys are equal.
-1second_rec is greater than first_rec.
+1first_rec is greater than second_rec.

◆ next_partition_index()

int ha_innopart::next_partition_index ( )
private

Move to next partition and set its index.

Returns
0 for success else error number.

◆ open()

int ha_innopart::open ( const char *  name,
int  mode,
uint  test_if_locked,
const dd::Table table_def 
)
overrideprivatevirtual

Open an InnoDB table.

Open a partitioned InnoDB table.

Parameters
[in]nametable name
[in]modeaccess mode
[in]test_if_lockedtest if the file to be opened is locked
[in]table_defdd::Table describing table to be opened
Return values
1if error
0if success
Parameters
[in]nametable name
[in]table_defdd::Table describing table to be opened
Return values
1if error
0if success

Reimplemented from ha_innobase.

◆ optimize()

int ha_innopart::optimize ( THD thd,
HA_CHECK_OPT check_opt 
)
overridevirtual

Optimize table.

This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds the table in MySQL.

Parameters
[in]thdConnection thread handle.
[in]check_optCurrently ignored.
Returns
0 for success else error code.

Reimplemented from ha_innobase.

◆ parallel_scan()

int ha_innopart::parallel_scan ( void *  scan_ctx,
void **  thread_ctxs,
Reader::Init_fn  init_fn,
Reader::Load_fn  load_fn,
Reader::End_fn  end_fn 
)
overridevirtual

Start parallel read of data.

Parameters
[in]scan_ctxScan context created by parallel_scan_init
[in]thread_ctxscontext for each of the spawned threads
[in]init_fncallback called by each parallel load thread at the beginning of the parallel load.
[in]load_fncallback called by each parallel load thread when processing of rows is required.
[in]end_fncallback called by each parallel load thread when processing of rows has ended.
Returns
error code
0 on success

Reimplemented from ha_innobase.

◆ parallel_scan_end()

void ha_innopart::parallel_scan_end ( void *  parallel_scan_ctx)
overridevirtual

Run the parallel read of data.

Parameters
[in]parallel_scan_ctxa scan context created by parallel_scan_init

Reimplemented from ha_innobase.

◆ parallel_scan_init()

int ha_innopart::parallel_scan_init ( void *&  scan_ctx,
size_t &  num_threads 
)
overridevirtual

Get number of threads that would be spawned for parallel read.

Parameters
[out]scan_ctxa scan context created by this method that is used in parallel_scan
[out]num_threadsnumber of threads to be spawned
Returns
error code
0 on success

Reimplemented from ha_innobase.

◆ position()

void ha_innopart::position ( const uchar record)
inlineoverridevirtual

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.

Parameters
[in]recordrow in MySQL format

Reimplemented from ha_innobase.

◆ position_in_last_part()

void ha_innopart::position_in_last_part ( uchar ref_arg,
const uchar record 
)
overrideprivatevirtual

Get a reference to the current cursor position in the last used partition.

Return position for cursor in last used partition.

Parameters
[out]ref_argReference (PK if exists else row_id).
[in]recordRecord to position.

Stores 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.

Parameters
[out]ref_argPointer to buffer where to write the position.
[in]recordRecord to position for.

Implements Partition_helper.

◆ prepare_for_copy_partitions()

bool ha_innopart::prepare_for_copy_partitions ( Alter_inplace_info ha_alter_info)
private

Create the Altered_partitoins object.

Parameters
[in]ha_alter_infothd DDL operation
Return values
trueOn failure
falseOn success

◆ prepare_inplace_alter_partition()

bool ha_innopart::prepare_inplace_alter_partition ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_dd_tab,
dd::Table new_dd_tab 
)

Allows InnoDB to update internal structures with concurrent writes blocked (given that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK).

This is for 'ALTER TABLE ... PARTITION' and a corresponding function to prepare_inplace_alter_table(). This will be invoked before inplace_alter_partition().

Parameters
[in,out]altered_tableTABLE object for new version of table
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_dd_tabTable definition before the ALTER
[in,out]new_dd_tabTable definition after the ALTER
Return values
trueFailure
falseSuccess

This is for 'ALTER TABLE ... PARTITION' and a corresponding function to inplace_alter_table(). This will be invoked before inplace_alter_partition().

Parameters
[in,out]altered_tableTABLE object for new version of table
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_dd_tabTable definition before the ALTER
[in,out]new_dd_tabTable definition after the ALTER
Return values
trueFailure
falseSuccess

◆ prepare_inplace_alter_table()

bool ha_innopart::prepare_inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
const dd::Table old_table_def,
dd::Table new_table_def 
)
overridevirtual

Prepare in-place ALTER for table.

Prepare inplace alter table.

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). This will be invoked before inplace_alter_table().

Parameters
[in]altered_tableTABLE object for new version of table.
[in,out]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

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). This will be invoked before inplace_alter_table().

Parameters
[in]altered_tableTABLE object for new version of table.
[in]ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
[in]old_table_defdd::Table object describing old version of the table.
[in,out]new_table_defdd::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 commit time.
Return values
trueFailure.
falseSuccess.

Reimplemented from ha_innobase.

◆ print_error()

void ha_innopart::print_error ( int  error,
myf  errflag 
)
overridevirtual

Print error information.

Parameters
[in]errorError code (MySQL).
[in]errflagFlags.

Reimplemented from handler.

◆ read_range_first()

int ha_innopart::read_range_first ( const key_range start_key,
const key_range end_key,
bool  eq_range_arg,
bool  sorted 
)
inlineoverridevirtual

Read first row between two ranges.

Store ranges for future calls to read_range_next.

Parameters
start_keyStart key. Is 0 if no min range
end_keyEnd key. Is 0 if no max range
eq_range_argSet to 1 if start_key == end_key
sortedSet to 1 if result should be sorted per key
Note
Record is read into table->record[0]
Return values
0Found row
HA_ERR_END_OF_FILENo rows in range

Reimplemented from ha_innobase.

◆ read_range_first_in_part()

int ha_innopart::read_range_first_in_part ( uint  part,
uchar record,
const key_range start_key,
const key_range end_key,
bool  sorted 
)
overrideprivatevirtual

Start index scan and return first record from a partition.

This routine starts an index scan using a start and end key.

Parameters
[in]partPartition to read from.
[out]recordFirst matching record in index in the partition. if NULL use table->record[0] as return buffer.
[in]start_keyStart key to match.
[in]end_keyEnd key to match.
[in]sortedReturn rows in sorted order.
Returns
error number or 0.

This routine starts an index scan using a start and end key.

Parameters
[in]partPartition to read from.
[in,out]recordFirst matching record in index in the partition, if NULL use table->record[0] as return buffer.
[in]start_keyStart key to match.
[in]end_keyEnd key to match.
[in]sortedReturn rows in sorted order.
Returns
error number or 0.

Implements Partition_helper.

◆ read_range_next()

int ha_innopart::read_range_next ( )
inlineoverridevirtual

Read next row between two endpoints.

Note
Record is read into table->record[0]
Return values
0Found row
HA_ERR_END_OF_FILENo rows in range

Reimplemented from ha_innobase.

◆ read_range_next_in_part()

int ha_innopart::read_range_next_in_part ( uint  part,
uchar record 
)
overrideprivatevirtual

Return next record in index range scan from a partition.

Parameters
[in]partPartition to read from.
[out]recordFirst matching record in index in the partition. if NULL use table->record[0] as return buffer.
Returns
error number or 0.
Parameters
[in]partPartition to read from.
[in,out]recordFirst matching record in index in the partition, if NULL use table->record[0] as return buffer.
Returns
error number or 0.

Implements Partition_helper.

◆ records()

int ha_innopart::records ( ha_rows num_rows)
overrideprotectedvirtual

Total number of rows in all used partitions.

Returns the exact number of records that this client can see using this handler object.

Parameters
[out]num_rowsNumber of rows.
Returns
0 or error number.

Reimplemented from ha_innobase.

◆ records_from_index()

int ha_innopart::records_from_index ( ha_rows num_rows,
uint  index 
)
inlineoverrideprotectedvirtual

Number of rows in table counted using the secondary index chosen by optimizer.

See comments in optimize_aggregated_query() .

Parameters
num_rows[out] Number of rows in table.
indexIndex chosen by optimizer for counting.
Return values
0for OK, one of the HA_xxx values in case of error.

Reimplemented from ha_innobase.

◆ records_in_range()

ha_rows ha_innopart::records_in_range ( uint  keynr,
key_range min_key,
key_range max_key 
)
overridevirtual

Estimates the number of index records in a range.

Parameters
[in]keynrIndex number.
[in]min_keyStart key value (or NULL).
[in]max_keyEnd key value (or NULL).
Returns
estimated number of rows.

Reimplemented from ha_innobase.

◆ release_auto_increment()

void ha_innopart::release_auto_increment ( )
inlineoverridevirtual

Reimplemented from handler.

◆ rename_table()

int ha_innopart::rename_table ( const char *  from,
const char *  to,
const dd::Table from_table,
dd::Table to_table 
)
overridevirtual

Rename a table.

Parameters
[in]fromtable name before rename
[in]totable name after rename
[in]from_tabledata dictionary table before rename
[in,out]to_tabledata dictionary table after rename
Returns
error number
Return values
0on success

Reimplemented from ha_innobase.

◆ repair()

int ha_innopart::repair ( THD thd,
HA_CHECK_OPT repair_opt 
)
overridevirtual

Repair table.

Repair a partitioned table.

Will only handle records in wrong partition, not repairing corrupt innodb indexes.

Parameters
[in]thdThread context.
[in]repair_optRepair options.
Returns
0 or error code.

Only repairs records in wrong partitions (moves them to the correct partition or deletes them if not in any partition).

Parameters
[in]thdMySQL THD object/thread handle.
[in]repair_optRepair options.
Returns
0 or error code.

Reimplemented from handler.

◆ reset()

int ha_innopart::reset ( void  )
overrideprivatevirtual

Reset state of file to after 'open'.

This function is called after every statement for all tables used by that statement.

Reimplemented from ha_innobase.

◆ rnd_end()

int ha_innopart::rnd_end ( void  )
inlineoverrideprivatevirtual

Ends a table scan.

Returns
0 or error number

Reimplemented from ha_innobase.

◆ rnd_end_in_part()

int ha_innopart::rnd_end_in_part ( uint  part_id,
bool  scan 
)
overrideprivatevirtual

End random read/scan of a specific partition.

Ends a table scan.

Parameters
[in]part_idPartition to end random read/scan.
[in]scanTrue for scan else random access.
Returns
error number or 0.
Parameters
[in]part_idPartition to end table scan in.
[in]scanTrue for scan else random access.
Returns
0 or error number.

Implements Partition_helper.

◆ rnd_init()

int ha_innopart::rnd_init ( bool  scan)
inlineoverrideprivatevirtual

Initialize a table scan.

Parameters
[in]scanwhether this is a second call to rnd_init() without rnd_end() in between
Returns
0 or error number

Reimplemented from ha_innobase.

◆ rnd_init_in_part()

int ha_innopart::rnd_init_in_part ( uint  part_id,
bool  scan 
)
overrideprivatevirtual

Initialize random read/scan of a specific partition.

Initialize a table scan in a specific partition.

Parameters
[in]part_idPartition to initialize.
[in]scanTrue for scan else random access.
Returns
error number or 0.
Parameters
[in]part_idPartition to initialize.
[in]scanTrue if table/index scan false otherwise (for rnd_pos)
Returns
0 or error number.

Implements Partition_helper.

◆ rnd_next()

int ha_innopart::rnd_next ( uchar buf)
inlineoverrideprotectedvirtual

Reads the next row in a table scan (also used to read the FIRST row in a table scan).

Returns
0, HA_ERR_END_OF_FILE, or error number

Reimplemented from ha_innobase.

◆ rnd_next_in_part()

int ha_innopart::rnd_next_in_part ( uint  part_id,
uchar buf 
)
overrideprivatevirtual

Get next row during scan of a specific partition.

Read next row in partition.

Parameters
[in]part_idPartition to read from.
[out]bufNext row.
Returns
error number or 0.

Reads the next row in a table scan (also used to read the FIRST row in a table scan).

Parameters
[in]part_idPartition to end table scan in.
[out]bufReturns the row in this buffer, in MySQL format.
Returns
0, HA_ERR_END_OF_FILE or error number.

Implements Partition_helper.

◆ rnd_pos()

int ha_innopart::rnd_pos ( uchar buf,
uchar pos 
)
overrideprotectedvirtual

Get a row from a position.

Fetches a row from the table based on a row reference.

Parameters
[out]bufReturns the row in this buffer, in MySQL format.
[in]posPosition, given as primary key value or DB_ROW_ID (if no primary key) of the row in MySQL format. The length of data in pos has to be ref_length.
Returns
0, HA_ERR_KEY_NOT_FOUND or error code.

Reimplemented from ha_innobase.

◆ rnd_pos_by_record()

int ha_innopart::rnd_pos_by_record ( uchar record)
overrideprivatevirtual

Read row using position using given record to find.

Only useful when position is based on primary key

Parameters
[in]recordCurrent record in MySQL Row Format.
Returns
error number or 0.

This works as position()+rnd_pos() functions, but does some extra work,calculating m_last_part - the partition to where the 'record' should go. Only useful when position is based on primary key (HA_PRIMARY_KEY_REQUIRED_FOR_POSITION).

Parameters
[in]recordCurrent record in MySQL Row Format.
Returns
0 for success else error code.

Reimplemented from handler.

◆ sample_end()

int ha_innopart::sample_end ( void *  scan_ctx)
overrideprivatevirtual

End sampling.

Parameters
[in]scan_ctxScan context of the sampling
Returns
0 for success, else one of the HA_xxx values in case of error.

Reimplemented from ha_innobase.

◆ sample_init()

int ha_innopart::sample_init ( void *&  scan_ctx,
double  sampling_percentage,
int  sampling_seed,
enum_sampling_method  sampling_method 
)
overrideprivatevirtual

Initialize sampling.

Parameters
[out]scan_ctxA scan context created by this method that has to be used in sample_next
[in]sampling_percentagepercentage of records that need to be sampled
[in]sampling_seedrandom seed that the random generator will use
[in]sampling_methodsampling method to be used; currently only SYSTEM sampling is supported
Returns
0 for success, else one of the HA_xxx values in case of error.

Reimplemented from ha_innobase.

◆ sample_next()

int ha_innopart::sample_next ( void *  scan_ctx,
uchar buf 
)
overrideprivatevirtual

Get the next record for sampling.

Parameters
[in]scan_ctxScan context of the sampling
[in]bufbuffer to place the read record
Returns
0 for success, else one of the HA_xxx values in case of error.

Buffer rows one by one

Reimplemented from ha_innobase.

◆ save_auto_increment()

void ha_innopart::save_auto_increment ( ulonglong  nr)
overrideprivatevirtual

Save currently highest auto increment value.

Parameters
[in]nrAuto increment value to save.

Reimplemented from Partition_helper.

◆ scan_time()

double ha_innopart::scan_time ( void  )
overrideprivatevirtual

Time estimate for full table scan.

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.

Returns
estimated time measured in disk seeks.

Reimplemented from ha_innobase.

◆ set_dd_discard_attribute()

int ha_innopart::set_dd_discard_attribute ( dd::Table table_def,
bool  discard 
)

Set DD discard attribute for tablespace.

Parameters
[in]table_defdd table
[in]discardTrue if this table is discarded
Returns
0 or error number.

◆ set_eq_range()

void ha_innopart::set_eq_range ( bool  eq_range_arg)
inlineoverrideprivatevirtual

Implements Partition_helper.

◆ set_part_info()

void ha_innopart::set_part_info ( partition_info part_info,
bool  early 
)
inlineoverridevirtual

Set the partition info object to be used by the handler.

Parameters
part_infoPartition info to be used by the handler.
earlyTrue if called when part_info only created and parsed, but not setup, checked or fixed.

Implements Partition_handler.

◆ set_partition()

void ha_innopart::set_partition ( uint  part_id)
private

Change active partition.

Copies needed info into m_prebuilt from the partition specific memory.

Parameters
[in]part_idPartition to set as active.

◆ set_range_key_part()

void ha_innopart::set_range_key_part ( KEY_PART_INFO key_part)
inlineoverrideprivatevirtual

Implements Partition_helper.

◆ start_stmt()

int ha_innopart::start_stmt ( THD thd,
thr_lock_type  lock_type 
)
overridevirtual

Start statement.

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.

Parameters
[in]thdHandle to the user thread.
[in]lock_typeLock type.
Returns
0 or error code.

Reimplemented from ha_innobase.

◆ store_lock()

THR_LOCK_DATA ** ha_innopart::store_lock ( THD thd,
THR_LOCK_DATA **  to,
thr_lock_type  lock_type 
)
overrideprivatevirtual

Function to store lock for all partitions in native partitioned table.

Also look at ha_innobase::store_lock for more details.

Parameters
[in]thduser thread handle
[in]topointer to the current element in an array of pointers to lock structs
[in]lock_typelock type to store in 'lock'; this may also be TL_IGNORE
Return values
topointer to the current element in the 'to' array

Reimplemented from ha_innobase.

◆ table_flags()

Table_flags ha_innopart::table_flags ( void  ) const
inlineoverridevirtual

Get the table flags to use for the statement.

Returns
table flags

Reimplemented from ha_innobase.

◆ truncate_impl()

int ha_innopart::truncate_impl ( const char *  name,
TABLE form,
dd::Table table_def 
)
private

TRUNCATE an InnoDB partitioned table.

Parameters
[in]nametable name
[in]formtable definition
[in,out]table_defdd::Table describing table to be truncated. Can be adjusted by SE, the changes will be saved into the data-dictionary at statement commit time.
Returns
error number
Return values
0on success

◆ truncate_partition_low()

int ha_innopart::truncate_partition_low ( dd::Table dd_table)
overrideprivatevirtual

Truncate partition.

Delete all rows in the requested partitions.

Called from Partition_handler::trunctate_partition() or truncate().

Parameters
[in,out]dd_tabledata dictionary table
Return values
errornumber
0on success

Done by deleting the partitions and recreate them again.

Parameters
[in,out]dd_tabledd::Table object for partitioned table which partitions need to be truncated. Can be adjusted by this call. Changes to the table definition will be persisted in the data-dictionary at statement commit time.
Returns
0 or error number.

Reimplemented from Partition_handler.

◆ try_semi_consistent_read()

void ha_innopart::try_semi_consistent_read ( bool  yes)
overrideprivatevirtual

Try semi consistent read.

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.

See also
handler.h and row0mysql.h
Parameters
[in]yesShould semi-consistent read be used.

Reimplemented from ha_innobase.

◆ unlock_row()

void ha_innopart::unlock_row ( void  )
overrideprivatevirtual

Removes a lock on a row.

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.

See also
ha_innobase::unlock_row().

Reimplemented from ha_innobase.

◆ update_create_info()

void ha_innopart::update_create_info ( HA_CREATE_INFO create_info)
overridevirtual

Update create_info.

Used in SHOW CREATE TABLE et al.

Parameters
[in,out]create_infoCreate info to update.

Reimplemented from ha_innobase.

◆ update_part_elem()

void ha_innopart::update_part_elem ( partition_element part_elem,
dict_table_t ib_table,
bool  display_tablespace 
)
private

Fill in data_dir_path and tablespace name from internal data dictionary.

Parameters
[in,out]part_elemPartition element to fill.
[in]ib_tableInnoDB table to copy from.
[in]display_tablespaceDisplay tablespace name if set.

◆ update_partition()

void ha_innopart::update_partition ( uint  part_id)
private

Update active partition.

Copies needed info from m_prebuilt into the partition specific memory.

Parameters
[in]part_idPartition to set as active.

◆ update_row()

int ha_innopart::update_row ( const uchar old_row,
uchar new_row 
)
inlineoverrideprivatevirtual

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!

Parameters
[in]old_rowOld row contents in MySQL format
[out]new_rowUpdated row contents in MySQL format
Returns
error number or 0

Reimplemented from ha_innobase.

◆ update_row_in_part()

int ha_innopart::update_row_in_part ( uint  part_id,
const uchar old_row,
uchar new_row 
)
overrideprivatevirtual

Update a row in partition.

Updates a row given as a parameter to a new value.

Parameters
[in]part_idPartition to update row in.
[in]old_rowOld row in MySQL format.
[in]new_rowNew row in MySQL format.
Returns
error number or 0.

Updates a row given as a parameter to a new value.

Parameters
[in]part_idPartition to update row in.
[in]old_rowOld row in MySQL format.
[in]new_rowNew row in MySQL format.
Returns
0 or error number.

Implements Partition_helper.

◆ was_semi_consistent_read()

bool ha_innopart::was_semi_consistent_read ( void  )
overrideprivatevirtual

Was the last returned row semi consistent read.

In an UPDATE or DELETE, if the row under the cursor was locked by another transaction, and the engine used an optimistic read of the last committed row value under the cursor, then the engine returns 1 from this function. MySQL must NOT try to update this optimistic value. If the optimistic value does not match the WHERE condition, MySQL can decide to skip over this row. This can be used to avoid unnecessary lock waits.

If this method returns true, it will also signal the storage engine that the next read will be a locking re-read of the row.

See also
handler.h and row0mysql.h
Returns
true if last read was semi consistent else false.

Reimplemented from ha_innobase.

◆ write_row()

int ha_innopart::write_row ( uchar record)
inlineoverrideprivatevirtual

Stores a row in an InnoDB database, to the table specified in this handle.

Returns
error code

Reimplemented from ha_innobase.

◆ write_row_in_new_part()

int ha_innopart::write_row_in_new_part ( uint  new_part)
overrideprivatevirtual

write row to new partition.

Parameters
[in]new_partNew partition to write to.
Returns
0 for success else error code.

Implements Partition_helper.

◆ write_row_in_part()

int ha_innopart::write_row_in_part ( uint  part_id,
uchar record 
)
overrideprivatevirtual

Write a row in specific partition.

Write a row in partition.

Stores a row in an InnoDB database, to the table specified in this handle.

Parameters
[in]part_idPartition to write to.
[in]recordA row in MySQL format.
Returns
error code.

Stores a row in an InnoDB database, to the table specified in this handle.

Parameters
[in]part_idPartition to write to.
[in]recordA row in MySQL format.
Returns
0 or error code.

Implements Partition_helper.

Member Data Documentation

◆ m_bitset

byte* ha_innopart::m_bitset
private

byte array for sql_stat_start bitset

◆ m_blob_heap_parts

mem_heap_t** ha_innopart::m_blob_heap_parts
private

blob_heap per partition.

Synchronized with prebuilt->blob_heap when changing partitions.

◆ m_clust_pcur

btr_pcur_t* ha_innopart::m_clust_pcur
private

Original m_prebuilt->clust_pcur.

◆ m_clust_pcur_parts

btr_pcur_t* ha_innopart::m_clust_pcur_parts
private

persistent cluster cursors per partition.

◆ m_ins_node_parts

ins_node_t** ha_innopart::m_ins_node_parts
private

ins_node per partition.

Synchronized with prebuilt->ins_node when changing partitions.

◆ m_new_partitions

Altered_partitions* ha_innopart::m_new_partitions
private

New partitions during ADD/REORG/...

PARTITION.

◆ m_part_share

Ha_innopart_share* ha_innopart::m_part_share
private

Pointer to Ha_innopart_share on the TABLE_SHARE.

◆ m_pcur

btr_pcur_t* ha_innopart::m_pcur
private

Original m_prebuilt->pcur.

◆ m_pcur_map

uint16_t* ha_innopart::m_pcur_map
private

map from part_id to offset in above two arrays.

◆ m_pcur_parts

btr_pcur_t* ha_innopart::m_pcur_parts
private

persistent cursors per partition.

◆ m_row_read_type_parts

ulint* ha_innopart::m_row_read_type_parts
private

row_read_type per partition.

◆ m_sql_stat_start_parts

Sql_stat_start_parts ha_innopart::m_sql_stat_start_parts
private

sql_stat_start per partition.

◆ m_trx_id_parts

trx_id_t* ha_innopart::m_trx_id_parts
private

trx_id from the partitions table->def_trx_id.

Keep in sync with prebuilt->trx_id when changing partitions. prebuilt only reflects the current partition!

◆ m_upd_node_parts

upd_node_t** ha_innopart::m_upd_node_parts
private

upd_node per partition.

Synchronized with prebuilt->upd_node when changing partitions.


The documentation for this class was generated from the following files: