25#ifndef XA_TRANSACTION_CACHE_H_INCLUDED
26#define XA_TRANSACTION_CACHE_H_INCLUDED
59 using list = std::vector<transaction_ptr>;
154#ifdef HAVE_PSI_INTERFACE
Definition: transaction_info.h:55
Class responsible for managing a cache of Transaction_ctx objects associated with XA transactions.
Definition: transaction_cache.h:55
Transaction_cache()
Class constructor.
Definition: transaction_cache.cc:83
static list get_cached_transactions()
Retrieves the list of transaction contexts cached.
Definition: transaction_cache.cc:171
PSI_mutex_key m_key_LOCK_transaction_cache
The PSI key for the above lock.
Definition: transaction_cache.h:156
std::shared_ptr< Transaction_ctx > transaction_ptr
Definition: transaction_cache.h:57
static void dispose()
Disposes of the transaction cache allocated resources.
Definition: transaction_cache.cc:181
static Transaction_cache & instance()
Initialize a cache to store Transaction_ctx and a mutex to protect access to the cache.
Definition: transaction_cache.cc:186
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:163
static void remove(Transaction_ctx *transaction)
Remove information about transaction from a cache.
Definition: transaction_cache.cc:118
std::vector< transaction_ptr > list
Definition: transaction_cache.h:59
static bool insert(XID *xid, Transaction_ctx *transaction)
Inserts a transaction context identified by a given XID.
Definition: transaction_cache.cc:128
PSI_mutex_info m_transaction_cache_mutexes[1]
The PSI configuration of the above lock and key.
Definition: transaction_cache.h:158
std::function< bool(transaction_ptr const &)> filter_predicate_t
Definition: transaction_cache.h:60
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:160
static void initialize()
Initializes the transaction cache underlying resources.
Definition: transaction_cache.cc:179
Transaction_cache & operator=(Transaction_cache const &)=delete
Transaction_cache(Transaction_cache &&)=delete
mysql_mutex_t m_LOCK_transaction_cache
A lock to serialize the access to m_transaction_cache
Definition: transaction_cache.h:153
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:191
#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: 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