24#ifndef RECOVERY_STATE_TRANSFER_INCLUDE
25#define RECOVERY_STATE_TRANSFER_INCLUDE
66 void initialize(
const std::string &rec_view_id);
104 const char *ssl_capath,
const char *ssl_cert,
105 const char *ssl_cipher,
const char *ssl_key,
106 const char *ssl_crl,
const char *ssl_crlpath,
108 char *tls_ciphersuites) {
172 if (
nullptr == tls_ciphersuites) {
177 strlen(tls_ciphersuites) + 1);
194 std::string *ssl_key) {
211 if (public_key_path !=
nullptr) {
213 strlen(public_key_path) + 1);
367 bool purge_logs =
true);
A class to register observers for channel state events.
Definition: channel_observation_manager.h:131
A interface class to code channel state response methods.
Definition: channel_observation_manager.h:38
Definition: member_info.h:81
Definition: stage_monitor_handler.h:30
Definition: recovery_state_transfer.h:45
char recovery_tls_ciphersuites[FN_REFLEN]
Definition: recovery_state_transfer.h:447
bool recovery_tls_ciphersuites_null
Permitted TLS 1.3 ciphersuites.
Definition: recovery_state_transfer.h:446
void set_recovery_donor_reconnect_interval(ulong reconnect_interval)
Sets the sleep time between connection attempts to all possible donors.
Definition: recovery_state_transfer.h:84
bool on_failover
Definition: recovery_state_transfer.h:406
void initialize(const std::string &rec_view_id)
Initialize the state transfer class and reset the class flags.
Definition: recovery_state_transfer.cc:101
void set_recovery_donor_retry_count(ulong retry_count)
Sets the number of times recovery tries to connect to a given donor.
Definition: recovery_state_transfer.h:79
bool recovery_get_public_key
Get public key.
Definition: recovery_state_transfer.h:424
int update_recovery_process(bool did_members_left)
This method decides what action to take when a member exits the group.
Definition: recovery_state_transfer.cc:217
void set_recovery_ssl_capath(const char *ssl_capath)
Set a folder with SSL trusted CA files.
Definition: recovery_state_transfer.h:131
~Recovery_state_transfer()
Definition: recovery_state_transfer.cc:84
Group_member_info_list * group_members
Definition: recovery_state_transfer.h:392
Group_member_info * selected_donor
Definition: recovery_state_transfer.h:388
mysql_cond_t recovery_condition
Definition: recovery_state_transfer.h:452
uint recovery_zstd_compression_level
Definition: recovery_state_transfer.h:462
State_transfer_status state_transfer(Plugin_stage_monitor_handler &stage_handler)
Execute state transfer.
Definition: recovery_state_transfer.cc:659
bool donor_channel_thread_error
Definition: recovery_state_transfer.h:408
long donor_reconnect_interval
Definition: recovery_state_transfer.h:458
void set_recovery_ssl_cipher(const char *ssl_cipher)
Set a SSL ciphers to be used.
Definition: recovery_state_transfer.h:141
Channel_observation_manager * channel_observation_manager
Definition: recovery_state_transfer.h:416
bool initialize_connection_parameters()
Initializes the connection parameters for the donor connection.
int establish_donor_connection()
Establish a master/slave connection to the selected donor.
Definition: recovery_state_transfer.cc:381
bool connected_to_donor
Definition: recovery_state_transfer.h:404
long max_connection_attempts_to_donors
Definition: recovery_state_transfer.h:456
Replication_thread_api donor_connection_interface
Interface class to interact with the donor connection threads.
Definition: recovery_state_transfer.h:413
State_transfer_status terminate_recovery_slave_threads(bool purge_logs=true)
Terminates the connection to the donor.
Definition: recovery_state_transfer.cc:611
char recovery_public_key_path[FN_REFLEN]
Public key information.
Definition: recovery_state_transfer.h:442
void set_recovery_tls_version(const char *tls_version)
Set a TLS versions to be used.
Definition: recovery_state_transfer.h:166
void set_recovery_ssl_ca(const char *ssl_ca)
Set a SSL trusted certificate authorities file.
Definition: recovery_state_transfer.h:126
void set_recovery_use_ssl(char use_ssl)
Set the option that forces the use of SSL on recovery connections.
Definition: recovery_state_transfer.h:123
int start_recovery_donor_threads()
Starts the recovery slave threads to receive data from the donor.
Definition: recovery_state_transfer.cc:536
char recovery_ssl_capath[FN_REFLEN]
The configured directory that contains trusted SSL CA files.
Definition: recovery_state_transfer.h:428
long donor_connection_retry_count
Definition: recovery_state_transfer.h:397
Recovery_state_transfer(char *recovery_channel_name, const std::string &member_uuid, Channel_observation_manager *channel_obsr_mngr)
Recovery state transfer constructor.
Definition: recovery_state_transfer.cc:41
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.
Definition: recovery_state_transfer.h:103
char recovery_ssl_crl[FN_REFLEN]
The configured SSL file containing certificate revocation lists.
Definition: recovery_state_transfer.h:436
void donor_failover()
Method that sets the failover status to true and awakes recovery.
Definition: recovery_state_transfer.cc:298
int initialize_donor_connection(std::string hostname, uint port)
Initializes the structures for the donor connection threads.
Definition: recovery_state_transfer.cc:494
Channel_state_observer * recovery_channel_observer
Definition: recovery_state_transfer.h:419
void set_recovery_ssl_cert(const char *ssl_cert)
Set a SSL certificate for connection.
Definition: recovery_state_transfer.h:136
char recovery_ssl_cipher[FN_REFLEN]
The configured SSL list of permissible ciphers to use for encryption.
Definition: recovery_state_transfer.h:432
void set_recovery_tls_ciphersuites(const char *tls_ciphersuites)
Set a TLS ciphersuites to be used.
Definition: recovery_state_transfer.h:171
char recovery_ssl_crlpath[FN_REFLEN]
The configured directory that contains certificate revocation list files.
Definition: recovery_state_transfer.h:438
int check_recovery_thread_status()
Checks to see if the recovery IO/SQL thread is still running, probably caused by an timeout on shutdo...
Definition: recovery_state_transfer.cc:308
void inform_of_receiver_stop(my_thread_id thread_id)
Method that informs recovery that the donor channel receiver was stopped.
Definition: recovery_state_transfer.cc:145
bool is_own_event_channel(my_thread_id id)
Checks if the given id matches the recovery applier thread.
Definition: recovery_state_transfer.cc:319
void set_recovery_zstd_compression_level(uint level)
Set compression level.
Definition: recovery_state_transfer.h:226
void end_state_transfer()
Signals that the data was received so the process can end.
Definition: recovery_state_transfer.cc:289
char recovery_ssl_key[FN_REFLEN]
The configured SSL key file to use for establishing a secure connection.
Definition: recovery_state_transfer.h:434
void build_donor_list(std::string *selected_donor)
Based on the group list, build a random order list with all suitable donors.
Definition: recovery_state_transfer.cc:324
std::string member_uuid
Definition: recovery_state_transfer.h:383
char recovery_tls_version[FN_REFLEN]
Permitted TLS versions.
Definition: recovery_state_transfer.h:444
bool recovery_use_ssl
If the use of SSL is obligatory on recovery connections.
Definition: recovery_state_transfer.h:422
char recovery_ssl_ca[FN_REFLEN]
The configured SSL trusted certificate authorities file.
Definition: recovery_state_transfer.h:426
Group_member_info_list suitable_donors
Definition: recovery_state_transfer.h:394
void update_group_membership(bool update_donor)
Removes the old list of group members and enquires about the current members.
Definition: recovery_state_transfer.cc:179
bool recovery_aborted
Definition: recovery_state_transfer.h:400
void set_recovery_ssl_key(const char *ssl_key)
Set a SSL key for connections.
Definition: recovery_state_transfer.h:146
void set_recovery_ssl_crl(const char *ssl_crl)
Set a SSL revocation list file.
Definition: recovery_state_transfer.h:151
void set_recovery_get_public_key(bool set)
Get preference to get public key.
Definition: recovery_state_transfer.h:218
void initialize_group_info()
This method initializes the group membership info.
Definition: recovery_state_transfer.cc:167
bool get_recovery_use_ssl()
Definition: recovery_state_transfer.h:184
bool recovery_ssl_verify_server_cert
If the server's Common Name value checks against donor sent certificate.
Definition: recovery_state_transfer.h:440
std::string view_id
Definition: recovery_state_transfer.h:385
std::string selected_donor_hostname
Definition: recovery_state_transfer.h:390
void set_stop_wait_timeout(ulong timeout)
Sets the recovery shutdown timeout.
Definition: recovery_state_transfer.h:205
char recovery_compression_algorithm[COMPRESSION_ALGORITHM_NAME_LENGTH_MAX]
Definition: recovery_state_transfer.h:460
void set_recovery_public_key_path(const char *public_key_path)
Set a public key file.
Definition: recovery_state_transfer.h:210
mysql_mutex_t recovery_lock
Definition: recovery_state_transfer.h:450
bool donor_transfer_finished
Definition: recovery_state_transfer.h:402
void inform_of_applier_stop(my_thread_id thread_id, bool aborted)
Method that informs recovery that the donor channel applier was stopped.
Definition: recovery_state_transfer.cc:119
void set_recovery_ssl_crlpath(const char *ssl_crlpath)
Set a folder with SSL revocation list files.
Definition: recovery_state_transfer.h:156
void get_recovery_base_ssl_options(std::string *ssl_ca, std::string *ssl_cert, std::string *ssl_key)
Get SSL options configured for recovery.
Definition: recovery_state_transfer.h:193
void abort_state_transfer()
Abort the state transfer.
Definition: recovery_state_transfer.cc:207
void set_recovery_ssl_verify_server_cert(char ssl_verify_server_cert)
Set if recovery shall compare the used hostname against the certificate.
Definition: recovery_state_transfer.h:161
char recovery_ssl_cert[FN_REFLEN]
The configured SSL certificate file to use for a secure connection.
Definition: recovery_state_transfer.h:430
void set_recovery_compression_algorithm(const char *name)
Set compression algorithm.
Definition: recovery_state_transfer.h:221
int purge_recovery_slave_threads_repos()
Purges relay logs and the master info object.
Definition: recovery_state_transfer.cc:633
mysql_mutex_t donor_selection_lock
Definition: recovery_state_transfer.h:453
Definition: replication_threads_api.h:37
void set_stop_wait_timeout(ulong timeout)
Sets the threads shutdown timeout.
Definition: replication_threads_api.h:288
#define COMPRESSION_ALGORITHM_NAME_LENGTH_MAX
Definition: compression.h:40
std::vector< Group_member_info *, Malloc_allocator< Group_member_info * > > Group_member_info_list
Definition: member_info.h:735
Common #defines and includes for file and socket I/O.
#define FN_REFLEN
Definition: my_io.h:83
static my_thread_id thread_id
Definition: my_thr_init.cc:63
uint32 my_thread_id
Definition: my_thread_local.h:34
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:496
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2883
static char recovery_channel_name[]
The relay log name.
Definition: recovery.cc:45
enum st_state_transfer_status State_transfer_status
st_state_transfer_status
Definition: recovery_state_transfer.h:38
@ STATE_TRANSFER_OK
Definition: recovery_state_transfer.h:39
@ STATE_TRANSFER_STOP
Definition: recovery_state_transfer.h:40
@ STATE_TRANSFER_PURGE
Definition: recovery_state_transfer.h:41
@ STATE_TRANSFER_NO_CONNECTION
Definition: recovery_state_transfer.h:42
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
case opt name
Definition: sslopt-case.h:33
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
unsigned int uint
Definition: uca9-dump.cc:75
int ssl_verify_server_cert(SSL *ssl, const char *server_hostname)