MySQL 8.3.0
Source Code Documentation
Helpers needed by Partition_helper

Functions

int ha_innopart::initialize_auto_increment (bool no_lock) override
 Set the autoinc column max value. More...
 
void ha_innopart::save_auto_increment (ulonglong nr) override
 Save currently highest auto increment value. More...
 
int ha_innopart::init_record_priority_queue_for_parts (uint used_parts) override
 Setup the ordered record buffer and the priority queue. More...
 
void ha_innopart::destroy_record_priority_queue_for_parts () override
 Destroy the ordered record buffer and the priority queue. More...
 
bool ha_innopart::prepare_for_copy_partitions (Alter_inplace_info *ha_alter_info)
 Create the Altered_partitoins object. More...
 
int ha_innopart::write_row_in_new_part (uint new_part) override
 write row to new partition. More...
 
int ha_innopart::write_row_in_part (uint part_id, uchar *record) override
 Write a row in specific partition. More...
 
int ha_innopart::update_row_in_part (uint part_id, const uchar *old_row, uchar *new_row) override
 Update a row in partition. More...
 
int ha_innopart::delete_row_in_part (uint part_id, const uchar *record) override
 Deletes a row in partition. More...
 
int ha_innopart::index_first_in_part (uint part, uchar *record) override
 Return first record in index from a partition. More...
 
int ha_innopart::index_last_in_part (uint part, uchar *record) override
 Return last record in index from a partition. More...
 
int ha_innopart::index_prev_in_part (uint part, uchar *record) override
 Return previous record in index from a partition. More...
 
int ha_innopart::index_next_in_part (uint part, uchar *record) override
 Return next record in index from a partition. More...
 
int ha_innopart::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 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) override
 Start index scan and return first record from a partition. More...
 
int ha_innopart::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 ha_innopart::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 ha_innopart::read_range_next_in_part (uint part, uchar *record) override
 Return next record in index range scan from a partition. More...
 
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) override
 Start index scan and return first record from a partition. More...
 
int ha_innopart::sample_init (void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method, const bool tablesample) override
 Initialize sampling. More...
 
int ha_innopart::sample_next (void *scan_ctx, uchar *buf) override
 Get the next record for sampling. More...
 
int ha_innopart::sample_end (void *scan_ctx) override
 End sampling. More...
 
int ha_innopart::rnd_init_in_part (uint part_id, bool scan) override
 Initialize random read/scan of a specific partition. More...
 
int ha_innopart::rnd_next_in_part (uint part_id, uchar *buf) override
 Get next row during scan of a specific partition. More...
 
int ha_innopart::rnd_end_in_part (uint part_id, bool scan) override
 End random read/scan of a specific partition. More...
 
void ha_innopart::position_in_last_part (uchar *ref_arg, const uchar *record) override
 Return position for cursor in last used partition. More...
 
int ha_innopart::rnd_pos_by_record (uchar *record) override
 Read row using position using given record to find. More...
 
void ha_innopart::copy_cached_row (uchar *buf, const uchar *cached_row) override
 Copy a cached MySQL row. More...
 

Detailed Description

See also
partition_handler.h

Function Documentation

◆ copy_cached_row()

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

Copy a cached MySQL row.

If requested, also avoids overwriting non-read columns.

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

Reimplemented from Partition_helper.

◆ 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
0 or error number.

Implements Partition_helper.

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

◆ 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_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_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_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_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_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_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_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.

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

Reimplemented from Partition_helper.

◆ initialize_auto_increment()

int ha_innopart::initialize_auto_increment ( bool  no_lock)
inlineoverrideprivatevirtual

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 for success or error code.

Implements Partition_helper.

◆ position_in_last_part()

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

Return position for cursor in last used partition.

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

◆ 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.
[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_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.
[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.

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

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

Implements Partition_helper.

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

Parameters
[in]part_idPartition to initialize.
[in]scanTrue for scan else random access.
Returns
error number or 0.

Implements Partition_helper.

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

Also used to read the FIRST row in a table scan.

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

Implements Partition_helper.

◆ rnd_pos_by_record()

int ha_innopart::rnd_pos_by_record ( uchar record)
overrideprivatevirtual

Read row using position using given record to find.

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,
const bool  tablesample 
)
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
[in]tablesampletrue if the sampling is for tablesample
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.

◆ 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
0 or error number.

Implements Partition_helper.

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

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.

Implements Partition_helper.