MySQL  8.0.19
Source Code Documentation
Transaction_consistency_manager Class Reference

#include <consistency_manager.h>

Inheritance diagram for Transaction_consistency_manager:
Group_transaction_listener

Public Member Functions

 Transaction_consistency_manager ()
 Constructor. More...
 
virtual ~Transaction_consistency_manager ()
 
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...
 
virtual int after_commit (my_thread_id thread_id, rpl_sidno sidno, rpl_gno gno)
 Call action after commit a transaction on this member. More...
 
virtual int before_transaction_begin (my_thread_id thread_id, ulong gr_consistency_level, ulong timeout, enum_rpl_channel_type rpl_channel_type)
 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...
 
virtual int before_commit (my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin)
 Executed before commit. More...
 
virtual int before_rollback (my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin)
 Executed before rollback. More...
 
virtual int after_rollback (my_thread_id thread_id)
 Executed after rollback. 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_rwlockm_map_lock
 
Transaction_consistency_manager_map m_map
 
Checkable_rwlockm_prepared_transactions_on_my_applier_lock
 
std::list< Transaction_consistency_manager_keym_prepared_transactions_on_my_applier
 
std::list< my_thread_idm_new_transactions_waiting
 
std::list< Pipeline_event * > m_delayed_view_change_events
 
std::atomic< boolm_plugin_stopping
 

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Transaction_consistency_manager()

Transaction_consistency_manager::Transaction_consistency_manager ( )

Constructor.

◆ ~Transaction_consistency_manager()

Transaction_consistency_manager::~Transaction_consistency_manager ( )
virtual

Member Function Documentation

◆ after_applier_prepare()

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.

Parameters
[in]sidnothe transaction sidno
[in]gnothe transaction gno
[in]thread_idthe applier thread id
[in]member_statusthis member status
Returns
Operation status
Return values
0OK
!=0error

◆ after_certification()

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.

Parameters
[in]transaction_infothe transaction info
Returns
Operation status
Return values
0OK
!=0error

◆ after_commit()

int Transaction_consistency_manager::after_commit ( my_thread_id  thread_id,
rpl_sidno  sidno,
rpl_gno  gno 
)
virtual

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.

Parameters
[in]thread_idthe transaction thread id
[in]sidnothe transaction sidno
[in]gnothe transaction gno
Returns
Operation status
Return values
0OK
!=0error

Implements Group_transaction_listener.

◆ after_rollback()

int Transaction_consistency_manager::after_rollback ( my_thread_id  thread_id)
virtual

Executed after rollback.

Parameters
thread_idthe transaction thread id

Implements Group_transaction_listener.

◆ before_commit()

int Transaction_consistency_manager::before_commit ( my_thread_id  thread_id,
Group_transaction_listener::enum_transaction_origin  origin 
)
virtual

Executed before commit.

Parameters
thread_idthe transaction thread id
originwho applied it

Implements Group_transaction_listener.

◆ before_rollback()

int Transaction_consistency_manager::before_rollback ( my_thread_id  thread_id,
Group_transaction_listener::enum_transaction_origin  origin 
)
virtual

Executed before rollback.

Parameters
thread_idthe transaction thread id
originwho applied it

Implements Group_transaction_listener.

◆ before_transaction_begin()

int Transaction_consistency_manager::before_transaction_begin ( my_thread_id  thread_id,
ulong  gr_consistency_level,
ulong  timeout,
enum_rpl_channel_type  rpl_channel_type 
)
virtual

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.

Parameters
[in]thread_idthe thread that is executing the transaction
[in]gr_consistency_levelthe transaction consistency
[in]timeoutmaximum time to wait
[in]rpl_channel_typetype of the channel that receives the transaction
Returns
Operation status
Return values
0OK
!=0error

Implements Group_transaction_listener.

◆ clear()

void Transaction_consistency_manager::clear ( )

Clear all information.

◆ handle_member_leave()

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.

Parameters
[in]leaving_membersthe members that left
Returns
Operation status
Return values
0OK
!=0error

◆ handle_remote_prepare()

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.

Parameters
[in]sidthe transaction sid
[in]gnothe transaction gno
[in]gcs_member_idthe member id
Returns
Operation status
Return values
0OK
!=0error

◆ handle_sync_before_execution_message()

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.

Parameters
[in]thread_idthe thread that is executing the transaction
[in]gcs_member_idthe member id
Returns
Operation status
Return values
0OK
!=0error

◆ has_local_prepared_transactions()

bool Transaction_consistency_manager::has_local_prepared_transactions ( )

Are there local prepared transactions waiting for prepare acknowledge from other members?

Returns
true yes false otherwise

◆ plugin_is_stopping()

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.

◆ plugin_started()

void Transaction_consistency_manager::plugin_started ( )

Inform that plugin did start.

◆ register_transaction_observer()

void Transaction_consistency_manager::register_transaction_observer ( )

Register an observer for transactions.

◆ remove_prepared_transaction()

int Transaction_consistency_manager::remove_prepared_transaction ( Transaction_consistency_manager_key  key)
private

Help method that cleans prepared transactions and releases transactions waiting on them.

Parameters
[in]keythe transaction key
Returns
Operation status
Return values
0OK
!=0error

◆ schedule_view_change_event()

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.

Parameters
[in]peventthe pipeline event that contains the View_change_log_event
Returns
Operation status
Return values
0OK
!=0error

◆ transaction_begin_sync_before_execution()

int Transaction_consistency_manager::transaction_begin_sync_before_execution ( my_thread_id  thread_id,
enum_group_replication_consistency_level  consistency_level,
ulong  timeout 
) const
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.

Parameters
[in]thread_idthe thread that is executing the transaction
[in]consistency_levelthe transaction consistency
[in]timeoutmaximum time to wait
Returns
Operation status
Return values
0OK
!=0error

◆ transaction_begin_sync_prepared_transactions()

int Transaction_consistency_manager::transaction_begin_sync_prepared_transactions ( my_thread_id  thread_id,
ulong  timeout 
)
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.

Parameters
[in]thread_idthe thread that is executing the transaction
[in]timeoutmaximum time to wait
Returns
Operation status
Return values
0OK
!=0error

◆ unregister_transaction_observer()

void Transaction_consistency_manager::unregister_transaction_observer ( )

Unregister the observer for transactions.

Member Data Documentation

◆ m_delayed_view_change_events

std::list<Pipeline_event *> Transaction_consistency_manager::m_delayed_view_change_events
private

◆ m_map

Transaction_consistency_manager_map Transaction_consistency_manager::m_map
private

◆ m_map_lock

Checkable_rwlock* Transaction_consistency_manager::m_map_lock
private

◆ m_new_transactions_waiting

std::list<my_thread_id> Transaction_consistency_manager::m_new_transactions_waiting
private

◆ m_plugin_stopping

std::atomic<bool> Transaction_consistency_manager::m_plugin_stopping
private

◆ m_prepared_transactions_on_my_applier

std::list<Transaction_consistency_manager_key> Transaction_consistency_manager::m_prepared_transactions_on_my_applier
private

◆ m_prepared_transactions_on_my_applier_lock

Checkable_rwlock* Transaction_consistency_manager::m_prepared_transactions_on_my_applier_lock
private

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