25#ifndef XA_TRANSACTION_CACHE_H_INCLUDED
26#define XA_TRANSACTION_CACHE_H_INCLUDED
223#ifdef HAVE_PSI_INTERFACE
Definition: transaction_info.h:54
Cached transaction context and its visibility through SQL XA RECOVER.
Definition: transaction_cache.h:185
Xa_recover_visibility m_xa_recover_visibility
Definition: transaction_cache.h:216
const transaction_ptr & transaction() const
Definition: transaction_cache.h:195
transaction_ptr m_transaction
Definition: transaction_cache.h:215
void mark_prepared_visible_for_xa_recover()
Mark visible through SQL XA RECOVER without changing SQL XA state.
Definition: transaction_cache.h:205
bool is_visible_to_xa_recover() const
Definition: transaction_cache.h:200
void mark_finalized_for_recover()
Mark finalized for SQL XA RECOVER while keeping the XID reserved.
Definition: transaction_cache.h:210
Cache_entry(transaction_ptr transaction, Xa_recover_visibility visibility)
Definition: transaction_cache.h:190
Class responsible for managing a cache of Transaction_ctx objects associated with XA transactions.
Definition: transaction_cache.h:60
Transaction_cache()
Class constructor.
Definition: transaction_cache.cc:83
static void mark_prepared_visible_for_xa_recover(Transaction_ctx *transaction)
Mark a transaction visible through SQL XA RECOVER without changing its SQL XA state.
Definition: transaction_cache.cc:131
PSI_mutex_key m_key_LOCK_transaction_cache
The PSI key for the above lock.
Definition: transaction_cache.h:225
Xa_recover_visibility
Definition: transaction_cache.h:182
std::shared_ptr< Transaction_ctx > transaction_ptr
Definition: transaction_cache.h:62
static void dispose()
Disposes of the transaction cache allocated resources.
Definition: transaction_cache.cc:227
static Transaction_cache & instance()
Initialize a cache to store Transaction_ctx and a mutex to protect access to the cache.
Definition: transaction_cache.cc:232
static bool detach(Transaction_ctx *transaction)
Transaction is marked in the cache as if it's recovered.
Definition: transaction_cache.cc:99
virtual ~Transaction_cache()=default
unordered_map m_transaction_cache
A map holding the cached transaction context, indexed by XID.
Definition: transaction_cache.h:232
static void remove(Transaction_ctx *transaction)
Remove information about transaction from a cache.
Definition: transaction_cache.cc:120
static bool insert(XID *xid, Transaction_ctx *transaction)
Inserts a transaction context identified by a given XID.
Definition: transaction_cache.cc:161
PSI_mutex_info m_transaction_cache_mutexes[1]
The PSI configuration of the above lock and key.
Definition: transaction_cache.h:227
std::function< bool(transaction_ptr const &)> filter_predicate_t
Definition: transaction_cache.h:63
static transaction_ptr find(XID *xid, filter_predicate_t filter=nullptr)
Searches the cache for the transaction context identified by the given XID.
Definition: transaction_cache.cc:199
static void initialize()
Initializes the transaction cache underlying resources.
Definition: transaction_cache.cc:225
Transaction_cache & operator=(Transaction_cache const &)=delete
static void mark_finalized_for_recover(Transaction_ctx *transaction)
Mark a transaction finalized for SQL XA RECOVER without releasing its XID reservation from the cache.
Definition: transaction_cache.cc:146
Transaction_cache(Transaction_cache &&)=delete
static std::vector< XID > get_xids_visible_to_xa_recover()
Retrieves XID snapshots visible through SQL XA RECOVER.
Definition: transaction_cache.cc:211
mysql_mutex_t m_LOCK_transaction_cache
A lock to serialize the access to m_transaction_cache
Definition: transaction_cache.h:222
Transaction_cache & operator=(Transaction_cache &&)=delete
Transaction_cache(Transaction_cache const &)=delete
static bool create_and_insert_new_transaction(XID *xid, bool is_binlogged_arg, const Transaction_ctx *src)
Creates a new transaction context for the transaction with the given XID and adds it to the cache.
Definition: transaction_cache.cc:237
#define PSI_DOCUMENT_ME
Definition: component_common.h:29
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: component_common.h:35
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
Some integer typedefs for easier portability.
Definition: gcs_xcom_synode.h:64
Definition: recovery.h:39
Mutex information.
Definition: psi_mutex_bits.h:73
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification,...
Definition: xa.h:83