MySQL 8.4.2
Source Code Documentation
|
Construct all necessary alter_part_* objects according to the given partition states in both old and new tables. More...
Public Member Functions | |
alter_part_factory (trx_t *trx, const Alter_inplace_info *ha_alter_info, Ha_innopart_share *part_share, partition_info *old_part_info) | |
Constructor. More... | |
~alter_part_factory ()=default | |
Destructor. More... | |
bool | create (alter_part_array &to_drop, alter_part_array &all_news) |
Create the alter_part_* objects according to the given partition states. More... | |
Private Member Functions | |
bool | create_for_reorg (alter_part_array &to_drop, alter_part_array &all_news) |
Suppose that there is a table with 4 range partitions: p0, p1, p2, p3, and the p2 and p3 are going to be reorganized into p21, p22, p31, p33. More... | |
bool | create_for_non_reorg (alter_part_array &to_drop, alter_part_array &all_news) |
Suppose that there is a table with 4 range partitions: p0, p1, p2, p3. More... | |
bool | create_new_checking_conflict (partition_element *new_part, uint &new_part_id, alter_part_array &all_news) |
Create alter_part_add object(s) along with checking if the partition (and its subpartitions) conflicts with any of the original ones This is only for REORGANIZE PARTITION. More... | |
bool | create_old_checking_conflict (partition_element *old_part, uint &old_part_id, alter_part_array &to_drop) |
Create alter_part_drop object(s) along with checking if the partition (and its subpartitions) conflicts with any of the to be created ones. More... | |
bool | is_conflict (const partition_element *new_part, const partition_element *old_part) |
Check if the two (sub)partitions conflict with each other, Which means they have same name. More... | |
bool | create_one (alter_part_array &array, partition_element *part, uint &part_id, uint old_part_id, partition_state state, bool conflict) |
Create alter_part_* object(s) for subpartitions of a partition, or the partition itself. More... | |
alter_part * | create_one_low (uint &part_id, uint old_part_id, partition_state state, const char *tablespace, bool conflict) |
Create the specified alter_part_* object. 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 |
ALTER information. More... | |
partition_info *const | m_old_part_info |
Partition info of the table before ALTER TABLE. More... | |
bool | m_file_per_table |
Current innodb_file_per_table value. More... | |
Construct all necessary alter_part_* objects according to the given partition states in both old and new tables.
|
inline |
Constructor.
[in,out] | trx | Transaction |
[in] | ha_alter_info | ALTER Information |
[in,out] | part_share | Innopart share |
[in] | old_part_info | Partition info of the table before ALTER TABLE |
|
default |
Destructor.
|
inline |
Create the alter_part_* objects according to the given partition states.
[in,out] | to_drop | To store the alter_part_* objects for partitions to be dropped |
[in,out] | all_news | To store the alter_part_* objects for partitions in table after ALTER TABLE |
true | On failure |
|
private |
Suppose that there is a table with 4 range partitions: p0, p1, p2, p3.
So finally, the to_drop array would contain {}, which is empty; the all_news array would contains {alter_part_normal, alter_part_normal, alter_part_normal, alter_part_normal, alter_part_add}.
So finally, the to_drop array would contain {alter_part_drop}, which is for p2, so part_id is 2; the all_news array would contains {alter_part_normal, alter_part_normal, alter_part_normal}.
Suppose it's the same table with 4 partitions, but it's partitioned by HASH.
So finally, the to_drop array would contain {}, which is empty; the all_news array would contains {alter_part_change, alter_part_change, alter_part_change, alter_part_change, alter_part_add, alter_part_add}.
So finally, the to_drop array would contain {alter_part_drop, alter_part_drop}, which are for p2, p3, part_id are 2 and 3; the all_news array would contains {alter_part_change, alter_part_change}.
So finally, the to_drop array would contain {}, which is empty; the all_news array would contains {alter_part_normal, alter_part_change, alter_part_normal, alter_part_change}. Create the alter_part_* objects when it's NOT an operation like REORGANIZE PARTITION
[in,out] | to_drop | To store the alter_part_* objects for partitions to be dropped |
[in,out] | all_news | To store the alter_part_* objects for partitions in table after ALTER TABLE |
true | On Failure |
|
private |
Suppose that there is a table with 4 range partitions: p0, p1, p2, p3, and the p2 and p3 are going to be reorganized into p21, p22, p31, p33.
In modified_part_info->temp_partitions list, there are only p2 and p3 with the state PART_TO_BE_REORGED, while in modified_part_info->partitions list, it contains {PART_NORMAL, PART_NORMAL, PART_TO_BE_ADDED, PART_TO_BE_ADDED, PART_TO_BE_ADDED, PART_TO_BE_ADDED}.
So finally, the to_drop array would contain {alter_part_drop, alter_part_drop}, which are for p2, p3; the all_news array would contains {alter_part_normal, alter_part_normal, alter_part_add, alter_part_add, alter_part_add, alter_part_add}.
Note that the scenario that reorganized and to be reorganized partition/subpartition have the same name, would be checked here too Create the alter_part_* objects when it's an operation like REORGANIZE PARTITION
[in,out] | to_drop | To store the alter_part_* objects for partitions to be dropped |
[in,out] | all_news | To store the alter_part_* objects for partitions in table after ALTER TABLE |
true | On failure |
|
private |
Create alter_part_add object(s) along with checking if the partition (and its subpartitions) conflicts with any of the original ones This is only for REORGANIZE PARTITION.
[in] | new_part | The new partition to check |
[in,out] | new_part_id | Partition id for both partition and subpartition, which would be increased by number of subpartitions per partition here |
[in,out] | all_news | To store the alter_part_add objects here |
false | On success |
true | On failure |
|
private |
Create alter_part_drop object(s) along with checking if the partition (and its subpartitions) conflicts with any of the to be created ones.
This is only for REORGANIZE PARTITION
[in] | old_part | The old partition to check |
[in,out] | old_part_id | Partition id for this partition or the first subpartition, which would be increased by number of subpartitions per partition here |
[in,out] | to_drop | To store the alter_part_drop objects |
false | On success |
true | On failure |
|
private |
Create alter_part_* object(s) for subpartitions of a partition, or the partition itself.
[in,out] | array | Where to store the new object(s) |
[in] | part | partition_element to handle |
[in,out] | part_id | Partition id for both partition and subpartition, which would be increased by number of object(s) created |
[in] | old_part_id | Start partition id of the table before ALTER TABLE |
[in] | state | Partition state |
[in] | conflict | Only valid when state is PART_TO_BE_ADDED. True if the new (sub)partition has the same name with an exist one and they are of innodb_file_per_table |
false | On success |
true | On failure |
|
private |
Create the specified alter_part_* object.
[in] | part_id | Partition id for current partition |
[in] | old_part_id | Start partition id of the table before ALTER TABLE |
[in] | state | Partition state |
[in] | tablespace | Tablespace specified explicitly |
[in] | conflict | Only valid when state is PART_TO_BE_ADDED. True if the new (sub)partition has the same name with an exist one and they are of innodb_file_per_table |
|
private |
Check if the two (sub)partitions conflict with each other, Which means they have same name.
[in] | new_part | New partition to check |
[in] | old_part | Old partition to check |
true | Conflict |
false | Not conflict |
|
private |
Current innodb_file_per_table value.
|
private |
ALTER information.
|
private |
Partition info of the table before ALTER TABLE.
|
private |
InnoDB partition specific Handler_share.
|
private |
InnoDB transaction.