MySQL  8.0.16
Source Code Documentation
Ha_innopart_share Class Reference

InnoDB partition specific Handler_share. More...

#include <ha_innopart.h>

Inheritance diagram for Ha_innopart_share:
Partition_share Handler_share

Public Member Functions

 Ha_innopart_share (TABLE_SHARE *table_share)
 
 ~Ha_innopart_share ()
 
void set_table_part (uint part_id, dict_table_t *table)
 Set innodb table for given partition. More...
 
dict_table_t ** get_table_part_ref (uint part_id)
 Get table reference for given partition. More...
 
dict_table_tget_table_part (uint part_id) const
 Return innodb table for given partition. More...
 
dict_index_tget_index (uint part_id, uint keynr)
 Return innodb index for given partition and key number. More...
 
uint get_mysql_key (uint part_id, const dict_index_t *index)
 Get MySQL key number corresponding to InnoDB index. More...
 
bool has_table_parts () const
 Return whether share has opened InnoDB tables for partitions. More...
 
void increment_ref_counts ()
 Increment share and InnoDB tables reference counters. More...
 
bool set_table_parts_and_indexes (const TABLE *table, partition_info *part_info, dict_table_t **table_parts)
 Initialize the share with table and indexes per partition. More...
 
void close_table_parts ()
 Close the table partitions. More...
 
const TABLE_SHAREget_table_share () const
 
uint get_num_parts () const
 Get the number of partitions. More...
 
void set_v_templ (TABLE *table, dict_table_t *ib_table, const char *name)
 Set up the virtual column template for partition table, and points all m_table_parts[]->vc_templ to it. More...
 

Static Public Member Functions

static dict_table_t ** open_table_parts (THD *thd, const TABLE *table, const dd::Table *dd_table, partition_info *part_info, const char *table_name)
 Open InnoDB tables for partitions and return them as array. More...
 
static void close_table_parts (dict_table_t **table_parts, uint tot_parts)
 Close InnoDB tables for partitions. More...
 
static void partition_name_casedn_str (char *s)
 Fold to lower case if windows or lower_case_table_names == 1. More...
 
static size_t append_sep_and_name (char *to, const char *from, const char *sep, size_t len)
 Translate and append partition name. More...
 
static size_t create_partition_postfix (char *partition_name, size_t size, const dd::Partition *dd_part)
 Create the postfix of a partitioned table name. More...
 

Private Member Functions

 Ha_innopart_share ()
 Disable default constructor. More...
 

Static Private Member Functions

static bool open_one_table_part (dd::cache::Dictionary_client *client, THD *thd, const TABLE *table, const dd::Partition *dd_part, const char *part_name, dict_table_t **part_dict_table)
 Open one partition. More...
 

Private Attributes

dict_table_t ** m_table_parts
 Array of all included table definitions (one per partition). More...
 
dict_index_t ** m_index_mapping
 Instead of INNOBASE_SHARE::idx_trans_tbl. More...
 
uint m_tot_parts
 Total number of partitions. More...
 
uint m_index_count
 Number of indexes. More...
 
uint m_ref_count
 Reference count. More...
 
TABLE_SHAREm_table_share
 Pointer back to owning TABLE_SHARE. More...
 

Additional Inherited Members

Detailed Description

InnoDB partition specific Handler_share.

Constructor & Destructor Documentation

◆ Ha_innopart_share() [1/2]

Ha_innopart_share::Ha_innopart_share ( TABLE_SHARE table_share)

◆ ~Ha_innopart_share()

Ha_innopart_share::~Ha_innopart_share ( )

◆ Ha_innopart_share() [2/2]

Ha_innopart_share::Ha_innopart_share ( )
inlineprivate

Disable default constructor.

Member Function Documentation

◆ append_sep_and_name()

size_t Ha_innopart_share::append_sep_and_name ( char *  to,
const char *  from,
const char *  sep,
size_t  len 
)
static

Translate and append partition name.

Parameters
[out]toString to write in filesystem charset
[in]fromName in system charset
[in]sepSeparator
[in]lenMax length of to buffer
Returns
length of written string.

◆ close_table_parts() [1/2]

void Ha_innopart_share::close_table_parts ( void  )

Close the table partitions.

If all instances are closed, also release the resources.

◆ close_table_parts() [2/2]

void Ha_innopart_share::close_table_parts ( dict_table_t **  table_parts,
uint  tot_parts 
)
static

Close InnoDB tables for partitions.

Parameters
[in]table_partsArray of InnoDB tables for partitions.
[in]tot_partsNumber of partitions.

◆ create_partition_postfix()

size_t Ha_innopart_share::create_partition_postfix ( char *  partition_name,
size_t  size,
const dd::Partition dd_part 
)
static

Create the postfix of a partitioned table name.

Parameters
[in,out]partition_nameBuffer to write the postfix
[in]sizeSize of the buffer
[in]dd_partPartition
Returns
the length of written postfix.

◆ get_index()

dict_index_t * Ha_innopart_share::get_index ( uint  part_id,
uint  keynr 
)
inline

Return innodb index for given partition and key number.

Get index.

Parameters
[in]part_idPartition number.
[in]keynrKey number.
Returns
InnoDB index.

Find the index of the specified partition and key number.

Parameters
[in]part_idPartition number.
[in]keynrKey number.
Returns
Index pointer or NULL.

◆ get_mysql_key()

