MySQL 8.4.2
Source Code Documentation
Partition_share Class Reference

Partition specific Handler_share. More...

#include <partition_handler.h>

Inheritance diagram for Partition_share:
[legend]

Public Member Functions

 Partition_share ()
 
 ~Partition_share () override
 
bool init_auto_inc_mutex (TABLE_SHARE *table_share)
 Initializes and sets auto_inc_mutex. More...
 
void release_auto_inc_if_possible (THD *thd, TABLE_SHARE *table_share, const ulonglong next_insert_id, const ulonglong max_reserved)
 Release reserved auto increment values not used. More...
 
void lock_auto_inc ()
 lock mutex protecting auto increment value next_auto_inc_val. More...
 
void unlock_auto_inc ()
 unlock mutex protecting auto increment value next_auto_inc_val. More...
 
bool populate_partition_name_hash (partition_info *part_info)
 Populate partition_name_hash with partition and subpartition names from part_info. More...
 
const char * get_partition_name (size_t part_id) const
 Get partition name. More...
 

Public Attributes

bool auto_inc_initialized
 Set if auto increment is used an initialized. More...
 
mysql_mutex_tauto_inc_mutex
 Mutex protecting next_auto_inc_val. More...
 
ulonglong next_auto_inc_val
 First non reserved auto increment value. More...
 
std::unique_ptr< collation_unordered_map< std::string, unique_ptr_my_free< PART_NAME_DEF > > > partition_name_hash
 Hash of partition names. More...
 

Private Member Functions

bool insert_partition_name_in_hash (const char *name, uint part_id, bool is_subpart)
 Insert [sub]partition name into partition_name_hash. More...
 

Private Attributes

const uchar ** partition_names
 

Detailed Description

Partition specific Handler_share.

Constructor & Destructor Documentation

◆ Partition_share()

Partition_share::Partition_share ( )

◆ ~Partition_share()

Partition_share::~Partition_share ( )
override

Member Function Documentation

◆ get_partition_name()

const char * Partition_share::get_partition_name ( size_t  part_id) const

Get partition name.

Parameters
part_idPartition id (for subpartitioned table only subpartition names will be returned.)
Returns
partition name or NULL if error.

◆ init_auto_inc_mutex()

bool Partition_share::init_auto_inc_mutex ( TABLE_SHARE table_share)

Initializes and sets auto_inc_mutex.

Initialize auto increment mutex in share.

Only needed to be called if the table have an auto increment. Must hold TABLE_SHARE::LOCK_ha_data when calling.

Returns
Operation status.
Return values
trueFailure (out of memory).
falseSuccess.

◆ insert_partition_name_in_hash()

bool Partition_share::insert_partition_name_in_hash ( const char *  name,
uint  part_id,
bool  is_subpart 
)
private

Insert [sub]partition name into partition_name_hash.

Parameters
namePartition name.
part_idPartition id.
is_subpartTrue if subpartition else partition.
Returns
Operation status.
Return values
falseSuccess.
trueFailure.

◆ lock_auto_inc()

void Partition_share::lock_auto_inc ( )
inline

lock mutex protecting auto increment value next_auto_inc_val.

◆ populate_partition_name_hash()

bool Partition_share::populate_partition_name_hash ( partition_info part_info)

Populate partition_name_hash with partition and subpartition names from part_info.

Populate the partition_name_hash in part_share.

Parameters
part_infoPartition info containing all partitions metadata.
Returns
Operation status.
Return values
falseSuccess.
trueFailure.

◆ release_auto_inc_if_possible()

void Partition_share::release_auto_inc_if_possible ( THD thd,
TABLE_SHARE table_share,
const ulonglong  next_insert_id,
const ulonglong  max_reserved 
)

Release reserved auto increment values not used.

Parameters
thdThread.
table_shareTable Share
next_insert_idNext insert id (first non used auto inc value).
max_reservedEnd of reserved auto inc range.

◆ unlock_auto_inc()

void Partition_share::unlock_auto_inc ( )
inline

unlock mutex protecting auto increment value next_auto_inc_val.

Member Data Documentation

◆ auto_inc_initialized

bool Partition_share::auto_inc_initialized

Set if auto increment is used an initialized.

◆ auto_inc_mutex

mysql_mutex_t* Partition_share::auto_inc_mutex

Mutex protecting next_auto_inc_val.

Initialized if table uses auto increment.

◆ next_auto_inc_val

ulonglong Partition_share::next_auto_inc_val

First non reserved auto increment value.

◆ partition_name_hash

std::unique_ptr< collation_unordered_map<std::string, unique_ptr_my_free<PART_NAME_DEF> > > Partition_share::partition_name_hash

Hash of partition names.

Initialized by the first handler instance of a table_share calling populate_partition_name_hash(). After that it is read-only, i.e. no locking required for reading.

◆ partition_names

const uchar** Partition_share::partition_names
private

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