MySQL 9.1.0
Source Code Documentation
|
#include <recovery.h>
Public Member Functions | |
Recovery_module (Applier_module_interface *applier, Channel_observation_manager *channel_obsr_mngr) | |
Recovery_module constructor. More... | |
~Recovery_module () | |
void | set_applier_module (Applier_module_interface *applier) |
int | start_recovery (const std::string &group_name, const std::string &view_id) |
Starts the recovery process, initializing the recovery thread. More... | |
int | recovery_thread_handle () |
Recovery thread main execution method. More... | |
int | set_retrieved_cert_info (void *info) |
Set retrieved certification info from a group replication channel extracted from a given View_change event. More... | |
int | stop_recovery (bool wait_for_termination=true) |
Stops the recovery process, shutting down the recovery thread. More... | |
int | update_recovery_process (bool did_members_left, bool is_leaving) |
This method decides what action to take when a member exits the group and executes it. 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 TLS version to be used. More... | |
void | set_recovery_tls_ciphersuites (const char *tls_ciphersuites) |
Set 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 public key automatically. 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... | |
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... | |
void | awake_recovery_metadata_suspension (bool error=false) |
Awakes recovery thd, waiting for the donor to send recovery metadata. More... | |
void | suspend_recovery_metadata () |
Suspend recovery thd, so that member can wait to receive the recovery metadata. More... | |
bool | set_recovery_metadata_message (Recovery_metadata_message *recovery_metadata_message) |
Set the recovery metadata message. More... | |
void | delete_recovery_metadata_message () |
Delete recovery metadata object. More... | |
bool | is_vcle_enable () |
Return the flag which determine if VCLE is enabled. More... | |
void | set_vcle_enabled (bool is_vcle_enabled) |
Set the View ID on which the joiner joined. More... | |
Private Member Functions | |
void | set_recovery_thread_context () |
Sets the thread context. More... | |
void | leave_group_on_recovery_failure () |
Handles code for removing the member in case of a failure during recovery. More... | |
void | clean_recovery_thread_context () |
Cleans the recovery thread related options/structures. More... | |
int | wait_for_applier_module_recovery () |
Starts a wait process until the applier fulfills the necessary condition for the member to be acknowledge as being online. More... | |
void | notify_group_recovery_end () |
Sends a message throughout the group stating the member as online. More... | |
enum_recovery_metadata_error | wait_for_recovery_metadata_gtid_executed () |
Starts a wait process until the recovery metadata is successfully send by the donor. More... | |
Private Attributes | |
bool | m_is_vcle_enable {false} |
Flag to determine if recovery should use VCLE. More... | |
Recovery_metadata_message * | m_recovery_metadata_message {nullptr} |
Recovery metadata received on group members. More... | |
my_thread_handle | recovery_pthd |
THD * | recovery_thd |
Applier_module_interface * | applier_module |
std::string | group_name |
Recovery_state_transfer | recovery_state_transfer |
thread_state | recovery_thd_state |
bool | recovery_aborted |
enum_channel_until_condition | m_until_condition {CHANNEL_UNTIL_VIEW_ID} |
unsigned int | m_max_metadata_wait_time |
mysql_mutex_t | run_lock |
mysql_cond_t | run_cond |
State_transfer_status | m_state_transfer_return |
bool | m_recovery_metadata_received {false} |
bool | m_recovery_metadata_received_error {false} |
Error while fetching Recovery metadata. More... | |
enum_recovery_metadata_error | m_recovery_metadata_error_status |
Recovery metadata receive error status. More... | |
mysql_mutex_t | m_recovery_metadata_receive_lock |
mysql_cond_t | m_recovery_metadata_receive_waiting_condition |
|
strong |
Recovery_module::Recovery_module | ( | Applier_module_interface * | applier, |
Channel_observation_manager * | channel_obsr_mngr | ||
) |
Recovery_module constructor.
applier | reference to the applier |
channel_obsr_mngr | reference to the channel hooks observation manager |
Recovery_module::~Recovery_module | ( | ) |
void Recovery_module::awake_recovery_metadata_suspension | ( | bool | error = false | ) |
Awakes recovery thd, waiting for the donor to send recovery metadata.
If send recovery metadata fails it sets the error, so that waiting recovery thd unblocks and stops with error, otherwise on successful receive of recovery metadata it awakes waiting recovery thd without error.
error | Error status in recovery metadata fetching. |
int Recovery_module::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 |
Cleans the recovery thread related options/structures.
void Recovery_module::delete_recovery_metadata_message | ( | ) |
Delete recovery metadata object.
|
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 |
bool Recovery_module::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 |
bool Recovery_module::is_vcle_enable | ( | ) |
Return the flag which determine if VCLE is enabled.
|
private |
Handles code for removing the member in case of a failure during recovery.
|
private |
Sends a message throughout the group stating the member as online.
int Recovery_module::recovery_thread_handle | ( | ) |
Recovery thread main execution method.
Here, the donor is selected, the connection to the donor is established, and several safe keeping assurances are guaranteed, such as the applier being suspended.
If recovery fails or is aborted, it never makes sense to awake the applier, as that would lead to the certification and execution of transactions on the wrong context.
|
inline |
|
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 public key automatically.
bool Recovery_module::set_recovery_metadata_message | ( | Recovery_metadata_message * | recovery_metadata_message | ) |
Set the recovery metadata message.
[in] | recovery_metadata_message | the recovery metadata message pointer. |
true | Error |
false | Success |
|
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.
|
private |
Sets the thread context.
|
inline |
Set TLS ciphersuites to be used.
|
inline |
Set TLS version to be used.
|
inline |
Set the option that forces the use of SSL on recovery connections.
|
inline |
Set compression level.
int Recovery_module::set_retrieved_cert_info | ( | void * | info | ) |
Set retrieved certification info from a group replication channel extracted from a given View_change event.
info | the given view_change_event |
0 | OK |
!=0 | Error |
|
inline |
Sets the recovery shutdown timeout.
[in] | timeout | the timeout |
void Recovery_module::set_vcle_enabled | ( | bool | is_vcle_enabled | ) |
Set the View ID on which the joiner joined.
is_vcle_enabled | the flag determine if View_change_log_event is enabled. |
int Recovery_module::start_recovery | ( | const std::string & | group_name, |
const std::string & | view_id | ||
) |
Starts the recovery process, initializing the recovery thread.
This method is designed to be as light as possible, as if it involved any major computation or wait process that would block the view change process delaying the group.
group_name | the joiner's group name |
view_id | the view id to use for the recovery. |
0 | OK |
!=0 | Error |
int Recovery_module::stop_recovery | ( | bool | wait_for_termination = true | ) |
Stops the recovery process, shutting down the recovery thread.
If the thread does not stop in a user designated time interval, a timeout is issued.
wait_for_termination | wait for thread termination or not |
0 | OK |
!=0 | Timeout |
void Recovery_module::suspend_recovery_metadata | ( | ) |
Suspend recovery thd, so that member can wait to receive the recovery metadata.
int Recovery_module::update_recovery_process | ( | bool | did_members_left, |
bool | is_leaving | ||
) |
This method decides what action to take when a member exits the group and executes it.
It can for the joiner: If it exited, then terminate the recovery process. 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 |
is_leaving | true if the member is leaving the group |
0 | OK |
!=0 | Error |
|
private |
Starts a wait process until the applier fulfills the necessary condition for the member to be acknowledge as being online.
0 | OK |
!=0 | Error |
|
private |
Starts a wait process until the recovery metadata is successfully send by the donor.
|
private |
|
private |
|
private |
Flag to determine if recovery should use VCLE.
|
private |
|
private |
Recovery metadata receive error status.
|
private |
Recovery metadata received on group members.
|
private |
|
private |
|
private |
|
private |
Error while fetching Recovery metadata.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |