MySQL 8.0.40
Source Code Documentation
|
The consistency information of all ongoing transactions which have consistency GROUP_REPLICATION_CONSISTENCY_BEFORE, GROUP_REPLICATION_CONSISTENCY_AFTER or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER. More...
#include <consistency_manager.h>
Public Member Functions | |
Transaction_consistency_manager () | |
Constructor. More... | |
~Transaction_consistency_manager () override | |
void | clear () |
Clear all information. More... | |
int | after_certification (Transaction_consistency_info *transaction_info) |
Call action after a transaction is certified. More... | |
int | after_applier_prepare (rpl_sidno sidno, rpl_gno gno, my_thread_id thread_id, Group_member_info::Group_member_status member_status) |
Call action after a transaction being prepared on this member applier. More... | |
int | handle_remote_prepare (const rpl_sid *sid, rpl_gno gno, const Gcs_member_identifier &gcs_member_id) |
Call action after a transaction being prepared by other member. More... | |
int | handle_member_leave (const std::vector< Gcs_member_identifier > &leaving_members) |
Call action after members leave the group. More... | |
int | after_commit (my_thread_id thread_id, rpl_sidno sidno, rpl_gno gno) override |
Call action after commit a transaction on this member. More... | |
int | before_transaction_begin (my_thread_id thread_id, ulong gr_consistency_level, ulong timeout, enum_rpl_channel_type rpl_channel_type) override |
Call action before a transaction starts. More... | |
int | handle_sync_before_execution_message (my_thread_id thread_id, const Gcs_member_identifier &gcs_member_id) const |
Call action once a Sync_before_execution_message is received, this will allow fetch the group transactions set ordered with the message order. More... | |
bool | has_local_prepared_transactions () |
Are there local prepared transactions waiting for prepare acknowledge from other members? More... | |
int | schedule_view_change_event (Pipeline_event *pevent) |
Schedule a View_change_log_event log into the relay to after the local prepared transactions are complete, since those transactions belong to the previous view and as such must be logged before this view. More... | |
void | plugin_started () |
Inform that plugin did start. More... | |
void | plugin_is_stopping () |
Inform that plugin is stopping. More... | |
void | register_transaction_observer () |
Register an observer for transactions. More... | |
void | unregister_transaction_observer () |
Unregister the observer for transactions. More... | |
int | before_commit (my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override |
Executed before commit. More... | |
int | before_rollback (my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override |
Executed before rollback. More... | |
int | after_rollback (my_thread_id thread_id) override |
Executed after rollback. More... | |
void | enable_primary_election_checks () |
Tells the consistency manager that a primary election is running so it shall enable primary election checks. More... | |
void | disable_primary_election_checks () |
Tells the consistency manager that a primary election ended so it shall disable primary election checks. More... | |
Public Member Functions inherited from Group_transaction_listener | |
virtual | ~Group_transaction_listener () |
Class destructor. More... | |
Private Member Functions | |
int | transaction_begin_sync_before_execution (my_thread_id thread_id, enum_group_replication_consistency_level consistency_level, ulong timeout) const |
Help method called by transaction begin action that, for transactions with consistency GROUP_REPLICATION_CONSISTENCY_BEFORE or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER will: 1) send a message to all members; 2) when that message is received and processed in-order, w.r.t. More... | |
int | transaction_begin_sync_prepared_transactions (my_thread_id thread_id, ulong timeout) |
Help method called by transaction begin action that, if there are precedent prepared transactions with consistency GROUP_REPLICATION_CONSISTENCY_AFTER or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER, will hold the this transaction until the prepared are committed. More... | |
int | remove_prepared_transaction (Transaction_consistency_manager_key key) |
Help method that cleans prepared transactions and releases transactions waiting on them. More... | |
Private Attributes | |
Checkable_rwlock * | m_map_lock |
Transaction_consistency_manager_map | m_map |
Checkable_rwlock * | m_prepared_transactions_on_my_applier_lock |
std::list< Transaction_consistency_manager_key, Malloc_allocator< Transaction_consistency_manager_key > > | m_prepared_transactions_on_my_applier |
std::list< my_thread_id, Malloc_allocator< my_thread_id > > | m_new_transactions_waiting |
std::list< Transaction_consistency_manager_pevent_pair, Malloc_allocator< Transaction_consistency_manager_pevent_pair > > | m_delayed_view_change_events |
Transaction_consistency_manager_key | m_last_local_transaction |
std::atomic< bool > | m_plugin_stopping |
std::atomic< bool > | m_primary_election_active |
Hold_transactions | m_hold_transactions |
Hold transaction mechanism. More... | |
Additional Inherited Members | |
Public Types inherited from Group_transaction_listener | |
enum | enum_transaction_origin { GROUP_APPLIER_TRANSACTION = 0 , GROUP_RECOVERY_TRANSACTION = 1 , GROUP_LOCAL_TRANSACTION = 2 } |
Enum for transaction origins. More... | |
The consistency information of all ongoing transactions which have consistency GROUP_REPLICATION_CONSISTENCY_BEFORE, GROUP_REPLICATION_CONSISTENCY_AFTER or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER.
Transaction_consistency_manager::Transaction_consistency_manager | ( | ) |
Constructor.
|
override |
int Transaction_consistency_manager::after_applier_prepare | ( | rpl_sidno | sidno, |
rpl_gno | gno, | ||
my_thread_id | thread_id, | ||
Group_member_info::Group_member_status | member_status | ||
) |
Call action after a transaction being prepared on this member applier.
[in] | sidno | the transaction sidno |
[in] | gno | the transaction gno |
[in] | thread_id | the applier thread id |
[in] | member_status | this member status |
0 | OK |
!=0 | error |
int Transaction_consistency_manager::after_certification | ( | Transaction_consistency_info * | transaction_info | ) |
Call action after a transaction is certified.
The transaction coordination among the members will start on this point.
[in] | transaction_info | the transaction info |
0 | OK |
!=0 | error |
|
overridevirtual |
Call action after commit a transaction on this member.
If new transactions are waiting for this prepared transaction to be committed, they will be released.
[in] | thread_id | the transaction thread id |
[in] | sidno | the transaction sidno |
[in] | gno | the transaction gno |
0 | OK |
!=0 | error |
Implements Group_transaction_listener.
|
overridevirtual |
Executed after rollback.
thread_id | the transaction thread id |
Implements Group_transaction_listener.
|
overridevirtual |
Executed before commit.
thread_id | the transaction thread id |
origin | who applied it |
Implements Group_transaction_listener.
|
overridevirtual |
Executed before rollback.
thread_id | the transaction thread id |
origin | who applied it |
Implements Group_transaction_listener.
|
overridevirtual |
Call action before a transaction starts.
It will handle transactions with GROUP_REPLICATION_CONSISTENCY_BEFORE consistency and any others that need to wait for preceding prepared transactions to commit.
[in] | thread_id | the thread that is executing the transaction |
[in] | gr_consistency_level | the transaction consistency |
[in] | timeout | maximum time to wait |
[in] | rpl_channel_type | type of the channel that receives the transaction |
0 | OK |
!=0 | error |
Implements Group_transaction_listener.
void Transaction_consistency_manager::clear | ( | ) |
Clear all information.
void Transaction_consistency_manager::disable_primary_election_checks | ( | ) |
Tells the consistency manager that a primary election ended so it shall disable primary election checks.
void Transaction_consistency_manager::enable_primary_election_checks | ( | ) |
Tells the consistency manager that a primary election is running so it shall enable primary election checks.
int Transaction_consistency_manager::handle_member_leave | ( | const std::vector< Gcs_member_identifier > & | leaving_members | ) |
Call action after members leave the group.
If any of these members are on the prepare wait lists, they will be removed. If any those lists become empty, those transactions proceed to commit.
[in] | leaving_members | the members that left |
0 | OK |
!=0 | error |
int Transaction_consistency_manager::handle_remote_prepare | ( | const rpl_sid * | sid, |
rpl_gno | gno, | ||
const Gcs_member_identifier & | gcs_member_id | ||
) |
Call action after a transaction being prepared by other member.
If this sid is NULL that means this transaction sid is the group name.
[in] | sid | the transaction sid |
[in] | gno | the transaction gno |
[in] | gcs_member_id | the member id |
0 | OK |
!=0 | error |
int Transaction_consistency_manager::handle_sync_before_execution_message | ( | my_thread_id | thread_id, |
const Gcs_member_identifier & | gcs_member_id | ||
) | const |
Call action once a Sync_before_execution_message is received, this will allow fetch the group transactions set ordered with the message order.
[in] | thread_id | the thread that is executing the transaction |
[in] | gcs_member_id | the member id |
0 | OK |
!=0 | error |
bool Transaction_consistency_manager::has_local_prepared_transactions | ( | ) |
Are there local prepared transactions waiting for prepare acknowledge from other members?
void Transaction_consistency_manager::plugin_is_stopping | ( | ) |
Inform that plugin is stopping.
New consistent transactions are not allowed to start. On after_applier_prepare the transactions do not wait for other prepares.
void Transaction_consistency_manager::plugin_started | ( | ) |
Inform that plugin did start.
void Transaction_consistency_manager::register_transaction_observer | ( | ) |
Register an observer for transactions.
|
private |
Help method that cleans prepared transactions and releases transactions waiting on them.
[in] | key | the transaction key |
0 | OK |
!=0 | error |
int Transaction_consistency_manager::schedule_view_change_event | ( | Pipeline_event * | pevent | ) |
Schedule a View_change_log_event log into the relay to after the local prepared transactions are complete, since those transactions belong to the previous view and as such must be logged before this view.
[in] | pevent | the pipeline event that contains the View_change_log_event |
0 | OK |
!=0 | error |
|
private |
Help method called by transaction begin action that, for transactions with consistency GROUP_REPLICATION_CONSISTENCY_BEFORE or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER will: 1) send a message to all members; 2) when that message is received and processed in-order, w.r.t.
the message stream, will fetch the Group Replication applier RECEIVED_TRANSACTION_SET, the set of remote transactions that were allowed to commit; 3) wait until all the transactions on Group Replication applier RECEIVED_TRANSACTION_SET are committed.
[in] | thread_id | the thread that is executing the transaction |
[in] | consistency_level | the transaction consistency |
[in] | timeout | maximum time to wait |
0 | OK |
!=0 | error |
|
private |
Help method called by transaction begin action that, if there are precedent prepared transactions with consistency GROUP_REPLICATION_CONSISTENCY_AFTER or GROUP_REPLICATION_CONSISTENCY_BEFORE_AND_AFTER, will hold the this transaction until the prepared are committed.
[in] | thread_id | the thread that is executing the transaction |
[in] | timeout | maximum time to wait |
0 | OK |
!=0 | error |
void Transaction_consistency_manager::unregister_transaction_observer | ( | ) |
Unregister the observer for transactions.
|
private |
|
private |
Hold transaction mechanism.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |