MySQL 8.0.40
Source Code Documentation
Gcs_operations Class Reference

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_viewget_current_view ()
 Get the group current view. More...
 
enum enum_gcs_error configure (const Gcs_interface_parameters &parameters)
 Configure the GCS interface. More...
 
enum enum_gcs_error reconfigure (const Gcs_interface_parameters &parameters)
 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)
 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)
 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_providerget_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...
 

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_interfaceget_gcs_group_manager () const
 
Gcs_communication_interfaceget_gcs_communication () const
 

Private Attributes

Gcs_gr_logger_impl gcs_logger
 
Gcs_mysql_network_provider_auth_interface_impl auth_provider
 External IoC dependencies for gcs_mysql_net_provider. More...
 
Gcs_mysql_network_provider_native_interface_impl native_interface
 
std::shared_ptr< Gcs_mysql_network_providergcs_mysql_net_provider
 
Gcs_interfacegcs_interface
 
bool injected_view_modification
 Was this view change injected. More...
 
std::atomic< bool > leave_coordination_leaving
 Is the member leaving. More...
 
std::atomic< bool > leave_coordination_left
 Did the member already left. More...
 
std::list< Plugin_gcs_view_modification_notifier * > view_change_notifier_list
 List of associated view change notifiers waiting. More...
 
Checkable_rwlockgcs_operations_lock
 
Checkable_rwlockview_observers_lock
 Lock for the list of waiters on a view change. More...
 

Static Private Attributes

static const std::string gcs_engine = "xcom"
 

Detailed Description

Coordinates all operations to GCS interface.

Member Enumeration Documentation

◆ enum_force_members_state

This enumeration describes the return value when forces a new group membership.

Enumerator
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 

◆ enum_leave_state

This enumeration describes the return values when a process tries to leave a group.

Enumerator
NOW_LEAVING 
ALREADY_LEAVING 
ALREADY_LEFT 
ERROR_WHEN_LEAVING 

Constructor & Destructor Documentation

◆ Gcs_operations()

Gcs_operations::Gcs_operations ( )

Default constructor.

◆ ~Gcs_operations()

Gcs_operations::~Gcs_operations ( )
virtual

Destructor.

Member Function Documentation

◆ belongs_to_group()

bool Gcs_operations::belongs_to_group ( )

Returns true if this server belongs to the group.

◆ configure()

enum enum_gcs_error Gcs_operations::configure ( const Gcs_interface_parameters parameters)

Configure the GCS interface.

Parameters
[in]parametersThe configuration parameters
Returns
the operation status
Return values
0OK
!=0Error

◆ do_set_debug_options()

enum enum_gcs_error Gcs_operations::do_set_debug_options ( std::string &  debug_options) const
private

Internal function that configures the debug options that shall be used by GCS.

◆ finalize()

void Gcs_operations::finalize ( )

Finalize the GCS interface.

◆ force_members()

Gcs_operations::enum_force_members_state Gcs_operations::force_members ( const char *  members)

Forces a new group membership, on which the excluded members will not receive a new view and will be blocked.

Parameters
membersThe list of members, comma separated. E.g., host1:port1,host2:port2
Returns
Operation status
Return values
FORCE_MEMBERS_OKThe forced new group membership is successful.
FORCE_MEMBERS_ER_MEMBER_NOT_ONLINEAn error as member is not ONLINE, when forcing a new group membership.
FORCE_MEMBERS_NOT_ONLINE_AND_MAJORITY_UNREACHABLEAn error as member is not ONLINE and majority of the members are unreachable.
FORCE_MEMBERS_ER_MEMBERS_WHEN_LEAVINGAn error as member leaving group, when forcing new group membership.
FORCE_MEMBERS_ER_TIMEOUT_ON_WAIT_FOR_VIEWA timeout happened when waiting for view after setting group_replication_force_members.
FORCE_MEMBERS_VALUE_SET_ERRORError setting group_replication_force_members value.
FORCE_MEMBERS_INTERNAL_ERRORInternal error.

◆ get_current_incoming_connections_protocol()

enum_transport_protocol Gcs_operations::get_current_incoming_connections_protocol ( )

Get the current incoming connections protocol stack configured in GCS.

Returns
GcsRunningProtocol

◆ get_current_view()

Gcs_view * Gcs_operations::get_current_view ( )

Get the group current view.

Returns
a copy of the group current view. NULL if member does not belong to a group.. The return value must deallocated by the caller.

◆ get_gcs_communication()

Gcs_communication_interface * Gcs_operations::get_gcs_communication ( ) const
private

◆ get_gcs_engine()

const std::string & Gcs_operations::get_gcs_engine ( )
static
Returns
the communication engine being used

◆ get_gcs_group_manager()

Gcs_group_management_interface * Gcs_operations::get_gcs_group_manager ( ) const
private

◆ get_leaders()

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.

Parameters
[out]preferred_leadersThe members specified as preferred leaders.
[out]actual_leadersThe members actually carrying out the leader role at this moment.
Return values
GCS_OKif successful, preferred_leaders and actual_leaders contain the result
GCS_NOKif unsuccessful

◆ get_local_member_identifier()

int Gcs_operations::get_local_member_identifier ( std::string &  identifier)

Get the local member identifier.

Parameters
[out]identifierThe local member identifier when the method is successful
Returns
Operation status
Return values
0OK
!=0Error

◆ get_maximum_protocol_version()

Gcs_protocol_version Gcs_operations::get_maximum_protocol_version ( )

Get the maximum protocol version currently supported by the group.

Returns
the maximum protocol version currently supported by the group

◆ get_maximum_write_concurrency()

uint32_t Gcs_operations::get_maximum_write_concurrency ( ) const

Retrieves the maximum supported "write concurrency" value.

◆ get_minimum_write_concurrency()

uint32_t Gcs_operations::get_minimum_write_concurrency ( ) const

Retrieves the minimum supported "write concurrency" value.

◆ get_mysql_network_provider()

Gcs_mysql_network_provider * Gcs_operations::get_mysql_network_provider ( )

Get the mysql network provider owned by GCS operations.

Returns
a Network_provider if initialized and running. nullptr, otherwise.

◆ get_protocol_version()

Gcs_protocol_version Gcs_operations::get_protocol_version ( )

Retrieves the group's "group communication protocol" value.

Return values
theprotocol version

◆ get_write_concurrency()

enum enum_gcs_error Gcs_operations::get_write_concurrency ( uint32_t &  write_concurrency)

Retrieves the group's "write concurrency" value.

Parameters
[out]write_concurrencyA reference to where the group's "write concurrency" will be written to
Return values
GCS_OKif successful
GCS_NOKif unsuccessful

◆ initialize()

int Gcs_operations::initialize ( )

Initialize the GCS interface.

Returns
the operation status
Return values
0OK
!=0Error

◆ is_initialized()

bool Gcs_operations::is_initialized ( )

Returns a flag indicating whether or not the component is initialized.

Return values
trueif the component is initialized.
falseotherwise.

◆ is_injected_view_modification()

bool Gcs_operations::is_injected_view_modification ( )

Checks if the view modification is a injected one.

Return values
trueif the current view modification is a injected one
falseotherwise

◆ join()

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.

Parameters
[in]communication_event_listenerThe communication event listener
[in]control_event_listenerThe control event listener
[in]view_notifierA view change notifier to know the response
Returns
the operation status
Return values
0OK
!=0Error

◆ leave()

Gcs_operations::enum_leave_state Gcs_operations::leave ( Plugin_gcs_view_modification_notifier view_notifier)

Request GCS interface to leave the group.

Parameters
[in]view_notifierA 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

Returns
the operation status
Return values
NOW_LEAVINGRequest accepted, the member is leaving
ALREADY_LEAVINGThe member is already leaving
ALREADY_LEFTThe member already left
ERROR_WHEN_LEAVINGAn error happened when trying to leave

◆ leave_coordination_member_left()

void Gcs_operations::leave_coordination_member_left ( )

Declare the member as being already out of the group.

◆ notify_of_view_change_cancellation()

void Gcs_operations::notify_of_view_change_cancellation ( int  errnr = GROUP_REPLICATION_CONFIGURATION_ERROR)

