MySQL  8.0.19
Source Code Documentation
Recovery_module Class Reference

#include <recovery.h>

Public Member Functions

 Recovery_module (Applier_module_interface *applier, Channel_observation_manager *channel_obsr_mngr, ulong components_stop_timeout)
 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 &rec_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_completion_policy (enum_recovery_completion_policies completion_policy)
 Sets recovery threshold policy on what to wait when handling transactions. 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...
 

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...
 

Private Attributes

my_thread_handle recovery_pthd
 
THDrecovery_thd
 
Applier_module_interfaceapplier_module
 
std::string group_name
 
Recovery_state_transfer recovery_state_transfer
 
thread_state recovery_thd_state
 
bool recovery_aborted
 
mysql_mutex_t run_lock
 
mysql_cond_t run_cond
 
enum_recovery_completion_policies recovery_completion_policy
 
ulong stop_wait_timeout
 

Constructor & Destructor Documentation

◆ Recovery_module()

Recovery_module::Recovery_module ( Applier_module_interface applier,
Channel_observation_manager channel_obsr_mngr,
ulong  components_stop_timeout 
)

Recovery_module constructor.

Parameters
applierreference to the applier
channel_obsr_mngrreference to the channel hooks observation manager
components_stop_timeouttimeout value for the recovery module during shutdown.

◆ ~Recovery_module()

Recovery_module::~Recovery_module ( )

Member Function Documentation

◆ clean_recovery_thread_context()

void Recovery_module::clean_recovery_thread_context ( )
private

Cleans the recovery thread related options/structures.

◆ get_recovery_base_ssl_options()

void Recovery_module::get_recovery_base_ssl_options ( std::string *  ssl_ca,
std::string *  ssl_cert,
std::string *  ssl_key 
)
inline

Get SSL options configured for recovery.

Parameters
[out]ssl_cathe ssl ca
[out]ssl_certthe ssl cert
[out]ssl_keythe ssl key

◆ get_recovery_use_ssl()

bool Recovery_module::get_recovery_use_ssl ( )
inline
Returns
Is recovery configured to use SSL

◆ is_own_event_channel()

bool Recovery_module::is_own_event_channel ( my_thread_id  id)

Checks if the given id matches the recovery applier thread.

Parameters
idthe thread id
Returns
if it belongs to a thread
Return values
truethe id matches a SQL or worker thread
falsethe id doesn't match any thread

◆ leave_group_on_recovery_failure()

void Recovery_module::leave_group_on_recovery_failure ( )
private

Handles code for removing the member in case of a failure during recovery.

◆ notify_group_recovery_end()

void Recovery_module::notify_group_recovery_end ( )
private

Sends a message throughout the group stating the member as online.

◆ recovery_thread_handle()

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.

◆ set_applier_module()

void Recovery_module::set_applier_module ( Applier_module_interface applier)
inline

◆ set_recovery_completion_policy()

void Recovery_module::set_recovery_completion_policy ( enum_recovery_completion_policies  completion_policy)
inline

Sets recovery threshold policy on what to wait when handling transactions.

Parameters
completion_policyif recovery shall wait for execution or certification

◆ set_recovery_compression_algorithm()

void Recovery_module::set_recovery_compression_algorithm ( const char *  name)
inline

Set compression algorithm.

◆ set_recovery_donor_reconnect_interval()

void Recovery_module::set_recovery_donor_reconnect_interval ( ulong  reconnect_interval)
inline

Sets the sleep time between connection attempts to all possible donors.

◆ set_recovery_donor_retry_count()

void Recovery_module::set_recovery_donor_retry_count ( ulong  retry_count)
inline

Sets the number of times recovery tries to connect to a given donor.

◆ set_recovery_get_public_key()

void Recovery_module::set_recovery_get_public_key ( bool  set)
inline

Get public key automatically.

◆ set_recovery_public_key_path()

void Recovery_module::set_recovery_public_key_path ( const char *  public_key_path)
inline

Set a public key file.

◆ set_recovery_ssl_ca()

void Recovery_module::set_recovery_ssl_ca ( const char *  ssl_ca)
inline

Set a SSL trusted certificate authorities file.

◆ set_recovery_ssl_capath()

void Recovery_module::set_recovery_ssl_capath ( const char *  ssl_capath)
inline

Set a folder with SSL trusted CA files.

◆ set_recovery_ssl_cert()

void Recovery_module::set_recovery_ssl_cert ( const char *  ssl_cert)
inline

Set a SSL certificate for connection.

◆ set_recovery_ssl_cipher()

