MySQL 9.1.0
Source Code Documentation
|
Helper class for in-place alter partitions, see handler.h. More...
Public Member Functions | |
alter_parts (trx_t *trx, Ha_innopart_share *part_share, const Alter_inplace_info *ha_alter_info, partition_info *old_part_info, Altered_partitions *new_partitions) | |
Constructor. More... | |
~alter_parts () override | |
Destructor. More... | |
int | prepare (const dd::Table &old_dd_tab, dd::Table &new_dd_tab, TABLE *altered_table) |
Create the to be created partitions and update internal structures with concurrent writes blocked, while preparing ALTER TABLE. More... | |
void | rollback () |
Notify the storage engine that the changes made during prepare_inplace_alter_table() and inplace_alter_table() will be rolled back for all the partitions. More... | |
int | try_commit (const dd::Table &old_dd_tab, dd::Table &new_dd_tab, const TABLE *table, TABLE *altered_table) |
Try to commit the changes made during prepare_inplace_alter_table() inside the storage engine. More... | |
Public Member Functions inherited from inplace_alter_handler_ctx | |
inplace_alter_handler_ctx ()=default | |
virtual void | set_shared_data (const inplace_alter_handler_ctx *ctx) |
virtual | ~inplace_alter_handler_ctx ()=default |
Static Public Member Functions | |
static bool | apply_to (const Alter_inplace_info *ha_alter_info) |
Determine if this is an ALTER TABLE ... PARTITION operation. More... | |
static bool | need_copy (const Alter_inplace_info *ha_alter_info) |
Determine if copying data between partitions is necessary. More... | |
Static Public Attributes | |
static constexpr Alter_inplace_info::HA_ALTER_FLAGS | OPERATIONS |
Operations that the native partitioning can perform inplace. More... | |
Private Member Functions | |
bool | prepare_alter_part (const dd::Table &old_dd_tab, dd::Table &new_dd_tab) |
Initialize the m_news and m_to_drop array here. More... | |
int | prepare_or_commit_for_new (const dd::Table &old_dd_tab, dd::Table &new_dd_tab, TABLE *altered_table, bool prepare) |
Prepare or commit for all the partitions in table after ALTER TABLE. More... | |
int | prepare_or_commit_for_old (const dd::Table &old_dd_tab, TABLE *altered_table, bool prepare) |
Prepare or commit for all the partitions in table before ALTER TABLE. More... | |
Private Attributes | |
trx_t *const | m_trx |
InnoDB transaction. More... | |
Ha_innopart_share *const | m_part_share |
InnoDB partition specific Handler_share. More... | |
const Alter_inplace_info *const | m_ha_alter_info |
Operation being performed. More... | |
Altered_partitions *const | m_new_partitions |
New partitions helper. More... | |
alter_part_factory | m_factory |
alter_part factory which creates all the necessary alter_part_* More... | |
alter_part_array | m_news |
The alter_part array for all the newly created partitions. More... | |
alter_part_array | m_to_drop |
The alter_part array for all the to be dropped partitions. More... | |
Helper class for in-place alter partitions, see handler.h.
|
inline |
Constructor.
[in,out] | trx | InnoDB transaction |
[in,out] | part_share | Innopart share |
[in] | ha_alter_info | ALTER information |
[in] | old_part_info | Partition info of the table before ALTER TABLE |
[in,out] | new_partitions | Altered partition helper |
|
override |
Destructor.
|
inlinestatic |
Determine if this is an ALTER TABLE ... PARTITION operation.
[in] | ha_alter_info | thd DDL operation |
|
inlinestatic |
Determine if copying data between partitions is necessary.
[in] | ha_alter_info | thd DDL operation |
int alter_parts::prepare | ( | const dd::Table & | old_dd_tab, |
dd::Table & | new_dd_tab, | ||
TABLE * | altered_table | ||
) |
Create the to be created partitions and update internal structures with concurrent writes blocked, while preparing ALTER TABLE.
[in] | old_dd_tab | dd::Table before ALTER TABLE |
[in,out] | new_dd_tab | dd::Table after ALTER TABLE |
[in,out] | altered_table | Table definition after the ALTER |
|
private |
Initialize the m_news and m_to_drop array here.
[in] | old_dd_tab | dd::Table before ALTER TABLE |
[in] | new_dd_tab | dd::Table after ALTER TABLE |
true | if success |
false | on failure |
|
private |
Prepare or commit for all the partitions in table after ALTER TABLE.
Prepare for all the partitions in table after ALTER TABLE.
[in] | old_dd_tab | dd::Table before ALTER TABLE |
[in,out] | new_dd_tab | dd::Table after ALTER TABLE |
[in,out] | altered_table | Table definition after the ALTER |
[in] | prepare | true if it's in prepare phase, false if it's in commit phase |
|
private |
Prepare or commit for all the partitions in table before ALTER TABLE.
[in] | old_dd_tab | dd::Table before ALTER TABLE |
[in,out] | altered_table | Table definition after the ALTER |
[in] | prepare | true if it's in prepare phase, false if it's in commit phase |
void alter_parts::rollback | ( | ) |
Notify the storage engine that the changes made during prepare_inplace_alter_table() and inplace_alter_table() will be rolled back for all the partitions.
int alter_parts::try_commit | ( | const dd::Table & | old_dd_tab, |
dd::Table & | new_dd_tab, | ||
const TABLE * | table, | ||
TABLE * | altered_table | ||
) |
Try to commit the changes made during prepare_inplace_alter_table() inside the storage engine.
This is protected by MDL_EXCLUSIVE.
[in] | old_dd_tab | dd::Table before ALTER TABLE |
[in,out] | new_dd_tab | dd::Table after ALTER TABLE |
[in] | table | Table definition before the ALTER |
[in,out] | altered_table | Table definition after the ALTER |
|
private |
alter_part factory which creates all the necessary alter_part_*
|
private |
Operation being performed.
|
private |
New partitions helper.
|
private |
The alter_part array for all the newly created partitions.
|
private |
InnoDB partition specific Handler_share.
|
private |
The alter_part array for all the to be dropped partitions.
|
private |
InnoDB transaction.
|
staticconstexpr |
Operations that the native partitioning can perform inplace.