MySQL 8.0.39
Source Code Documentation
|
Class to maintain list of externally coordinated transactions and their current state at recovery. More...
#include <handler.h>
Public Types | |
using | pair = std::pair< const XID, enum_ha_recover_xa_state > |
using | allocator = Mem_root_allocator< Xa_state_list::pair > |
using | list = std::map< XID, enum_ha_recover_xa_state, std::less< XID >, Xa_state_list::allocator > |
using | iterator = std::map< XID, enum_ha_recover_xa_state, std::less< XID >, Xa_state_list::allocator >::iterator |
using | instantiation_tuple = std::tuple< std::unique_ptr< MEM_ROOT >, std::unique_ptr< Xa_state_list::allocator >, std::unique_ptr< Xa_state_list::list >, std::unique_ptr< Xa_state_list > > |
Public Member Functions | |
Xa_state_list (Xa_state_list::list &populated_by_tc) | |
Class constructor. More... | |
virtual | ~Xa_state_list ()=default |
enum_ha_recover_xa_state | find (XID const &to_find) |
Searches the underlying map to find an key that corresponds to the parameter. More... | |
enum_ha_recover_xa_state | add (XID const &xid, enum_ha_recover_xa_state state) |
Adds a transaction and state to the underlying map. More... | |
Static Public Member Functions | |
static Xa_state_list::instantiation_tuple | new_instance () |
Factory like method to instantiate all the infra-structure needed to create an Xa_state_list . More... | |
Private Attributes | |
Xa_state_list::list & | m_underlying |
The underlying map holding the trx and states. More... | |
Class to maintain list of externally coordinated transactions and their current state at recovery.
using Xa_state_list::instantiation_tuple = std::tuple< std::unique_ptr<MEM_ROOT>, std::unique_ptr<Xa_state_list::allocator>, std::unique_ptr<Xa_state_list::list>, std::unique_ptr<Xa_state_list> > |
using Xa_state_list::iterator = std::map<XID, enum_ha_recover_xa_state, std::less<XID>, Xa_state_list::allocator>::iterator |
using Xa_state_list::list = std::map<XID, enum_ha_recover_xa_state, std::less<XID>, Xa_state_list::allocator> |
using Xa_state_list::pair = std::pair<const XID, enum_ha_recover_xa_state> |
Xa_state_list::Xa_state_list | ( | Xa_state_list::list & | populated_by_tc | ) |
Class constructor.
populated_by_tc | The underlying list of XIDs and transaction states, after being populated by the transaction coodinator. |
|
virtualdefault |
enum_ha_recover_xa_state Xa_state_list::add | ( | XID const & | xid, |
enum_ha_recover_xa_state | state | ||
) |
Adds a transaction and state to the underlying map.
If the given XID already exists in the underlying map, the associated state changes according to the following rules:
PREPARED_IN_SE
it means that the transaction didn't reach PREPARED_IN_TC, COMMIT or ROLLBACK for sure. In that case: . If other participants state is COMMITTED
/ROLLEDBACK
, it would mean that it's a state inherited from a previous execution with the same XID and we should set the state to PREPARED_IN_SE
. . If other participants state is PREPARED_IN_TC
/ COMMITTED_WITH_ONEPHASE
it means that the current participant didn't reach it but some other did so, keep the state as PREPARED_IN_TC
/COMMITTED_WITH_ONEPHASE
.PREPARED_IN_TC
, it means that other participants must have persisted either the PREPARE, the COMMIT or the ROLLBACK. In that case, keep whatever state is already there and ensure that is not PREPARED_IN_SE
.COMMITTED_WITH_ONEPHASE
, COMMITTED
or ROLLEDBACK
, do nothing, only the active transaction coordinator has the ability, for now, to set the transaction state to those values.xid | The XID to be added (the key). |
xid | The state to be added (the value). |
enum_ha_recover_xa_state Xa_state_list::find | ( | XID const & | to_find | ) |
Searches the underlying map to find an key that corresponds to the parameter.
to_find | The XID to find within the underlying map. |
|
static |
Factory like method to instantiate all the infra-structure needed to create an Xa_state_list
.
Since such infra-structuer is dependent on MEM_ROOT
and Mem_root_allocator
, the method returns a tuple containing unique pointers to all 4 objects needed: MEM_ROOT; Mem_root_allocator; Xa_state_list::list; Xa_state_list.
|
private |
The underlying map holding the trx and states.