24#ifndef CONSISTENCY_MANAGER_INCLUDED
25#define CONSISTENCY_MANAGER_INCLUDED
27#define CONSISTENCY_INFO_OUTCOME_OK 0
28#define CONSISTENCY_INFO_OUTCOME_ERROR 1
29#define CONSISTENCY_INFO_OUTCOME_COMMIT 2
64 void *
operator new(
size_t size,
const std::nothrow_t &)
noexcept {
81 void operator delete(
void *ptr,
const std::nothrow_t &)
noexcept {
94 void *
operator new(
size_t size)
noexcept {
108 void operator delete(
void *ptr)
noexcept {
my_free(ptr); }
128 Members_list *members_that_must_prepare_the_transaction);
233 const std::vector<Gcs_member_identifier> &leaving_members);
244 std::unique_ptr<Checkable_rwlock>
254typedef std::pair<Pipeline_event *, Transaction_consistency_manager_key>
258 std::less<Transaction_consistency_manager_key>,
345 const std::vector<Gcs_member_identifier> &leaving_members);
382 ulong gr_consistency_level, ulong
timeout,
535 std::list<my_thread_id, Malloc_allocator<my_thread_id>>
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:309
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
Group_member_status
Definition: member_info.h:169
Listener for transaction life cycle events.
Definition: group_transaction_observation_manager.h:33
enum_transaction_origin
Enum for transaction origins.
Definition: group_transaction_observation_manager.h:36
Class that contains the logic to hold transactions when group_replication_consistency is set to BEFOR...
Definition: hold_transactions.h:36
Malloc_allocator is a C++ STL memory allocator based on my_malloc/my_free.
Definition: malloc_allocator.h:63
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:128
The consistency information of a transaction, including its configuration and state.
Definition: consistency_manager.h:50
my_thread_id m_thread_id
Definition: consistency_manager.h:236
bool m_transaction_prepared_locally
Definition: consistency_manager.h:246
bool is_transaction_prepared_locally()
Is the transaction prepared locally?
Definition: consistency_manager.cc:87
const bool m_local_transaction
Definition: consistency_manager.h:237
const rpl_sidno m_sidno
Definition: consistency_manager.h:240
int handle_member_leave(const std::vector< Gcs_member_identifier > &leaving_members)
Call action after members leave the group.
Definition: consistency_manager.cc:220
Transaction_consistency_info(my_thread_id thread_id, bool local_transaction, const rpl_sid *sid, rpl_sidno sidno, rpl_gno gno, enum_group_replication_consistency_level consistency_level, Members_list *members_that_must_prepare_the_transaction)
Constructor.
Definition: consistency_manager.cc:33
const enum_group_replication_consistency_level m_consistency_level
Definition: consistency_manager.h:242
rpl_sid m_sid
Definition: consistency_manager.h:239
const bool m_sid_specified
Definition: consistency_manager.h:238
int handle_remote_prepare(const Gcs_member_identifier &gcs_member_id)
Call action after this transaction being prepared by other member.
Definition: consistency_manager.cc:181
const rpl_gno m_gno
Definition: consistency_manager.h:241
int after_applier_prepare(my_thread_id thread_id, Group_member_info::Group_member_status member_status)
Call action after this transaction being prepared on this member applier.
Definition: consistency_manager.cc:113
virtual ~Transaction_consistency_info()
Definition: consistency_manager.cc:75
std::unique_ptr< Checkable_rwlock > m_members_that_must_prepare_the_transaction_lock
Definition: consistency_manager.h:245
bool m_transaction_prepared_remotely
Definition: consistency_manager.h:247
enum_group_replication_consistency_level get_consistency_level()
Get the transaction consistency.
Definition: consistency_manager.cc:96
bool is_the_transaction_prepared_remotely()
Did all other ONLINE members already prepared the transaction?
Definition: consistency_manager.cc:106
rpl_gno get_gno()
Get the transaction gno.
Definition: consistency_manager.cc:93
my_thread_id get_thread_id()
Get the thread id that is executing the transaction.
Definition: consistency_manager.cc:79
rpl_sidno get_sidno()
Get the transaction sidno.
Definition: consistency_manager.cc:91
bool is_a_single_member_group()
Is this transaction running on a single member group?
Definition: consistency_manager.cc:100
bool is_local_transaction()
Is the transaction from this server?
Definition: consistency_manager.cc:83
Members_list * m_members_that_must_prepare_the_transaction
Definition: consistency_manager.h:243
The consistency information of all ongoing transactions which have consistency GROUP_REPLICATION_CONS...
Definition: consistency_manager.h:271
Hold_transactions m_hold_transactions
Hold transaction mechanism.
Definition: consistency_manager.h:546
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.
Definition: consistency_manager.cc:370
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 wit...
Definition: consistency_manager.cc:764
Checkable_rwlock * m_prepared_transactions_on_my_applier_lock
Definition: consistency_manager.h:530
bool has_local_prepared_transactions()
Are there local prepared transactions waiting for prepare acknowledge from other members?
Definition: consistency_manager.cc:823
Transaction_consistency_manager_map m_map
Definition: consistency_manager.h:528
void disable_primary_election_checks()
Tells the consistency manager that a primary election ended so it shall disable primary election chec...
Definition: consistency_manager.cc:923
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 transac...
Definition: consistency_manager.cc:745
int handle_member_leave(const std::vector< Gcs_member_identifier > &leaving_members)
Call action after members leave the group.
Definition: consistency_manager.cc:575
void register_transaction_observer()
Register an observer for transactions.
Definition: consistency_manager.cc:910
int remove_prepared_transaction(Transaction_consistency_manager_key key)
Help method that cleans prepared transactions and releases transactions waiting on them.
Definition: consistency_manager.cc:857
~Transaction_consistency_manager() override
Definition: consistency_manager.cc:274
void plugin_is_stopping()
Inform that plugin is stopping.
Definition: consistency_manager.cc:906
std::list< Transaction_consistency_manager_pevent_pair, Malloc_allocator< Transaction_consistency_manager_pevent_pair > > m_delayed_view_change_events
Definition: consistency_manager.h:539
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_REPLICAT...
Definition: consistency_manager.cc:674
std::list< my_thread_id, Malloc_allocator< my_thread_id > > m_new_transactions_waiting
Definition: consistency_manager.h:536
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.
Definition: consistency_manager.cc:460
std::list< Transaction_consistency_manager_key, Malloc_allocator< Transaction_consistency_manager_key > > m_prepared_transactions_on_my_applier
Definition: consistency_manager.h:534
Transaction_consistency_manager_key m_last_local_transaction
Definition: consistency_manager.h:540
void unregister_transaction_observer()
Unregister the observer for transactions.
Definition: consistency_manager.cc:914
int after_rollback(my_thread_id thread_id) override
Executed after rollback.
Definition: consistency_manager.cc:942
int before_transaction_begin(my_thread_id thread_id, ulong gr_consistency_level, ulong timeout, enum_rpl_channel_type rpl_channel_type) override
Call action before a transaction starts.
Definition: consistency_manager.cc:620
void clear()
Clear all information.
Definition: consistency_manager.cc:283
int after_certification(Transaction_consistency_info *transaction_info)
Call action after a transaction is certified.
Definition: consistency_manager.cc:307
int before_rollback(my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override
Executed before rollback.
Definition: consistency_manager.cc:937
std::atomic< bool > m_plugin_stopping
Definition: consistency_manager.h:542
int after_commit(my_thread_id thread_id, rpl_sidno sidno, rpl_gno gno) override
Call action after commit a transaction on this member.
Definition: consistency_manager.cc:601
Checkable_rwlock * m_map_lock
Definition: consistency_manager.h:527
std::atomic< bool > m_primary_election_active
Definition: consistency_manager.h:543
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 comp...
Definition: consistency_manager.cc:844
Transaction_consistency_manager()
Constructor.
Definition: consistency_manager.cc:246
void enable_primary_election_checks()
Tells the consistency manager that a primary election is running so it shall enable primary election ...
Definition: consistency_manager.cc:918
int before_commit(my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override
Executed before commit.
Definition: consistency_manager.cc:932
void plugin_started()
Inform that plugin did start.
Definition: consistency_manager.cc:902
std::pair< Transaction_consistency_manager_key, Transaction_consistency_info * > Transaction_consistency_manager_pair
Definition: consistency_manager.h:253
std::map< Transaction_consistency_manager_key, Transaction_consistency_info *, std::less< Transaction_consistency_manager_key >, Malloc_allocator< std::pair< const Transaction_consistency_manager_key, Transaction_consistency_info * > > > Transaction_consistency_manager_map
Definition: consistency_manager.h:261
std::pair< Pipeline_event *, Transaction_consistency_manager_key > Transaction_consistency_manager_pevent_pair
Definition: consistency_manager.h:255
std::pair< rpl_sidno, rpl_gno > Transaction_consistency_manager_key
Definition: consistency_manager.h:250
#define MY_WME
Definition: my_sys.h:123
#define MYF(v)
Definition: my_inttypes.h:97
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
static my_thread_id thread_id
Definition: my_thr_init.cc:63
uint32 my_thread_id
Definition: my_thread_local.h:34
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:496
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2879
std::list< Gcs_member_identifier, Malloc_allocator< Gcs_member_identifier > > Members_list
Definition: pipeline_interfaces.h:40
API for Group Replication plugin.
enum_group_replication_consistency_level
Definition: plugin_group_replication.h:35
PSI_memory_key key_consistent_transactions
Definition: plugin_psi.h:245
required string key
Definition: replication_asynchronous_connection_failover.proto:60
enum_rpl_channel_type
Type of replication channel thread/transaction might be associated to.
Definition: rpl_context.h:49
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:96
binary_log::gtids::gno_t rpl_gno
GNO, the second (numeric) component of a GTID, is an alias of binary_log::gtids::gno_t.
Definition: rpl_gtid.h:103
This is a POD.
Definition: uuid.h:61