MySQL  8.0.21
Source Code Documentation
alter_part_add Class Reference

Class which handles the partition of the state PART_TO_BE_ADDED. More...

Inheritance diagram for alter_part_add:
alter_part

Public Member Functions

 alter_part_add (uint part_id, partition_state state, const char *table_name, const char *tablespace, trx_t *trx, const Alter_inplace_info *ha_alter_info, bool file_per_table, ib_uint64_t autoinc, bool conflict)
 Constructor. More...
 
 ~alter_part_add ()
 Destructor. More...
 
int prepare (TABLE *altered_table, const dd::Partition *old_part, dd::Partition *new_part)
 Prepare. More...
 
int try_commit (const TABLE *table, TABLE *altered_table, const dd::Partition *old_part, dd::Partition *new_part)
 Try to commit. More...
 
void rollback ()
 Rollback. More...
 
- Public Member Functions inherited from alter_part
virtual ~alter_part ()
 Virtual destructor. More...
 
virtual uint part_id () const
 Return the partition id. More...
 
virtual partition_state state () const
 Return the partition state. More...
 
dict_table_tnew_table ()
 Get the InnoDB table object for newly created partition if applicable. More...
 
void free_old_part (bool check_in_cache, const char *part_name)
 Set the freed old partition to nullptr to avoid dangling pointer. More...
 

Private Member Functions

bool need_rename () const
 Check if the new partition file needs a temporary name and should be renamed at last. More...
 

Private Attributes

const Alter_inplace_infom_ha_alter_info
 ALTER information. More...
 
const bool m_file_per_table
 Current value of innodb_file_per_table. More...
 
const ib_uint64_t m_autoinc
 Next AUTOINC value to use. More...
 
const bool m_conflict
 True if there is already a partition table with the same name. More...
 
char m_tablespace [FN_REFLEN+1]
 Tablespace of this partition. More...
 

Additional Inherited Members

- Protected Member Functions inherited from alter_part
 alter_part (trx_t *trx, uint part_id, partition_state state, const char *table_name, dict_table_t **old)
 Constructor. More...
 
bool build_partition_name (const dd::Partition *dd_part, bool temp, char *name)
 Build the partition name for specified partition. More...
 
int create (const char *part_name, dd::Partition *dd_part, TABLE *table, const char *tablespace, bool file_per_table, ib_uint64_t autoinc)
 Create a new partition. More...
 
- Protected Attributes inherited from alter_part
trx_t *const m_trx
 InnoDB transaction, nullptr if not used. More...
 
uint m_part_id
 Partition id in the table. More...
 
partition_state m_state
 Partition state of the partition on which this class will do operations. More...
 
const char * m_table_name
 Partitioned table name, in form of . More...
 
dict_table_t ** m_old
 The InnoDB table object for old partition. More...
 
dict_table_tm_new
 The InnoDB table object for newly created partition. More...
 

Detailed Description

Class which handles the partition of the state PART_TO_BE_ADDED.

See comments for alter_part_factory::create_for_reorg and alter_part_factory::create_for_non_reorg.

Constructor & Destructor Documentation

◆ alter_part_add()

alter_part_add::alter_part_add ( uint  part_id,
partition_state  state,
const char *  table_name,
const char *  tablespace,
trx_t trx,
const Alter_inplace_info ha_alter_info,
bool  file_per_table,
ib_uint64_t  autoinc,
bool  conflict 
)
inline

Constructor.

Parameters
[in]part_idPartition id in the table. This could be partition id for either old table or new table, callers should remember which one is applicable
[in]statePartition state of the partition on which this class will do operations. If this is for one partition in new table, the partition state is the same for both the new partition and the corresponding old partition
[in]table_namePartitioned table name, in the form of db/table, which already considers the charset
[in]tablespaceTablespace specified explicitly
[in,out]trxInnoDB transaction
[in]ha_alter_infoALTER information
[in]file_per_tableCurrent value of innodb_file_per_table
[in]autoincNext autoinc value to use
[in]conflictTrue if there is already a partition table with the same name

◆ ~alter_part_add()

alter_part_add::~alter_part_add ( )
inline

Destructor.

Member Function Documentation

◆ need_rename()

bool alter_part_add::need_rename ( ) const
inlineprivate

Check if the new partition file needs a temporary name and should be renamed at last.

◆ prepare()

int alter_part_add::prepare ( TABLE altered_table,
const dd::Partition old_part,
dd::Partition new_part 
)
inlinevirtual

Prepare.

Parameters
[in,out]altered_tableTable definition after the ALTER
[in]old_partthe stored old partition or nullptr if no corresponding one exists
[in,out]new_partthe stored new partition or nullptr if no corresponding one exists
Returns
0 or error number

Reimplemented from alter_part.

◆ rollback()

void alter_part_add::rollback ( )
inlinevirtual

Rollback.

Reimplemented from alter_part.

◆ try_commit()

int alter_part_add::try_commit ( const TABLE table,
TABLE altered_table,
const dd::Partition old_part,
dd::Partition new_part 
)
inlinevirtual

Try to commit.

Parameters
[in]tableTable definition before the ALTER
[in,out]altered_tableTable definition after the ALTER
[in]old_partthe stored old partition or nullptr if no corresponding one exists
[in,out]new_partthe stored new partition or nullptr if no corresponding one exists
Returns
0 or error number

Reimplemented from alter_part.

Member Data Documentation

◆ m_autoinc

const ib_uint64_t alter_part_add::m_autoinc
private

Next AUTOINC value to use.

◆ m_conflict

const bool alter_part_add::m_conflict
private

True if there is already a partition table with the same name.

◆ m_file_per_table

const bool alter_part_add::m_file_per_table
private

Current value of innodb_file_per_table.

◆ m_ha_alter_info

const Alter_inplace_info* alter_part_add::m_ha_alter_info
private

ALTER information.

◆ m_tablespace

char alter_part_add::m_tablespace[FN_REFLEN+1]
private

Tablespace of this partition.


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