MySQL 8.3.0
Source Code Documentation
plugin.h File Reference
#include <mysql/components/services/mysql_runtime_error_service.h>
#include <mysql/plugin.h>
#include <mysql/plugin_group_replication.h>
#include "plugin/group_replication/include/applier.h"
#include "plugin/group_replication/include/asynchronous_channels_state_observer.h"
#include "plugin/group_replication/include/auto_increment.h"
#include "plugin/group_replication/include/compatibility_module.h"
#include "plugin/group_replication/include/delayed_plugin_initialization.h"
#include "plugin/group_replication/include/gcs_event_handlers.h"
#include "plugin/group_replication/include/gcs_operations.h"
#include "plugin/group_replication/include/gcs_view_modification_notifier.h"
#include "plugin/group_replication/include/group_actions/group_action_coordinator.h"
#include "plugin/group_replication/include/plugin_constants.h"
#include "plugin/group_replication/include/plugin_handlers/group_partition_handling.h"
#include "plugin/group_replication/include/plugin_handlers/primary_election_invocation_handler.h"
#include "plugin/group_replication/include/plugin_handlers/read_mode_handler.h"
#include "plugin/group_replication/include/plugin_handlers/recovery_metadata.h"
#include "plugin/group_replication/include/plugin_handlers/remote_clone_handler.h"
#include "plugin/group_replication/include/plugin_observers/channel_observation_manager.h"
#include "plugin/group_replication/include/plugin_observers/group_event_observer.h"
#include "plugin/group_replication/include/plugin_observers/group_transaction_observation_manager.h"
#include "plugin/group_replication/include/plugin_server_include.h"
#include "plugin/group_replication/include/ps_information.h"
#include "plugin/group_replication/include/recovery.h"
#include "plugin/group_replication/include/services/message_service/message_service.h"
#include "plugin/group_replication/include/services/registry.h"
#include "plugin/group_replication/include/services/server_services_references.h"
#include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_interface.h"

Go to the source code of this file.

Classes

struct  SYS_VAR
 
struct  gr_modules
 This struct provides a namespace for the GR layer components. More...
 

Enumerations

enum  enum_channel_observation_manager_position { GROUP_CHANNEL_OBSERVATION_MANAGER_POS = 0 , ASYNC_CHANNEL_OBSERVATION_MANAGER_POS , END_CHANNEL_OBSERVATION_MANAGER_POS }
 Position of channel observation manager's in channel_observation_manager_list. More...
 
enum  enum_exit_state_action { EXIT_STATE_ACTION_READ_ONLY = 0 , EXIT_STATE_ACTION_ABORT_SERVER , EXIT_STATE_ACTION_OFFLINE_MODE }
 Action performed when the member leaves the group unexpectedly. More...
 
enum  enum_tls_source_values { TLS_SOURCE_MYSQL_MAIN = 0 , TLS_SOURCE_MYSQL_ADMIN }
 Source of TLS configuration for the connection between Group Replication members. More...
 
enum  enum_wait_on_start_process_result { WAIT_ON_START_PROCESS_SUCCESS = 0 , WAIT_ON_START_PROCESS_ABORT_ON_CLONE , WAIT_ON_START_PROCESS_ABORT_SECONDARY_MEMBER }
 Reasons why asynchronous channels start wait for Group Replication status can be aborted. More...
 

Functions

bool server_engine_initialized ()
 
void * get_plugin_pointer ()
 
Checkable_rwlockget_plugin_running_lock ()
 
mysql_mutex_tget_plugin_applier_module_initialize_terminate_lock ()
 
int initialize_plugin_and_join (enum_plugin_con_isolation sql_api_isolation, Delayed_initialization_thread *delayed_init_thd)
 
int initialize_plugin_modules (gr_modules::mask modules_to_init)
 
int terminate_plugin_modules (gr_modules::mask modules_to_terminate, char **error_message=nullptr, bool rejoin=false)
 
void register_server_reset_master ()
 
bool get_allow_local_lower_version_join ()
 
ulong get_transaction_size_limit ()
 
bool is_plugin_waiting_to_set_server_read_mode ()
 
bool check_async_channel_running_on_secondary ()
 
void set_enforce_update_everywhere_checks (bool option)
 
void set_single_primary_mode_var (bool option)
 
void set_auto_increment_handler_values ()
 
void reset_auto_increment_handler_values (bool force_reset=false)
 
const mysql_service_registry_tget_plugin_registry ()
 
rpl_sidno get_group_sidno ()
 
rpl_sidno get_view_change_sidno ()
 
bool is_view_change_log_event_required ()
 
bool is_autorejoin_enabled ()
 
uint get_number_of_autorejoin_tries ()
 
ulonglong get_rejoin_timeout ()
 
void declare_plugin_cloning (bool is_running)
 
bool get_allow_single_leader ()
 
bool attempt_rejoin ()
 Encapsulates the logic necessary to attempt a rejoin, i.e. More...
 
bool get_plugin_is_stopping ()
 
bool get_wait_on_engine_initialization ()
 
void enable_server_shutdown_status ()
 
bool get_server_shutdown_status ()
 
void mysql_thread_handler_finalize ()
 
void set_plugin_is_setting_read_mode (bool value)
 
bool get_plugin_is_setting_read_mode ()
 
const char * get_group_name_var ()
 
const char * get_view_change_uuid_var ()
 
ulong get_exit_state_action_var ()
 
ulong get_flow_control_mode_var ()
 
long get_flow_control_certifier_threshold_var ()
 
long get_flow_control_applier_threshold_var ()
 
long get_flow_control_min_quota_var ()
 
long get_flow_control_min_recovery_quota_var ()
 
long get_flow_control_max_quota_var ()
 
int get_flow_control_member_quota_percent_var ()
 
int get_flow_control_period_var ()
 
int get_flow_control_hold_percent_var ()
 
int get_flow_control_release_percent_var ()
 
ulong get_components_stop_timeout_var ()
 
ulong get_communication_stack_var ()
 
int plugin_group_replication_init (MYSQL_PLUGIN plugin_info)
 
int plugin_group_replication_deinit (void *p)
 
int plugin_group_replication_start (char **error_message=nullptr)
 
int plugin_group_replication_stop (char **error_message=nullptr)
 
bool plugin_is_group_replication_running ()
 
bool plugin_is_group_replication_cloning ()
 
bool is_plugin_auto_starting_on_non_bootstrap_member ()
 
bool is_plugin_configured_and_starting ()
 
enum_wait_on_start_process_result initiate_wait_on_start_process ()
 Blocks the calling thread. More...
 
void terminate_wait_on_start_process (enum_wait_on_start_process_result abort=WAIT_ON_START_PROCESS_SUCCESS)
 Release all the blocked threads. More...
 
void set_wait_on_start_process (bool cond)
 Set condition to block or unblock the calling threads. More...
 
bool plugin_get_connection_status (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS &callbacks)
 
bool plugin_get_group_members (uint index, const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS &callbacks)
 
bool plugin_get_group_member_stats (uint index, const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS &callbacks)
 
uint plugin_get_group_members_number ()
 
int plugin_group_replication_leave_group ()
 
int plugin_group_replication_set_retrieved_certification_info (void *info)
 Method to set retrieved certification info from a recovery channel extracted from a given View_change event. More...
 

Variables

Gcs_operationsgcs_module
 The plugin modules. More...
 
Applier_moduleapplier_module
 The plugin applier. More...
 
Recovery_modulerecovery_module
 The plugin recovery module. More...
 
Registry_module_interfaceregistry_module
 The registry module. More...
 
Group_member_info_manager_interfacegroup_member_mgr
 
Group_events_observation_managergroup_events_observation_manager
 The observation module for group events. More...
 
Channel_observation_manager_listchannel_observation_manager_list
 The channel observation modules. More...
 
Asynchronous_channels_state_observerasynchronous_channels_state_observer
 The Single primary channel observation module. More...
 
Transaction_consistency_managertransaction_consistency_manager
 The plugin transaction consistency manager. More...
 
Group_transaction_observation_managergroup_transaction_observation_manager
 The transaction observation module. More...
 
Shared_writelockshared_plugin_stop_lock
 Class to coordinate access to the plugin stop lock. More...
 
Delayed_initialization_threaddelayed_initialization_thread
 Initialization thread for server starts. More...
 
Group_action_coordinatorgroup_action_coordinator
 The coordinator for group actions. More...
 
Primary_election_handlerprimary_election_handler
 The primary election handler. More...
 
Autorejoin_threadautorejoin_module
 The thread that handles the auto-rejoin process. More...
 
Message_service_handlermessage_service_handler
 The thread that handles the message service process. More...
 
Member_actions_handlermember_actions_handler
 
Metrics_handlermetrics_handler
 
Mysql_threadmysql_thread_handler
 Handle tasks on mysql_thread. More...
 
Mysql_threadmysql_thread_handler_read_only_mode
 Dedicated mysql_thread to enable read_only and super_read_only since these are blocking operations. More...
 
Server_services_referencesserver_services_references_module
 Module with the acquired server services on plugin install. More...
 
Recovery_metadata_modulerecovery_metadata_module
 The plugin recovery metadata module. More...
 
Plugin_gcs_events_handlerevents_handler
 
Group_member_infolocal_member_info
 
Compatibility_modulecompatibility_mgr
 
Group_partition_handlinggroup_partition_handler
 The transaction handler for network partitions. More...
 
Blocked_transaction_handlerblocked_transaction_handler
 The handler for transaction killing when an error or partition happens. More...
 
Remote_clone_handlerremote_clone_handler
 The handler to invoke clone. More...
 
Consensus_leaders_handlerconsensus_leaders_handler
 
Wait_ticket< my_thread_id > * transactions_latch
 Transactions latch. More...
 
mysql_service_mysql_runtime_error_tmysql_runtime_error_service
 

Enumeration Type Documentation

◆ enum_channel_observation_manager_position

Position of channel observation manager's in channel_observation_manager_list.

Enumerator
GROUP_CHANNEL_OBSERVATION_MANAGER_POS 
ASYNC_CHANNEL_OBSERVATION_MANAGER_POS 
END_CHANNEL_OBSERVATION_MANAGER_POS 

◆ enum_exit_state_action

Action performed when the member leaves the group unexpectedly.

Enumerator
EXIT_STATE_ACTION_READ_ONLY 
EXIT_STATE_ACTION_ABORT_SERVER 
EXIT_STATE_ACTION_OFFLINE_MODE 

◆ enum_tls_source_values

Source of TLS configuration for the connection between Group Replication members.

Enumerator
TLS_SOURCE_MYSQL_MAIN 
TLS_SOURCE_MYSQL_ADMIN 

◆ enum_wait_on_start_process_result

Reasons why asynchronous channels start wait for Group Replication status can be aborted.

Enumerator
WAIT_ON_START_PROCESS_SUCCESS 
WAIT_ON_START_PROCESS_ABORT_ON_CLONE 
WAIT_ON_START_PROCESS_ABORT_SECONDARY_MEMBER 

Function Documentation

◆ attempt_rejoin()

bool attempt_rejoin ( )

Encapsulates the logic necessary to attempt a rejoin, i.e.

gracefully leave the group, terminate GCS infrastructure, terminate auto-rejoin relevant plugin modules, reinitialize auto-rejoin relevant plugin modules, reinitialize GCS infrastructure and attempt to join the group again.

Returns
a flag indicating success or failure.
Return values
truethe rejoin failed.
falsethe rejoin succeeded.

◆ check_async_channel_running_on_secondary()

bool check_async_channel_running_on_secondary ( )

◆ declare_plugin_cloning()

void declare_plugin_cloning ( bool  is_running)

◆ enable_server_shutdown_status()

void enable_server_shutdown_status ( )

◆ get_allow_local_lower_version_join()

bool get_allow_local_lower_version_join ( )

◆ get_allow_single_leader()

bool get_allow_single_leader ( )

◆ get_communication_stack_var()

ulong get_communication_stack_var ( )

◆ get_components_stop_timeout_var()

ulong get_components_stop_timeout_var ( )

◆ get_exit_state_action_var()

ulong get_exit_state_action_var ( )

◆ get_flow_control_applier_threshold_var()

long get_flow_control_applier_threshold_var ( )

◆ get_flow_control_certifier_threshold_var()

long get_flow_control_certifier_threshold_var ( )

◆ get_flow_control_hold_percent_var()

int get_flow_control_hold_percent_var ( )

◆ get_flow_control_max_quota_var()

long get_flow_control_max_quota_var ( )

◆ get_flow_control_member_quota_percent_var()

int get_flow_control_member_quota_percent_var ( )

◆ get_flow_control_min_quota_var()

long get_flow_control_min_quota_var ( )

◆ get_flow_control_min_recovery_quota_var()

long get_flow_control_min_recovery_quota_var ( )

◆ get_flow_control_mode_var()

ulong get_flow_control_mode_var ( )

◆ get_flow_control_period_var()

int get_flow_control_period_var ( )

◆ get_flow_control_release_percent_var()

int get_flow_control_release_percent_var ( )

◆ get_group_name_var()

const char * get_group_name_var ( )

◆ get_group_sidno()

rpl_sidno get_group_sidno ( )

◆ get_number_of_autorejoin_tries()

uint get_number_of_autorejoin_tries ( )

◆ get_plugin_applier_module_initialize_terminate_lock()

mysql_mutex_t * get_plugin_applier_module_initialize_terminate_lock ( )

◆ get_plugin_is_setting_read_mode()

bool get_plugin_is_setting_read_mode ( )

◆ get_plugin_is_stopping()

bool get_plugin_is_stopping ( )

◆ get_plugin_pointer()

void * get_plugin_pointer ( )

◆ get_plugin_registry()

const mysql_service_registry_t * get_plugin_registry ( )

◆ get_plugin_running_lock()

Checkable_rwlock * get_plugin_running_lock ( )

◆ get_rejoin_timeout()

ulonglong get_rejoin_timeout ( )

◆ get_server_shutdown_status()

bool get_server_shutdown_status ( )

◆ get_transaction_size_limit()

ulong get_transaction_size_limit ( )

◆ get_view_change_sidno()

rpl_sidno get_view_change_sidno ( )

◆ get_view_change_uuid_var()

const char * get_view_change_uuid_var ( )

◆ get_wait_on_engine_initialization()

bool get_wait_on_engine_initialization ( )

◆ initialize_plugin_and_join()

int initialize_plugin_and_join ( enum_plugin_con_isolation  sql_api_isolation,
Delayed_initialization_thread delayed_init_thd 
)

We redo the check for the group name here when starting on boot as only now the information about channels and the assign_gtids_to_anonymous_transactions is available.

◆ initialize_plugin_modules()

int initialize_plugin_modules ( gr_modules::mask  modules_to_init)

◆ initiate_wait_on_start_process()

enum_wait_on_start_process_result initiate_wait_on_start_process ( )

Blocks the calling thread.

◆ is_autorejoin_enabled()

bool is_autorejoin_enabled ( )

◆ is_plugin_auto_starting_on_non_bootstrap_member()

bool is_plugin_auto_starting_on_non_bootstrap_member ( )

◆ is_plugin_configured_and_starting()

bool is_plugin_configured_and_starting ( )

◆ is_plugin_waiting_to_set_server_read_mode()

bool is_plugin_waiting_to_set_server_read_mode ( )

◆ is_view_change_log_event_required()

bool is_view_change_log_event_required ( )

◆ mysql_thread_handler_finalize()

void mysql_thread_handler_finalize ( )

◆ plugin_get_connection_status()

bool plugin_get_connection_status ( const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS callbacks)

◆ plugin_get_group_member_stats()

bool plugin_get_group_member_stats ( uint  index,
const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS callbacks 
)

◆ plugin_get_group_members()

bool plugin_get_group_members ( uint  index,
const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS callbacks 
)

◆ plugin_get_group_members_number()

uint plugin_get_group_members_number ( )

◆ plugin_group_replication_deinit()

int plugin_group_replication_deinit ( void *  p)

◆ plugin_group_replication_init()

int plugin_group_replication_init ( MYSQL_PLUGIN  plugin_info)

◆ plugin_group_replication_leave_group()

int plugin_group_replication_leave_group ( )

◆ plugin_group_replication_set_retrieved_certification_info()

int plugin_group_replication_set_retrieved_certification_info ( void *  info)

Method to set retrieved certification info from a recovery channel extracted from a given View_change event.

Note
a copy of the certification info is made here.
Parameters
infothe given view_change_event.

◆ plugin_group_replication_start()

int plugin_group_replication_start ( char **  error_message = nullptr)

◆ plugin_group_replication_stop()

int plugin_group_replication_stop ( char **  error_message = nullptr)

◆ plugin_is_group_replication_cloning()

bool plugin_is_group_replication_cloning ( )

◆ plugin_is_group_replication_running()

bool plugin_is_group_replication_running ( )

◆ register_server_reset_master()

void register_server_reset_master ( )

◆ reset_auto_increment_handler_values()

void reset_auto_increment_handler_values ( bool  force_reset = false)

◆ server_engine_initialized()

bool server_engine_initialized ( )

◆ set_auto_increment_handler_values()

void set_auto_increment_handler_values ( )

◆ set_enforce_update_everywhere_checks()

void set_enforce_update_everywhere_checks ( bool  option)

◆ set_plugin_is_setting_read_mode()

void set_plugin_is_setting_read_mode ( bool  value)

◆ set_single_primary_mode_var()

void set_single_primary_mode_var ( bool  option)

◆ set_wait_on_start_process()

void set_wait_on_start_process ( bool  cond)

Set condition to block or unblock the calling threads.

Parameters
[in]condif the threads should be blocked or not

◆ terminate_plugin_modules()

int terminate_plugin_modules ( gr_modules::mask  modules_to_terminate,
char **  error_message = nullptr,
bool  rejoin = false 
)

◆ terminate_wait_on_start_process()

void terminate_wait_on_start_process ( enum_wait_on_start_process_result  abort = WAIT_ON_START_PROCESS_SUCCESS)

Release all the blocked threads.

Variable Documentation

◆ applier_module

Applier_module* applier_module
extern

The plugin applier.

◆ asynchronous_channels_state_observer

Asynchronous_channels_state_observer* asynchronous_channels_state_observer
extern

The Single primary channel observation module.

◆ autorejoin_module

Autorejoin_thread* autorejoin_module
extern

The thread that handles the auto-rejoin process.

◆ blocked_transaction_handler

Blocked_transaction_handler* blocked_transaction_handler
extern

The handler for transaction killing when an error or partition happens.

◆ channel_observation_manager_list

Channel_observation_manager_list* channel_observation_manager_list
extern

The channel observation modules.

◆ compatibility_mgr

Compatibility_module* compatibility_mgr
extern

◆ consensus_leaders_handler

Consensus_leaders_handler* consensus_leaders_handler
extern

◆ delayed_initialization_thread

Delayed_initialization_thread* delayed_initialization_thread
extern

Initialization thread for server starts.

◆ events_handler

Plugin_gcs_events_handler* events_handler
extern

◆ gcs_module

Gcs_operations* gcs_module
extern

The plugin modules.

Note
Whenever you want to create a new plugin module, be sure to add it to the gr_modules enum (
See also
gr_modules) and see if it's part of the rejoin process.

The plugin modules.

◆ group_action_coordinator

Group_action_coordinator* group_action_coordinator
extern

The coordinator for group actions.

◆ group_events_observation_manager

Group_events_observation_manager* group_events_observation_manager
extern

The observation module for group events.

◆ group_member_mgr

Group_member_info_manager_interface* group_member_mgr
extern

◆ group_partition_handler

Group_partition_handling* group_partition_handler
extern

The transaction handler for network partitions.

◆ group_transaction_observation_manager

Group_transaction_observation_manager* group_transaction_observation_manager
extern

The transaction observation module.

◆ local_member_info

Group_member_info* local_member_info
extern

◆ member_actions_handler

Member_actions_handler* member_actions_handler
extern

◆ message_service_handler

Message_service_handler* message_service_handler
extern

The thread that handles the message service process.

◆ metrics_handler

Metrics_handler* metrics_handler
extern

◆ mysql_runtime_error_service

mysql_service_mysql_runtime_error_t* mysql_runtime_error_service
extern

◆ mysql_thread_handler

Mysql_thread* mysql_thread_handler
extern

Handle tasks on mysql_thread.

◆ mysql_thread_handler_read_only_mode

Mysql_thread* mysql_thread_handler_read_only_mode
extern

Dedicated mysql_thread to enable read_only and super_read_only since these are blocking operations.

If we did use mysql_thread_handler that would block all other other operations until read modes operations complete.

◆ primary_election_handler

Primary_election_handler* primary_election_handler
extern

The primary election handler.

◆ recovery_metadata_module

Recovery_metadata_module* recovery_metadata_module
extern

The plugin recovery metadata module.

◆ recovery_module

Recovery_module* recovery_module
extern

The plugin recovery module.

◆ registry_module

Registry_module_interface* registry_module
extern

The registry module.

◆ remote_clone_handler

Remote_clone_handler* remote_clone_handler
extern

The handler to invoke clone.

◆ server_services_references_module

Server_services_references* server_services_references_module
extern

Module with the acquired server services on plugin install.

◆ shared_plugin_stop_lock

Shared_writelock* shared_plugin_stop_lock
extern

Class to coordinate access to the plugin stop lock.

◆ transaction_consistency_manager

Transaction_consistency_manager* transaction_consistency_manager
extern

The plugin transaction consistency manager.

◆ transactions_latch

Wait_ticket<my_thread_id>* transactions_latch
extern

Transactions latch.