MySQL 8.4.2
Source Code Documentation
|
This class is an interface for session consistency instrumentation in the server. More...
#include <rpl_context.h>
Classes | |
class | Ctx_change_listener |
This is an interface to be implemented by classes that want to listen to changes to this context. More... | |
Public Member Functions | |
Session_consistency_gtids_ctx () | |
Simple constructor. More... | |
virtual | ~Session_consistency_gtids_ctx () |
The destructor. More... | |
void | register_ctx_change_listener (Session_consistency_gtids_ctx::Ctx_change_listener *listener, THD *thd) |
Registers the listener. More... | |
void | unregister_ctx_change_listener (Session_consistency_gtids_ctx::Ctx_change_listener *listener) |
Unregisters the listener. More... | |
Gtid_set * | state () |
This member function MUST return a reference to the set of collected GTIDs so far. More... | |
virtual bool | notify_after_response_packet (const THD *thd) |
This function MUST be called after the response packet is set to the client connected. More... | |
virtual bool | notify_after_gtid_executed_update (const THD *thd) |
This function SHALL be called once the GTID for the given transaction has has been added to GTID_EXECUTED. More... | |
virtual bool | notify_after_transaction_commit (const THD *thd) |
This function MUST be called after a transaction is committed in the server. More... | |
virtual bool | notify_after_xa_prepare (const THD *thd) |
void | update_tracking_activeness_from_session_variable (const THD *thd) |
Update session tracker (m_curr_session_track_gtids) from thd. More... | |
Protected Member Functions | |
bool | shall_collect (const THD *thd) |
void | notify_ctx_change_listener () |
Auxiliary function that allows notification of ctx change listeners. More... | |
Private Member Functions | |
Session_consistency_gtids_ctx (const Session_consistency_gtids_ctx &rsc) | |
Session_consistency_gtids_ctx & | operator= (const Session_consistency_gtids_ctx &rsc) |
Private Attributes | |
Tsid_map * | m_tsid_map |
Gtid_set * | m_gtid_set |
Set holding the transaction identifiers of the gtids to reply back on the response packet. More... | |
Session_consistency_gtids_ctx::Ctx_change_listener * | m_listener |
If a listener is registered, e.g., the session track gtids, then this points to an instance of such listener. More... | |
ulong | m_curr_session_track_gtids |
Keeps track of the current session track gtids, so that we capture according to what was set before. More... | |
This class is an interface for session consistency instrumentation in the server.
It holds the context information for a given session.
It does not require locking since access to this content is mutually exclusive by design (only one thread reading or writing to this object at a time).
Session_consistency_gtids_ctx::Session_consistency_gtids_ctx | ( | ) |
Simple constructor.
|
virtual |
The destructor.
Deletes the m_gtid_set and the tsid_map.
|
private |
|
virtual |
This function SHALL be called once the GTID for the given transaction has has been added to GTID_EXECUTED.
This function SHALL store the data if the thd->variables.session_track_gtids is set to a value other than NONE.
thd | The thread context. |
|
virtual |
This function MUST be called after the response packet is set to the client connected.
The implementation may act on the collected state for instance to do garbage collection.
thd | The thread context. |
|
virtual |
This function MUST be called after a transaction is committed in the server.
It should be called regardless whether it is a RO or RW transaction. Also, DDLs, DDS are considered transaction for what is worth.
This function SHALL store relevant data for the session consistency.
thd | The thread context. |
|
inlinevirtual |
|
inlineprotected |
Auxiliary function that allows notification of ctx change listeners.
|
private |
void Session_consistency_gtids_ctx::register_ctx_change_listener | ( | Session_consistency_gtids_ctx::Ctx_change_listener * | listener, |
THD * | thd | ||
) |
Registers the listener.
The pointer MUST not be NULL.
listener | a pointer to the listener to register. |
thd | THD context associated to this listener. |
|
inlineprotected |
|
inline |
This member function MUST return a reference to the set of collected GTIDs so far.
void Session_consistency_gtids_ctx::unregister_ctx_change_listener | ( | Session_consistency_gtids_ctx::Ctx_change_listener * | listener | ) |
Unregisters the listener.
The listener MUST have registered previously.
listener | a pointer to the listener to register. |
void Session_consistency_gtids_ctx::update_tracking_activeness_from_session_variable | ( | const THD * | thd | ) |
Update session tracker (m_curr_session_track_gtids) from thd.
|
private |
Keeps track of the current session track gtids, so that we capture according to what was set before.
For instance, if the user does: SET @SESSION.SESSION_TRACK_GTIDS='ALL_GTIDS'; ... SET @SESSION.SESSION_TRACK_GTIDS='OWN_GTID';
The last statement should return a set of GTIDs.
|
private |
Set holding the transaction identifiers of the gtids to reply back on the response packet.
Lifecycle: Emptied after the reply is sent back to the application. Remains empty until:
|
private |
If a listener is registered, e.g., the session track gtids, then this points to an instance of such listener.
Since this context is valid only for one session, there is no need to protect this with locks.
|
private |