void Recovery_module::set_recovery_ssl_cipher ( const char *  ssl_cipher)
inline

Set a SSL ciphers to be used.

◆ set_recovery_ssl_crl()

void Recovery_module::set_recovery_ssl_crl ( const char *  ssl_crl)
inline

Set a SSL revocation list file.

◆ set_recovery_ssl_crlpath()

void Recovery_module::set_recovery_ssl_crlpath ( const char *  ssl_crlpath)
inline

Set a folder with SSL revocation list files.

◆ set_recovery_ssl_key()

void Recovery_module::set_recovery_ssl_key ( const char *  ssl_key)
inline

Set a SSL key for connections.

◆ set_recovery_ssl_options()

void Recovery_module::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 
)
inline

Sets all the SSL option to use on recovery.

Parameters
use_sslforce the use of SSL on recovery connections
ssl_caSSL trusted certificate authorities file
ssl_capatha directory with trusted CA files
ssl_certthe certificate file for secure connections
ssl_cipherthe list of ciphers to use
ssl_keythe SSL key file
ssl_crlSSL revocation list file
ssl_crlpathpath with revocation list files
ssl_verify_server_certverify the hostname against the certificate
tls_versionthe list of TLS versions to use
tls_ciphersuitesthe list of TLS ciphersuites to use

◆ set_recovery_ssl_verify_server_cert()

void Recovery_module::set_recovery_ssl_verify_server_cert ( char  ssl_verify_server_cert)
inline

Set if recovery shall compare the used hostname against the certificate.

◆ set_recovery_thread_context()

void Recovery_module::set_recovery_thread_context ( )
private

Sets the thread context.

◆ set_recovery_tls_ciphersuites()

void Recovery_module::set_recovery_tls_ciphersuites ( const char *  tls_ciphersuites)
inline

Set TLS ciphersuites to be used.

◆ set_recovery_tls_version()

void Recovery_module::set_recovery_tls_version ( const char *  tls_version)
inline

Set TLS version to be used.

◆ set_recovery_use_ssl()

void Recovery_module::set_recovery_use_ssl ( char  use_ssl)
inline

Set the option that forces the use of SSL on recovery connections.

◆ set_recovery_zstd_compression_level()

void Recovery_module::set_recovery_zstd_compression_level ( uint  level)
inline

Set compression level.

◆ set_retrieved_cert_info()

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.

Parameters
infothe given view_change_event
Returns
the operation status
Return values
0OK
!=0Error

◆ set_stop_wait_timeout()

void Recovery_module::set_stop_wait_timeout ( ulong  timeout)
inline

Sets the recovery shutdown timeout.

Parameters
[in]timeoutthe timeout

◆ start_recovery()

int Recovery_module::start_recovery ( const std::string &  group_name,
const std::string &  rec_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.

Note
this method only returns when the recovery thread is already running
Parameters
group_namethe joiner's group name
rec_view_idthe new view id
Returns
the operation status
Return values
0OK
!=0Error

◆ stop_recovery()

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.

Parameters
wait_for_terminationwait for thread termination or not
Note
this method only returns when the thread is stopped or on timeout
Returns
the operation status
Return values
0OK
!=0Timeout

◆ update_recovery_process()

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.

Parameters
did_members_leftstates if members left the view
is_leavingtrue if the member is leaving the group
Returns
the operation status
Return values
0OK
!=0Error

◆ wait_for_applier_module_recovery()

int Recovery_module::wait_for_applier_module_recovery ( )
private

Starts a wait process until the applier fulfills the necessary condition for the member to be acknowledge as being online.

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

Member Data Documentation

◆ applier_module

Applier_module_interface* Recovery_module::applier_module
private

◆ group_name

std::string Recovery_module::group_name
private

◆ recovery_aborted

bool Recovery_module::recovery_aborted
private

◆ recovery_completion_policy

enum_recovery_completion_policies Recovery_module::recovery_completion_policy
private

◆ recovery_pthd

my_thread_handle Recovery_module::recovery_pthd
private

◆ recovery_state_transfer

Recovery_state_transfer Recovery_module::recovery_state_transfer
private

◆ recovery_thd

THD* Recovery_module::recovery_thd
private

◆ recovery_thd_state

thread_state Recovery_module::recovery_thd_state
private

◆ run_cond

mysql_cond_t Recovery_module::run_cond
private

◆ run_lock

mysql_mutex_t Recovery_module::run_lock
private

◆ stop_wait_timeout

ulong Recovery_module::stop_wait_timeout
private

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