Notify all listeners that a view was canceled.

Parameters
[in]errnrThe error associated to this view

◆ notify_of_view_change_end()

void Gcs_operations::notify_of_view_change_end ( )

Notify all listeners that a view changed.

◆ reconfigure()

enum enum_gcs_error Gcs_operations::reconfigure ( const Gcs_interface_parameters parameters)

Reconfigure the GCS interface, i.e.

update its configuration parameters.

Parameters
[in]parametersThe configuration parameters
Returns
the operation status
Return values
0OK
!=0Error

◆ remove_view_notifer()

void Gcs_operations::remove_view_notifer ( Plugin_gcs_view_modification_notifier view_notifier)

Removes the notifier from the list.

◆ send_message()

enum enum_gcs_error Gcs_operations::send_message ( const Plugin_gcs_message message,
bool  skip_if_not_initialized = false 
)

Send a message to the group.

Parameters
[in]messageThe message to send
[in]skip_if_not_initializedIf true, the message will not be sent and no errors will returned when the GCS interface is not initialized
Returns
the operation status
Return values
0OK
!=0Error

◆ send_transaction_message()

enum enum_gcs_error Gcs_operations::send_transaction_message ( Transaction_message_interface message)

Send a transaction message to the group.

Parameters
[in]messageThe message to send
Returns
the operation status
Return values
0OK
!=0Error

◆ set_debug_options()

enum enum_gcs_error Gcs_operations::set_debug_options ( std::string &  debug_options) const

Configure the debug options that shall be used by GCS.

Parameters
debug_optionsSet of debug options separated by comma
Returns
the operation status
Return values
0OK
!=0Error

◆ set_everyone_leader()

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.

Return values
GCS_OKif successful
GCS_NOKif unsuccessful

◆ set_leader()

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.

Parameters
leaderThe member you desire to act as a consensus leader.
Return values
GCS_OKif successful
GCS_NOKif unsuccessful

◆ set_protocol_version()

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.

Parameters
gcs_protocolThe desired GCS protocol version
Return values
{true,future}If successful
{false,_}If unsuccessful because new_version is unsupported

◆ set_write_concurrency()

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.

Parameters
new_write_concurrencyThe desired "write concurrency" value.
Return values
GCS_OKif successful
GCS_NOKif unsuccessful

◆ set_xcom_cache_size()

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.

Parameters
new_sizeThe new maximum size of the XCom cache.
Return values
GCS_OKif request successfully scheduled
GCS_NOKif GCS is unable to schedule the request

Member Data Documentation

◆ auth_provider

Gcs_mysql_network_provider_auth_interface_impl Gcs_operations::auth_provider
private

External IoC dependencies for gcs_mysql_net_provider.

  • A provider for authentication parameters
  • A provider for all mysql native methods

◆ gcs_engine

const std::string Gcs_operations::gcs_engine = "xcom"
staticprivate

◆ gcs_interface

Gcs_interface* Gcs_operations::gcs_interface
private

◆ gcs_logger

Gcs_gr_logger_impl Gcs_operations::gcs_logger
private

◆ gcs_mysql_net_provider

std::shared_ptr<Gcs_mysql_network_provider> Gcs_operations::gcs_mysql_net_provider
private

◆ gcs_operations_lock

Checkable_rwlock* Gcs_operations::gcs_operations_lock
private

◆ injected_view_modification

bool Gcs_operations::injected_view_modification
private

Was this view change injected.

◆ leave_coordination_leaving

std::atomic<bool> Gcs_operations::leave_coordination_leaving
private

Is the member leaving.

◆ leave_coordination_left

std::atomic<bool> Gcs_operations::leave_coordination_left
private

Did the member already left.

◆ native_interface

Gcs_mysql_network_provider_native_interface_impl Gcs_operations::native_interface
private

◆ view_change_notifier_list

std::list<Plugin_gcs_view_modification_notifier *> Gcs_operations::view_change_notifier_list
private

List of associated view change notifiers waiting.

◆ view_observers_lock

Checkable_rwlock* Gcs_operations::view_observers_lock
private

Lock for the list of waiters on a view change.


The documentation for this class was generated from the following files: