MySQL 9.1.0
Source Code Documentation
|
#include "sql/rpl_group_replication.h"
#include <stdlib.h>
#include <sys/types.h>
#include <atomic>
#include <mysql/components/my_service.h>
#include <mysql/components/services/group_replication_status_service.h>
#include <mysql/components/services/mysql_system_variable.h>
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_systime.h"
#include "my_time.h"
#include "mysql/binlog/event/binlog_event.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/my_loglevel.h"
#include "mysql/plugin.h"
#include "mysql/plugin_group_replication.h"
#include "mysql/service_mysql_alloc.h"
#include "mysqld_error.h"
#include "sql/clone_handler.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/mysqld_thd_manager.h"
#include "sql/replication.h"
#include "sql/rpl_channel_credentials.h"
#include "sql/rpl_channel_service_interface.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_replica.h"
#include "sql/sql_class.h"
#include "sql/sql_lex.h"
#include "sql/sql_plugin.h"
#include "sql/sql_plugin_ref.h"
#include "sql/ssl_init_callback.h"
#include "sql/system_variables.h"
#include "sql/tztime.h"
#include "string_with_len.h"
Namespaces | |
namespace | anonymous_namespace{rpl_group_replication.cc} |
Functions | |
int | group_replication_init () |
Server side initializations. More... | |
bool | is_group_replication_plugin_loaded () |
int | group_replication_start (char **error_message, THD *thd) |
int | group_replication_stop (char **error_message) |
bool | is_group_replication_running () |
bool | is_group_replication_cloning () |
int | set_group_replication_retrieved_certification_info (View_change_log_event *view_change_event) |
bool | get_group_replication_connection_status_info (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS &callbacks) |
bool | get_group_replication_group_members_info (unsigned int index, const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS &callbacks) |
bool | get_group_replication_group_member_stats_info (unsigned int index, const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS &callbacks) |
unsigned int | get_group_replication_members_number_info () |
char * | my_strdup_nullable (OptionalString from) |
helper function to get_server_parameters More... | |
void | get_server_parameters (char **hostname, uint *port, char **uuid, unsigned int *out_server_version, uint *out_admin_port) |
Returns the server hostname, port and uuid. More... | |
void | get_server_main_ssl_parameters (st_server_ssl_variables *server_ssl_variables) |
Returns the server's client-server interface's ssl configuration values. More... | |
void | get_server_admin_ssl_parameters (st_server_ssl_variables *server_ssl_variables) |
Returns the server's admin interface's ssl configuration values. More... | |
ulong | get_server_id () |
Returns the server_id. More... | |
ulong | get_auto_increment_increment () |
Returns the server auto_increment_increment. More... | |
ulong | get_auto_increment_offset () |
Returns the server auto_increment_offset. More... | |
void | set_auto_increment_increment (ulong auto_increment_increment) |
Set server auto_increment_increment. More... | |
void | set_auto_increment_offset (ulong auto_increment_offset) |
Set server auto_increment_offset. More... | |
void | get_server_startup_prerequirements (Trans_context_info &requirements) |
Returns a struct containing all server startup information needed to evaluate if one has conditions to proceed executing master-master replication. More... | |
bool | get_server_encoded_gtid_executed (uchar **encoded_gtid_executed, size_t *length) |
Returns the server GTID_EXECUTED encoded as a binary string. More... | |
char * | encoded_gtid_set_to_string (uchar *encoded_gtid_set, size_t length) |
Returns a text representation of a encoded GTID set. More... | |
void | global_thd_manager_add_thd (THD *thd) |
Add thread to Global_THD_manager singleton. More... | |
void | global_thd_manager_remove_thd (THD *thd) |
Remove thread from Global_THD_manager singleton. More... | |
bool | is_gtid_committed (const Gtid >id) |
Returns true if the given transaction is committed. More... | |
bool | wait_for_gtid_set_committed (const char *gtid_set_text, double timeout, bool update_thd_status) |
Wait until the given Gtid_set is included in @GLOBAL.GTID_EXECUTED. More... | |
unsigned long | get_replica_max_allowed_packet () |
Returns the value of replica_max_allowed_packet. More... | |
unsigned long | get_max_replica_max_allowed_packet () |
bool | is_server_restarting_after_clone () |
bool | is_server_data_dropped () |
std::string | get_group_replication_group_name () |
Getter to extract the group_name in GR which, this can be used outside GR to find out the group name. More... | |
bool | get_group_replication_view_change_uuid (std::string &uuid) |
Getter to extract the value of variable group_replication_view_change_uuid in Group Replication. More... | |
bool | is_group_replication_member_secondary () |
Checks if this member is part of a group in single-primary mode and if this member is a secondary. More... | |
void | microseconds_to_datetime_str (uint64_t microseconds_since_epoch, char *datetime_str, uint decimal_precision) |
Copy to datetime_str parameter the date in the format 'YYYY-MM-DD hh:mm:ss.ffffff' of the moment in time represented by micro-seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). More... | |
Variables | |
std::atomic_flag | start_stop_executing = ATOMIC_FLAG_INIT |
LEX_CSTRING | anonymous_namespace{rpl_group_replication.cc}::group_replication_plugin_name_str |
Static name of Group Replication plugin. More... | |
char * encoded_gtid_set_to_string | ( | uchar * | encoded_gtid_set, |
size_t | length | ||
) |
Returns a text representation of a encoded GTID set.
[in] | encoded_gtid_set | binary string |
[in] | length | binary string length |
ulong get_auto_increment_increment | ( | ) |
Returns the server auto_increment_increment.
ulong get_auto_increment_offset | ( | ) |
Returns the server auto_increment_offset.
bool get_group_replication_connection_status_info | ( | const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS & | callbacks | ) |
bool get_group_replication_group_member_stats_info | ( | unsigned int | index, |
const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS & | callbacks | ||
) |
bool get_group_replication_group_members_info | ( | unsigned int | index, |
const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS & | callbacks | ||
) |
std::string get_group_replication_group_name | ( | ) |
Getter to extract the group_name in GR which, this can be used outside GR to find out the group name.
unsigned int get_group_replication_members_number_info | ( | ) |
bool get_group_replication_view_change_uuid | ( | std::string & | uuid | ) |
Getter to extract the value of variable group_replication_view_change_uuid in Group Replication.
If group_replication_view_change_uuid variable isn't defined or service retrieves error when getting variable it will return default value "AUTOMATIC".
[out] | uuid | Retrieves value of variable group_replication_view_change |
false | OK |
true | Error |
unsigned long get_max_replica_max_allowed_packet | ( | ) |
unsigned long get_replica_max_allowed_packet | ( | ) |
Returns the value of replica_max_allowed_packet.
void get_server_admin_ssl_parameters | ( | st_server_ssl_variables * | server_ssl_variables | ) |
Returns the server's admin interface's ssl configuration values.
[out] | server_ssl_variables | server's ssl_variables |
bool get_server_encoded_gtid_executed | ( | uchar ** | encoded_gtid_executed, |
size_t * | length | ||
) |
Returns the server GTID_EXECUTED encoded as a binary string.
[out] | encoded_gtid_executed | binary string |
[out] | length | binary string length |
ulong get_server_id | ( | ) |
Returns the server_id.
void get_server_main_ssl_parameters | ( | st_server_ssl_variables * | server_ssl_variables | ) |
Returns the server's client-server interface's ssl configuration values.
[out] | server_ssl_variables | server's ssl_variables |
void get_server_parameters | ( | char ** | hostname, |
uint * | port, | ||
char ** | uuid, | ||
unsigned int * | server_version, | ||
uint * | admin_port | ||
) |
Returns the server hostname, port and uuid.
[out] | hostname | hostname |
[out] | port | port |
[out] | uuid | uuid |
[out] | server_version | server version |
[out] | admin_port | mysqld admin port |
void get_server_startup_prerequirements | ( | Trans_context_info & | requirements | ) |
Returns a struct containing all server startup information needed to evaluate if one has conditions to proceed executing master-master replication.
[out] | requirements | requirements |
void global_thd_manager_add_thd | ( | THD * | thd | ) |
Add thread to Global_THD_manager singleton.
[in] | thd | The thread |
void global_thd_manager_remove_thd | ( | THD * | thd | ) |
Remove thread from Global_THD_manager singleton.
[in] | thd | The thread |
int group_replication_init | ( | ) |
Server side initializations.
int group_replication_start | ( | char ** | error_message, |
THD * | thd | ||
) |
int group_replication_stop | ( | char ** | error_message | ) |
bool is_group_replication_cloning | ( | ) |
bool is_group_replication_member_secondary | ( | ) |
Checks if this member is part of a group in single-primary mode and if this member is a secondary.
true | this member is part of a group in single-primary mode and is a secondary |
false | otherwise |
bool is_group_replication_plugin_loaded | ( | ) |
bool is_group_replication_running | ( | ) |
bool is_gtid_committed | ( | const Gtid & | gtid | ) |
Returns true if the given transaction is committed.
[in] | gtid | The transaction identifier |
bool is_server_data_dropped | ( | ) |
bool is_server_restarting_after_clone | ( | ) |
void microseconds_to_datetime_str | ( | uint64_t | microseconds_since_epoch, |
char * | datetime_str, | ||
uint | decimal_precision | ||
) |
Copy to datetime_str parameter the date in the format 'YYYY-MM-DD hh:mm:ss.ffffff' of the moment in time represented by micro-seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
[in] | microseconds_since_epoch | micro-seconds since Epoch. |
[out] | datetime_str | The string pointer to print at. This function is guaranteed not to write more than MAX_DATE_STRING_REP_LENGTH characters. |
[in] | decimal_precision | decimal precision, in the range 0..6 |
|
inline |
helper function to get_server_parameters
void set_auto_increment_increment | ( | ulong | auto_increment_increment | ) |
Set server auto_increment_increment.
[in] | auto_increment_increment | auto-increment increment |
void set_auto_increment_offset | ( | ulong | auto_increment_offset | ) |
Set server auto_increment_offset.
[in] | auto_increment_offset | auto-increment offset |
int set_group_replication_retrieved_certification_info | ( | View_change_log_event * | view_change_event | ) |
bool wait_for_gtid_set_committed | ( | const char * | gtid_set_text, |
double | timeout, | ||
bool | update_thd_status | ||
) |
Wait until the given Gtid_set is included in @GLOBAL.GTID_EXECUTED.
[in] | gtid_set_text | Gtid_set to wait for. |
[in] | timeout | The maximum number of seconds that the function should wait, or 0 to wait indefinitely. |
[in] | update_thd_status | when true updates the stage info with the new wait condition, when false keeps the current stage info. |
false | the Gtid_set is included in @GLOBAL.GTID_EXECUTED |
true | otherwise |
std::atomic_flag start_stop_executing = ATOMIC_FLAG_INIT |