MySQL 8.4.2
Source Code Documentation
|
#include <recovery_state_transfer.h>
Public Member Functions | |
Recovery_state_transfer (char *recovery_channel_name, const std::string &member_uuid, Channel_observation_manager *channel_obsr_mngr) | |
Recovery state transfer constructor. More... | |
~Recovery_state_transfer () | |
void | initialize (const std::string &view_id, bool is_vcle_enabled) |
Initialize the state transfer class and reset the class flags. More... | |
void | set_until_condition_after_gtids (const std::string &after_gtids) |
Set the gtids to use for the recovery until condition. More... | |
void | abort_state_transfer () |
Abort the state transfer. More... | |
void | end_state_transfer () |
Signals that the data was received so the process can end. More... | |
void | set_recovery_donor_retry_count (ulong retry_count) |
Sets the number of times recovery tries to connect to a given donor. More... | |
void | set_recovery_donor_reconnect_interval (ulong reconnect_interval) |
Sets the sleep time between connection attempts to all possible donors. More... | |
void | set_recovery_ssl_options (bool use_ssl, const char *ssl_ca, const char *ssl_capath, const char *ssl_cert, const char *ssl_cipher, const char *ssl_key, const char *ssl_crl, const char *ssl_crlpath, bool ssl_verify_server_cert, char *tls_version, char *tls_ciphersuites) |
Sets all the SSL option to use on recovery. More... | |
void | set_recovery_use_ssl (char use_ssl) |
Set the option that forces the use of SSL on recovery connections. More... | |
void | set_recovery_ssl_ca (const char *ssl_ca) |
Set a SSL trusted certificate authorities file. More... | |
void | set_recovery_ssl_capath (const char *ssl_capath) |
Set a folder with SSL trusted CA files. More... | |
void | set_recovery_ssl_cert (const char *ssl_cert) |
Set a SSL certificate for connection. More... | |
void | set_recovery_ssl_cipher (const char *ssl_cipher) |
Set a SSL ciphers to be used. More... | |
void | set_recovery_ssl_key (const char *ssl_key) |
Set a SSL key for connections. More... | |
void | set_recovery_ssl_crl (const char *ssl_crl) |
Set a SSL revocation list file. More... | |
void | set_recovery_ssl_crlpath (const char *ssl_crlpath) |
Set a folder with SSL revocation list files. More... | |
void | set_recovery_ssl_verify_server_cert (char ssl_verify_server_cert) |
Set if recovery shall compare the used hostname against the certificate. More... | |
void | set_recovery_tls_version (const char *tls_version) |
Set a TLS versions to be used. More... | |
void | set_recovery_tls_ciphersuites (const char *tls_ciphersuites) |
Set a TLS ciphersuites to be used. More... | |
bool | get_recovery_use_ssl () |
void | get_recovery_base_ssl_options (std::string *ssl_ca, std::string *ssl_cert, std::string *ssl_key) |
Get SSL options configured for recovery. More... | |
void | set_stop_wait_timeout (ulong timeout) |
Sets the recovery shutdown timeout. More... | |
void | set_recovery_public_key_path (const char *public_key_path) |
Set a public key file. More... | |
void | set_recovery_get_public_key (bool set) |
Get preference to get public key. More... | |
void | set_recovery_compression_algorithm (const char *name) |
Set compression algorithm. More... | |
void | set_recovery_zstd_compression_level (uint level) |
Set compression level. More... | |
void | initialize_group_info () |
This method initializes the group membership info. More... | |
int | update_recovery_process (bool did_members_left) |
This method decides what action to take when a member exits the group. More... | |
void | inform_of_applier_stop (my_thread_id thread_id, bool aborted) |
Method that informs recovery that the donor channel applier was stopped. More... | |
void | inform_of_receiver_stop (my_thread_id thread_id) |
Method that informs recovery that the donor channel receiver was stopped. More... | |
bool | is_own_event_channel (my_thread_id id) |
Checks if the given id matches the recovery applier thread. More... | |
int | check_recovery_thread_status () |
Checks to see if the recovery IO/SQL thread is still running, probably caused by an timeout on shutdown. More... | |
State_transfer_status | state_transfer (Plugin_stage_monitor_handler &stage_handler) |
Execute state transfer. More... | |
Private Member Functions | |
void | update_group_membership (bool update_donor) |
Removes the old list of group members and enquires about the current members. More... | |
void | build_donor_list (std::string *selected_donor) |
Based on the group list, build a random order list with all suitable donors. More... | |
void | donor_failover () |
Method that sets the failover status to true and awakes recovery. More... | |
bool | verify_member_has_after_gtids_present (std::string &local_gtid_executed_string) |
Verify member has after_gtids received from replication donor already present in member's gtid_executed. More... | |
int | establish_donor_connection () |
Establish a master/slave connection to the selected donor. More... | |
int | initialize_donor_connection (std::string hostname, uint port) |
Initializes the structures for the donor connection threads. More... | |
bool | initialize_connection_parameters () |
Initializes the connection parameters for the donor connection. More... | |
int | start_recovery_donor_threads () |
Starts the recovery slave threads to receive data from the donor. More... | |
State_transfer_status | terminate_recovery_slave_threads (bool purge_logs=true) |
Terminates the connection to the donor. More... | |
int | purge_recovery_slave_threads_repos () |
Purges relay logs and the master info object. More... | |
bool | verify_after_gtids_applied () |
Verifies if after_gtids sent by sender is successfully applied when recovery is using CHANNEL_UNTIL_APPLIER_AFTER_GTIDS for start replica until condition. More... | |
Recovery_state_transfer::Recovery_state_transfer | ( | char * | recovery_channel_name, |
const std::string & | member_uuid, | ||
Channel_observation_manager * | channel_obsr_mngr | ||
) |
Recovery state transfer constructor.
recovery_channel_name | The channel name to be used |
member_uuid | This member uuid |
channel_obsr_mngr | The channel state observer manager |
Recovery_state_transfer::~Recovery_state_transfer | ( | ) |
void Recovery_state_transfer::abort_state_transfer | ( | ) |
Abort the state transfer.
|
private |
Based on the group list, build a random order list with all suitable donors.
selected_donor | the current selected donor to update its pointer |
int Recovery_state_transfer::check_recovery_thread_status | ( | ) |
Checks to see if the recovery IO/SQL thread is still running, probably caused by an timeout on shutdown.
If the threads are still running, we try to stop them again. If not possible, an error is reported.
0 | All is stopped. |
!=0 | Threads are still running |
|
private |
Method that sets the failover status to true and awakes recovery.
void Recovery_state_transfer::end_state_transfer | ( | ) |
Signals that the data was received so the process can end.
|
private |
Establish a master/slave connection to the selected donor.
0 | OK |
!=0 | Error |
|
inline |
Get SSL options configured for recovery.
[out] | ssl_ca | the ssl ca |
[out] | ssl_cert | the ssl cert |
[out] | ssl_key | the ssl key |
|
inline |
void Recovery_state_transfer::inform_of_applier_stop | ( | my_thread_id | thread_id, |
bool | aborted | ||
) |
Method that informs recovery that the donor channel applier was stopped.
thread_id | the applier thread id |
aborted | if the applier was aborted or stopped |
void Recovery_state_transfer::inform_of_receiver_stop | ( | my_thread_id | thread_id | ) |
Method that informs recovery that the donor channel receiver was stopped.
thread_id | the applier thread id |
void Recovery_state_transfer::initialize | ( | const std::string & | view_id, |
bool | is_vcle_enabled | ||
) |
Initialize the state transfer class and reset the class flags.
view_id | The view id to use for the recovery. |
is_vcle_enabled | the flag determine if View_change_log_event is enabled. |
|
private |
Initializes the connection parameters for the donor connection.
false | Everything OK |
true | In case of the selected donor is not available |
|
private |
Initializes the structures for the donor connection threads.
Recovery channel is always purged.
hostname | hostname of current selected donor |
port | port of current selected donor |
0 | OK |
!=0 | Error |
void Recovery_state_transfer::initialize_group_info | ( | ) |
This method initializes the group membership info.
bool Recovery_state_transfer::is_own_event_channel | ( | my_thread_id | id | ) |
Checks if the given id matches the recovery applier thread.
id | the thread id |
true | the id matches a SQL or worker thread |
false | the id doesn't match any thread |
|
private |
Purges relay logs and the master info object.
0 | OK |
REPLICATION_THREAD_REPOSITORY_RL_PURGE_ERROR | Error when purging the relay logs |
REPLICATION_THREAD_REPOSITORY_MI_PURGE_ERROR | Error when cleaning the master info repository |
|
inline |
Set compression algorithm.
|
inline |
Sets the sleep time between connection attempts to all possible donors.
|
inline |
Sets the number of times recovery tries to connect to a given donor.
|
inline |
Get preference to get public key.
|
inline |
Set a public key file.
|
inline |
Set a SSL trusted certificate authorities file.
|
inline |
Set a folder with SSL trusted CA files.
|
inline |
Set a SSL certificate for connection.
|
inline |
Set a SSL ciphers to be used.
|
inline |
Set a SSL revocation list file.
|
inline |
Set a folder with SSL revocation list files.
|
inline |
Set a SSL key for connections.
|
inline |
Sets all the SSL option to use on recovery.
use_ssl | force the use of SSL on recovery connections |
ssl_ca | SSL trusted certificate authorities file |
ssl_capath | a directory with trusted CA files |
ssl_cert | the certificate file for secure connections |
ssl_cipher | the list of ciphers to use |
ssl_key | the SSL key file |
ssl_crl | SSL revocation list file |
ssl_crlpath | path with revocation list files |
ssl_verify_server_cert | verify the hostname against the certificate |
tls_version | the list of TLS versions to use |
tls_ciphersuites | the list of TLS ciphersuites to use |
|
inline |
Set if recovery shall compare the used hostname against the certificate.
|
inline |
Set a TLS ciphersuites to be used.
|
inline |
Set a TLS versions to be used.
|
inline |
Set the option that forces the use of SSL on recovery connections.
|
inline |
Set compression level.
|
inline |
Sets the recovery shutdown timeout.
[in] | timeout | the timeout |
void Recovery_state_transfer::set_until_condition_after_gtids | ( | const std::string & | after_gtids | ) |
Set the gtids to use for the recovery until condition.
after_gtids | the gtids to use for the recovery until condition. |
|
private |
Starts the recovery slave threads to receive data from the donor.
0 | OK |
!=0 | Error |
State_transfer_status Recovery_state_transfer::state_transfer | ( | Plugin_stage_monitor_handler & | stage_handler | ) |
Execute state transfer.
stage_handler | Stage handler to update the system tables |
0 | OK |
!=0 | Recovery state transfer failed |
|
private |
Terminates the connection to the donor.
purge_logs | purge recovery logs |
STATE_TRANSFER_OK | OK |
!=STATE_TRANSFER_OK | Error |
|
private |
Removes the old list of group members and enquires about the current members.
[in] | update_donor | update the selected donor pointer when updating |
int Recovery_state_transfer::update_recovery_process | ( | bool | did_members_left | ) |
This method decides what action to take when a member exits the group.
If the donor left, and the state transfer is still ongoing, then pick a new one and restart the transfer.
did_members_left | states if members left the view |
0 | OK |
!=0 | Error |
|
private |
Verifies if after_gtids sent by sender is successfully applied when recovery is using CHANNEL_UNTIL_APPLIER_AFTER_GTIDS for start replica until condition.
false | after_gtids is successfully applied. |
true | Error in applying after_gtids. |
|
private |
Verify member has after_gtids received from replication donor already present in member's gtid_executed.
local_gtid_executed_string | the local member gtid_executed string |
true | after_gtids there in member's gtid_executed. |
false | after_gtids not there in member's gtid_executed. |
|
private |
|
private |
|
private |
|
private |
Interface class to interact with the donor connection threads.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The recovery channel name.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Get public key.
|
private |
|
private |
Public key information.
|
private |
The configured SSL trusted certificate authorities file.
|
private |
The configured directory that contains trusted SSL CA files.
|
private |
The configured SSL certificate file to use for a secure connection.
|
private |
The configured SSL list of permissible ciphers to use for encryption.
|
private |
The configured SSL file containing certificate revocation lists.
|
private |
The configured directory that contains certificate revocation list files.
|
private |
The configured SSL key file to use for establishing a secure connection.
|
private |
If the server's Common Name value checks against donor sent certificate.
|
private |
|
private |
Permitted TLS 1.3 ciphersuites.
|
private |
Permitted TLS versions.
|
private |
If the use of SSL is obligatory on recovery connections.
|
private |
|
private |
|
private |
|
private |
|
private |