MySQL 8.4.2
Source Code Documentation
|
Coordinates all operations to GCS interface. More...
#include <gcs_operations.h>
Public Types | |
enum | enum_leave_state { NOW_LEAVING , ALREADY_LEAVING , ALREADY_LEFT , ERROR_WHEN_LEAVING } |
This enumeration describes the return values when a process tries to leave a group. More... | |
enum | enum_force_members_state { FORCE_MEMBERS_OK , FORCE_MEMBERS_ER_MEMBER_NOT_ONLINE , FORCE_MEMBERS_ER_NOT_ONLINE_AND_MAJORITY_UNREACHABLE , FORCE_MEMBERS_ER_MEMBERS_WHEN_LEAVING , FORCE_MEMBERS_ER_TIMEOUT_ON_WAIT_FOR_VIEW , FORCE_MEMBERS_ER_VALUE_SET_ERROR , FORCE_MEMBERS_ER_INTERNAL_ERROR } |
This enumeration describes the return value when forces a new group membership. More... | |
Public Member Functions | |
Gcs_operations () | |
Default constructor. More... | |
virtual | ~Gcs_operations () |
Destructor. More... | |
int | initialize () |
Initialize the GCS interface. More... | |
void | finalize () |
Finalize the GCS interface. More... | |
Gcs_view * | get_current_view () |
Get the group current view. More... | |
enum enum_gcs_error | configure (const Gcs_interface_parameters ¶meters) |
Configure the GCS interface. More... | |
enum enum_gcs_error | reconfigure (const Gcs_interface_parameters ¶meters) |
Reconfigure the GCS interface, i.e. More... | |
enum enum_gcs_error | set_debug_options (std::string &debug_options) const |
Configure the debug options that shall be used by GCS. More... | |
enum enum_gcs_error | join (const Gcs_communication_event_listener &communication_event_listener, const Gcs_control_event_listener &control_event_listener, Plugin_gcs_view_modification_notifier *view_notifier) |
Request server to join the group. More... | |
bool | belongs_to_group () |
Returns true if this server belongs to the group. More... | |
enum_leave_state | leave (Plugin_gcs_view_modification_notifier *view_notifier) |
Request GCS interface to leave the group. More... | |
void | notify_of_view_change_end () |
Notify all listeners that a view changed. More... | |
void | notify_of_view_change_cancellation (int errnr=GROUP_REPLICATION_CONFIGURATION_ERROR) |
Notify all listeners that a view was canceled. More... | |
bool | is_injected_view_modification () |
Checks if the view modification is a injected one. More... | |
void | remove_view_notifer (Plugin_gcs_view_modification_notifier *view_notifier) |
Removes the notifier from the list. More... | |
void | leave_coordination_member_left () |
Declare the member as being already out of the group. More... | |
int | get_local_member_identifier (std::string &identifier) |
Get the local member identifier. More... | |
enum enum_gcs_error | send_message (const Plugin_gcs_message &message, bool skip_if_not_initialized=false, const THD *thd=nullptr) |
Send a message to the group. More... | |
enum enum_gcs_error | send_transaction_message (Transaction_message_interface &message) |
Send a transaction message to the group. More... | |
enum enum_force_members_state | force_members (const char *members, Plugin_gcs_view_modification_notifier *view_notifier) |
Forces a new group membership, on which the excluded members will not receive a new view and will be blocked. More... | |
uint32_t | get_minimum_write_concurrency () const |
Retrieves the minimum supported "write concurrency" value. More... | |
uint32_t | get_maximum_write_concurrency () const |
Retrieves the maximum supported "write concurrency" value. More... | |
enum enum_gcs_error | get_write_concurrency (uint32_t &write_concurrency) |
Retrieves the group's "write concurrency" value. More... | |
enum enum_gcs_error | set_write_concurrency (uint32_t new_write_concurrency) |
Reconfigures the group's "write concurrency" value. More... | |
enum enum_gcs_error | set_leader (Gcs_member_identifier const &leader) |
Reconfigures the group's "consensus leaders.". More... | |
enum enum_gcs_error | set_everyone_leader () |
Reconfigures the group's "consensus leaders.". More... | |
enum enum_gcs_error | get_leaders (std::vector< Gcs_member_identifier > &preferred_leaders, std::vector< Gcs_member_identifier > &actual_leaders) |
Inspect the group's "consensus leader" configuration. More... | |
Gcs_protocol_version | get_protocol_version () |
Retrieves the group's "group communication protocol" value. More... | |
std::pair< bool, std::future< void > > | set_protocol_version (Gcs_protocol_version gcs_protocol) |
Modifies the GCS protocol version in use. More... | |
Gcs_protocol_version | get_maximum_protocol_version () |
Get the maximum protocol version currently supported by the group. More... | |
enum enum_gcs_error | set_xcom_cache_size (uint64_t new_size) |
Requests GCS to change the maximum size of the XCom cache. More... | |
enum_transport_protocol | get_current_incoming_connections_protocol () |
Get the current incoming connections protocol stack configured in GCS. More... | |
Gcs_mysql_network_provider * | get_mysql_network_provider () |
Get the mysql network provider owned by GCS operations. More... | |
bool | is_initialized () |
Returns a flag indicating whether or not the component is initialized. More... | |
uint64_t | get_all_consensus_proposals_count () |
uint64_t | get_empty_consensus_proposals_count () |
uint64_t | get_consensus_bytes_sent_sum () |
uint64_t | get_consensus_bytes_received_sum () |
uint64_t | get_all_consensus_time_sum () |
uint64_t | get_extended_consensus_count () |
uint64_t | get_total_messages_sent_count () |
uint64_t | get_last_consensus_end_timestamp () |
void | get_suspicious_count (std::list< Gcs_node_suspicious > &node_suspicious) |
Static Public Member Functions | |
static const std::string & | get_gcs_engine () |
Private Member Functions | |
enum enum_gcs_error | do_set_debug_options (std::string &debug_options) const |
Internal function that configures the debug options that shall be used by GCS. More... | |
Gcs_group_management_interface * | get_gcs_group_manager () const |
Gcs_communication_interface * | get_gcs_communication () const |
Gcs_statistics_interface * | get_statistics_interface () |
Helper method that retrieves the binding implementation of the Statistics interface. More... | |
void | metrics_cache_reset () |
Reset the metrics cache. More... | |
void | metrics_cache_update () |
Update the metrics cache with the current GCS values. More... | |
Static Private Attributes | |
static const std::string | gcs_engine = "xcom" |
Coordinates all operations to GCS interface.
This enumeration describes the return value when forces a new group membership.
Gcs_operations::Gcs_operations | ( | ) |
Default constructor.
|
virtual |
Destructor.
bool Gcs_operations::belongs_to_group | ( | ) |
Returns true if this server belongs to the group.
enum enum_gcs_error Gcs_operations::configure | ( | const Gcs_interface_parameters & | parameters | ) |
Configure the GCS interface.
[in] | parameters | The configuration parameters |
0 | OK |
!=0 | Error |
|
private |
Internal function that configures the debug options that shall be used by GCS.
void Gcs_operations::finalize | ( | ) |
Finalize the GCS interface.
Gcs_operations::enum_force_members_state Gcs_operations::force_members | ( | const char * | members, |
Plugin_gcs_view_modification_notifier * | view_notifier | ||
) |
Forces a new group membership, on which the excluded members will not receive a new view and will be blocked.
members | The list of members, comma separated. E.g., host1:port1,host2:port2 |
view_notifier | A view change notifier to know the response |
FORCE_MEMBERS_OK | The forced new group membership is successful. |
FORCE_MEMBERS_ER_MEMBER_NOT_ONLINE | An error as member is not ONLINE, when forcing a new group membership. |
FORCE_MEMBERS_NOT_ONLINE_AND_MAJORITY_UNREACHABLE | An error as member is not ONLINE and majority of the members are unreachable. |
FORCE_MEMBERS_ER_MEMBERS_WHEN_LEAVING | An error as member leaving group, when forcing new group membership. |
FORCE_MEMBERS_ER_TIMEOUT_ON_WAIT_FOR_VIEW | A timeout happened when waiting for view after setting group_replication_force_members. |
FORCE_MEMBERS_VALUE_SET_ERROR | Error setting group_replication_force_members value. |
FORCE_MEMBERS_INTERNAL_ERROR | Internal error. |
uint64_t Gcs_operations::get_all_consensus_proposals_count | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
uint64_t Gcs_operations::get_all_consensus_time_sum | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
uint64_t Gcs_operations::get_consensus_bytes_received_sum | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
uint64_t Gcs_operations::get_consensus_bytes_sent_sum | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
enum_transport_protocol Gcs_operations::get_current_incoming_connections_protocol | ( | ) |
Get the current incoming connections protocol stack configured in GCS.
Gcs_view * Gcs_operations::get_current_view | ( | ) |
Get the group current view.
uint64_t Gcs_operations::get_empty_consensus_proposals_count | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
uint64_t Gcs_operations::get_extended_consensus_count | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
|
private |
|
static |
|
private |
uint64_t Gcs_operations::get_last_consensus_end_timestamp | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
enum enum_gcs_error Gcs_operations::get_leaders | ( | std::vector< Gcs_member_identifier > & | preferred_leaders, |
std::vector< Gcs_member_identifier > & | actual_leaders | ||
) |
Inspect the group's "consensus leader" configuration.
[out] | preferred_leaders | The members specified as preferred leaders. |
[out] | actual_leaders | The members actually carrying out the leader role at this moment. |
GCS_OK | if successful, preferred_leaders and actual_leaders contain the result |
GCS_NOK | if unsuccessful |
int Gcs_operations::get_local_member_identifier | ( | std::string & | identifier | ) |
Get the local member identifier.
[out] | identifier | The local member identifier when the method is successful |
0 | OK |
!=0 | Error |
Gcs_protocol_version Gcs_operations::get_maximum_protocol_version | ( | ) |
Get the maximum protocol version currently supported by the group.
uint32_t Gcs_operations::get_maximum_write_concurrency | ( | ) | const |
Retrieves the maximum supported "write concurrency" value.
uint32_t Gcs_operations::get_minimum_write_concurrency | ( | ) | const |
Retrieves the minimum supported "write concurrency" value.
Gcs_mysql_network_provider * Gcs_operations::get_mysql_network_provider | ( | ) |
Get the mysql network provider owned by GCS operations.
Gcs_protocol_version Gcs_operations::get_protocol_version | ( | ) |
Retrieves the group's "group communication protocol" value.
the | protocol version |
|
private |
Helper method that retrieves the binding implementation of the Statistics interface.
void Gcs_operations::get_suspicious_count | ( | std::list< Gcs_node_suspicious > & | node_suspicious | ) |
uint64_t Gcs_operations::get_total_messages_sent_count | ( | ) |
This method will try to acquire a read lock so that a recent value is returned. If the lock acquire is not possible, case on which there is a exclusive operation ongoing, a cached value is returned.
enum enum_gcs_error Gcs_operations::get_write_concurrency | ( | uint32_t & | write_concurrency | ) |
Retrieves the group's "write concurrency" value.
[out] | write_concurrency | A reference to where the group's "write concurrency" will be written to |
GCS_OK | if successful |
GCS_NOK | if unsuccessful |
int Gcs_operations::initialize | ( | ) |
Initialize the GCS interface.
0 | OK |
!=0 | Error |
bool Gcs_operations::is_initialized | ( | ) |
Returns a flag indicating whether or not the component is initialized.
true | if the component is initialized. |
false | otherwise. |
bool Gcs_operations::is_injected_view_modification | ( | ) |
Checks if the view modification is a injected one.
true | if the current view modification is a injected one |
false | otherwise |
enum enum_gcs_error Gcs_operations::join | ( | const Gcs_communication_event_listener & | communication_event_listener, |
const Gcs_control_event_listener & | control_event_listener, | ||
Plugin_gcs_view_modification_notifier * | view_notifier | ||
) |
Request server to join the group.
[in] | communication_event_listener | The communication event listener |
[in] | control_event_listener | The control event listener |
[in] | view_notifier | A view change notifier to know the response |
0 | OK |
!=0 | Error |
Gcs_operations::enum_leave_state Gcs_operations::leave | ( | Plugin_gcs_view_modification_notifier * | view_notifier | ) |
Request GCS interface to leave the group.
[in] | view_notifier | A view change notifier to know the response. Pass a null pointer if you don't want to wait |
Note: This method only asks to leave, it does not know if request was successful
NOW_LEAVING | Request accepted, the member is leaving |
ALREADY_LEAVING | The member is already leaving |
ALREADY_LEFT | The member already left |
ERROR_WHEN_LEAVING | An error happened when trying to leave |
void Gcs_operations::leave_coordination_member_left | ( | ) |
Declare the member as being already out of the group.
|
private |
Reset the metrics cache.
|
private |
Update the metrics cache with the current GCS values.
void Gcs_operations::notify_of_view_change_cancellation | ( | int | errnr = GROUP_REPLICATION_CONFIGURATION_ERROR | ) |
Notify all listeners that a view was canceled.
[in] | errnr | The error associated to this view |
void Gcs_operations::notify_of_view_change_end | ( | ) |
Notify all listeners that a view changed.
enum enum_gcs_error Gcs_operations::reconfigure | ( | const Gcs_interface_parameters & | parameters | ) |
Reconfigure the GCS interface, i.e.
update its configuration parameters.
[in] | parameters | The configuration parameters |
0 | OK |
!=0 | Error |
void Gcs_operations::remove_view_notifer | ( | Plugin_gcs_view_modification_notifier * | view_notifier | ) |
Removes the notifier from the list.
enum enum_gcs_error Gcs_operations::send_message | ( | const Plugin_gcs_message & | message, |
bool | skip_if_not_initialized = false , |
||
const THD * | thd = nullptr |
||
) |
Send a message to the group.
[in] | message | The message to send |
[in] | skip_if_not_initialized | If true, the message will not be sent and no errors will returned when the GCS interface is not initialized |
[in] | thd | Server thd represent client connection |
0 | OK |
!=0 | Error |
enum enum_gcs_error Gcs_operations::send_transaction_message | ( | Transaction_message_interface & | message | ) |
Send a transaction message to the group.
[in] | message | The message to send |
0 | OK |
!=0 | Error |
enum enum_gcs_error Gcs_operations::set_debug_options | ( | std::string & | debug_options | ) | const |
Configure the debug options that shall be used by GCS.
debug_options | Set of debug options separated by comma |
0 | OK |
!=0 | Error |
enum enum_gcs_error Gcs_operations::set_everyone_leader | ( | ) |
Reconfigures the group's "consensus leaders.".
Instructs the underlying GCS to use every member as a consensus leader.
The method is non-blocking, meaning that it shall only send the request to an underlying GCS. The final result can be polled via get_leaders
.
GCS_OK | if successful |
GCS_NOK | if unsuccessful |
enum enum_gcs_error Gcs_operations::set_leader | ( | Gcs_member_identifier const & | leader | ) |
Reconfigures the group's "consensus leaders.".
Instructs the underlying GCS to use leader
as the single preferred consensus leader.
The method is non-blocking, meaning that it shall only send the request to an underlying GCS. The final result can be polled via get_leaders
.
leader | The member you desire to act as a consensus leader. |
GCS_OK | if successful |
GCS_NOK | if unsuccessful |
std::pair< bool, std::future< void > > Gcs_operations::set_protocol_version | ( | Gcs_protocol_version | gcs_protocol | ) |
Modifies the GCS protocol version in use.
The method is non-blocking. It returns a future on which the caller can wait for the action to finish.
gcs_protocol | The desired GCS protocol version |
{true,future} | If successful |
{false,_} | If unsuccessful because new_version is unsupported |
enum enum_gcs_error Gcs_operations::set_write_concurrency | ( | uint32_t | new_write_concurrency | ) |
Reconfigures the group's "write concurrency" value.
The caller should ensure that the supplied value is between minimum_write_concurrency
and maximum_write_concurrency
.
The method is non-blocking, meaning that it shall only send the request to an underlying GCS. The final result can be polled via get_write_concurrency
.
new_write_concurrency | The desired "write concurrency" value. |
GCS_OK | if successful |
GCS_NOK | if unsuccessful |
enum enum_gcs_error Gcs_operations::set_xcom_cache_size | ( | uint64_t | new_size | ) |
Requests GCS to change the maximum size of the XCom cache.
new_size | The new maximum size of the XCom cache. |
GCS_OK | if request successfully scheduled |
GCS_NOK | if GCS is unable to schedule the request |
|
private |
External IoC dependencies for gcs_mysql_net_provider.
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
Was this view change injected.
|
private |
Is the member leaving.
|
private |
Did the member already left.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
List of associated view change notifiers waiting.
|
private |
Lock for the list of waiters on a view change.