uint Ha_innopart_share::get_mysql_key ( uint  part_id,
const dict_index_t index 
)
inline

Get MySQL key number corresponding to InnoDB index.

Parameters
[in]part_idPartition number.
[in]indexInnoDB index.
Returns
MySQL key number or MAX_KEY if non-existent.

Calculates the key number used inside MySQL for an Innobase index. We will first check the "index translation table" for a match of the index to get the index number. If there does not exist an "index translation table", or not able to find the index in the translation table, then we will fall back to the traditional way of looping through dict_index_t list to find a match. In this case, we have to take into account if we generated a default clustered index for the table

Parameters
[in]part_idPartition the index belongs to.
[in]indexIndex to return MySQL key number for.
Returns
the key number used inside MySQL or UINT_MAX if key is not found.

◆ get_num_parts()

uint Ha_innopart_share::get_num_parts ( ) const
inline

Get the number of partitions.

Returns
number of partitions

◆ get_table_part()

dict_table_t* Ha_innopart_share::get_table_part ( uint  part_id) const
inline

Return innodb table for given partition.

Parameters
[in]part_idPartition number.
Returns
InnoDB table.

◆ get_table_part_ref()

dict_table_t** Ha_innopart_share::get_table_part_ref ( uint  part_id)
inline

Get table reference for given partition.

Parameters
[in]part_idPartition number
Returns
InnoDB table reference.

◆ get_table_share()

const TABLE_SHARE* Ha_innopart_share::get_table_share ( ) const
inline
Returns
the TABLE SHARE object

◆ has_table_parts()

bool Ha_innopart_share::has_table_parts ( ) const
inline

Return whether share has opened InnoDB tables for partitions.

◆ increment_ref_counts()

void Ha_innopart_share::increment_ref_counts ( )

Increment share and InnoDB tables reference counters.

◆ open_one_table_part()

bool Ha_innopart_share::open_one_table_part ( dd::cache::Dictionary_client client,
THD thd,
const TABLE table,
const dd::Partition dd_part,
const char *  part_name,
dict_table_t **  part_dict_table 
)
staticprivate

Open one partition.

Parameters
[in,out]clientData dictionary client
[in]thdThread THD
[in]tableMySQL table definition
[in]dd_partdd::Partition
[in]part_nameTable name of this partition
[out]part_dict_tableInnoDB table for partition
Return values
FalseOn success
TrueOn failure
Parameters
[in,out]clientData dictionary client
[in]thdThread THD
[in]tableMySQL table definition
[in]dd_partdd::Partition
[in]part_nameTable name of this partition
[out]part_dict_tableInnoDB table for partition
Return values
falseon success
trueon failure

◆ open_table_parts()

dict_table_t ** Ha_innopart_share::open_table_parts ( THD thd,
const TABLE table,
const dd::Table dd_table,
partition_info part_info,
const char *  table_name 
)
static

Open InnoDB tables for partitions and return them as array.

Parameters
[in,out]thdThread context
[in]tableMySQL table definition
[in]dd_tableGlobal DD table object
[in]part_infoPartition info (partition names to use)
[in]table_nameTable name (db/table_name)
Returns
Array on InnoDB tables on success else nullptr.

◆ partition_name_casedn_str()

void Ha_innopart_share::partition_name_casedn_str ( char *  s)
static

Fold to lower case if windows or lower_case_table_names == 1.

Parameters
[in,out]sString to fold.

◆ set_table_part()

void Ha_innopart_share::set_table_part ( uint  part_id,
dict_table_t table 
)
inline

Set innodb table for given partition.

Parameters
[in]part_idPartition number.
[in]tableTable.

◆ set_table_parts_and_indexes()

bool Ha_innopart_share::set_table_parts_and_indexes ( const TABLE table,
partition_info part_info,
dict_table_t **  table_parts 
)

Initialize the share with table and indexes per partition.

Parameters
[in]tableMySQL table definition
[in]part_infoPartition info (partition names to use)
[in]table_partsArray of InnoDB tables for partitions.
Returns
false on success else true.
Parameters
[in]tableMySQL table definition
[in]part_infoPartition info (partition names to use).
[in]table_partsArray of InnoDB tables for partitions.
Returns
false on success else true.

◆ set_v_templ()

void Ha_innopart_share::set_v_templ ( TABLE table,
dict_table_t ib_table,
const char *  name 
)

Set up the virtual column template for partition table, and points all m_table_parts[]->vc_templ to it.

Parameters
[in]tableMySQL TABLE object
[in]ib_tableInnoDB dict_table_t
[in]nameTable name (db/table_name)

Member Data Documentation

◆ m_index_count

uint Ha_innopart_share::m_index_count
private

Number of indexes.

◆ m_index_mapping

dict_index_t** Ha_innopart_share::m_index_mapping
private

Instead of INNOBASE_SHARE::idx_trans_tbl.

Maps MySQL index number to InnoDB index per partition.

◆ m_ref_count

uint Ha_innopart_share::m_ref_count
private

Reference count.

◆ m_table_parts

dict_table_t** Ha_innopart_share::m_table_parts
private

Array of all included table definitions (one per partition).

◆ m_table_share

TABLE_SHARE* Ha_innopart_share::m_table_share
private

Pointer back to owning TABLE_SHARE.

◆ m_tot_parts

uint Ha_innopart_share::m_tot_parts
private

Total number of partitions.


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