23#ifndef REMOTE_CLONE_HANDLER_INCLUDED
24#define REMOTE_CLONE_HANDLER_INCLUDED
105 int clone_server(
const std::string &group_name,
const std::string &view_id);
151 const std::vector<Gcs_member_identifier> &leaving,
152 const std::vector<Gcs_member_identifier> &group,
153 bool is_leaving,
bool *skip_election,
155 std::string &suggested_primary)
override;
157 std::string primary_uuid,
161 const std::string &message_origin,
162 bool *skip_message)
override;
221 std::string &hostname, std::string &
port);
251 std::string &hostname, std::string &
port,
252 std::string &username, std::string &
password,
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:39
Class that others can extend to receive notifications about views and primary elections.
Definition: group_event_observer.h:39
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:63
Class that hold the logic to decide if we should or not execute a clone operation and the logic to la...
Definition: remote_clone_handler.h:34
mysql_cond_t m_run_cond
the cond_var used to signal the thread.
Definition: remote_clone_handler.h:298
ulonglong m_clone_activation_threshold
The threshold after which the clone process is invoked.
Definition: remote_clone_handler.h:312
bool evaluate_error_code(int error_code)
Given a error code it evaluates if the error is critical or not.
Definition: remote_clone_handler.cc:641
int extract_donor_info(std::tuple< uint, uint, uint, bool > *donor_info)
Definition: remote_clone_handler.cc:151
int run_clone_query(Sql_service_command_interface *sql_command_interface, std::string &hostname, std::string &port, std::string &username, std::string &password, bool use_ssl)
Executes the query to remotely clone a server.
Definition: remote_clone_handler.cc:481
enum_clone_check_result
The possible results when checking what is the recovery strategy.
Definition: remote_clone_handler.h:37
@ NO_RECOVERY_POSSIBLE
Definition: remote_clone_handler.h:41
@ DO_RECOVERY
Definition: remote_clone_handler.h:39
@ CLONE_CHECKS_END
Definition: remote_clone_handler.h:42
@ CHECK_ERROR
Definition: remote_clone_handler.h:40
@ DO_CLONE
Definition: remote_clone_handler.h:38
int evaluate_server_connection(Sql_service_command_interface *sql_command_interface)
Checks if the server connection was not killed.
Definition: remote_clone_handler.cc:555
enum_clone_query_status
What are the states of the clone execution query.
Definition: remote_clone_handler.h:142
@ CLONE_QUERY_EXECUTED
Definition: remote_clone_handler.h:145
@ CLONE_QUERY_EXECUTING
Definition: remote_clone_handler.h:144
@ CLONE_QUERY_NOT_EXECUTING
Definition: remote_clone_handler.h:143
int clone_server(const std::string &group_name, const std::string &view_id)
Launch the clone process with some preliminary checks.
Definition: remote_clone_handler.cc:589
bool m_being_terminated
Is the process being terminated.
Definition: remote_clone_handler.h:305
enum_clone_check_result check_clone_preconditions()
Check if clone or distributed recovery shall be used for provisioning.
Definition: remote_clone_handler.cc:275
std::string m_view_id
The view id when the clone started.
Definition: remote_clone_handler.h:287
int update_donor_list(Sql_service_command_interface *sql_command_interface, std::string &hostname, std::string &port)
Executes the query to change the allowed donor list for clone.
Definition: remote_clone_handler.cc:455
void clone_thread_handle()
The clone thread process.
Definition: remote_clone_handler.cc:664
mysql_mutex_t m_donor_list_lock
the mutex for donor list accesses.
Definition: remote_clone_handler.h:315
my_thread_handle m_thd_handle
the thread handle.
Definition: remote_clone_handler.h:294
void set_clone_threshold(ulonglong threshold)
Set the class threshold for clone activation.
Definition: remote_clone_handler.h:62
Remote_clone_handler(ulonglong threshold, ulong components_stop_timeout)
Constructor for the remote cloning handler.
Definition: remote_clone_handler.cc:33
void lock_gr_clone_read_mode_lock()
Lock when trying to set the read mode and a clone might be running.
Definition: remote_clone_handler.h:122
int kill_clone_query()
Kill the current query executing a clone.
Definition: remote_clone_handler.cc:522
int after_primary_election(std::string primary_uuid, enum_primary_election_primary_change_status primary_change_status, enum_primary_election_mode election_mode, int error) override
Executed after primary election.
Definition: remote_clone_handler.cc:103
~Remote_clone_handler() override
The destructor.
Definition: remote_clone_handler.cc:55
int after_view_change(const std::vector< Gcs_member_identifier > &joining, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &group, bool is_leaving, bool *skip_election, enum_primary_election_mode *election_mode, std::string &suggested_primary) override
Executed after view install and before primary election.
Definition: remote_clone_handler.cc:70
void get_clone_donors(std::list< Group_member_info * > &suitable_donors)
Get all the valid members for cloning.
Definition: remote_clone_handler.cc:345
std::string m_group_name
The group to which the recovering member belongs.
Definition: remote_clone_handler.h:285
enum_clone_query_status m_clone_query_status
What is the status on the read only mode enabling query.
Definition: remote_clone_handler.h:307
mysql_mutex_t m_run_lock
the mutex for controlling access to the thread itself.
Definition: remote_clone_handler.h:296
std::list< Group_member_info * > m_suitable_donors
The list of available donors.
Definition: remote_clone_handler.h:318
int set_clone_ssl_options(Sql_service_command_interface *sql_command_interface)
Configure the SSL options for the clone plugin.
Definition: remote_clone_handler.cc:374
void unlock_gr_clone_read_mode_lock()
Unlock when trying to set the read mode and a clone might be running.
Definition: remote_clone_handler.h:129
thread_state m_clone_process_thd_state
the state of the thread.
Definition: remote_clone_handler.h:292
ulong m_stop_wait_timeout
Timeout on shutdown.
Definition: remote_clone_handler.h:324
void terminate_clone_process(bool rejoin)
Terminate the clone process.
Definition: remote_clone_handler.cc:569
mysql_mutex_t m_clone_query_lock
the mutex for the clone process query.
Definition: remote_clone_handler.h:300
int fallback_to_recovery_or_leave(bool critical_error=false)
In error fall back to recovery or error out.
Definition: remote_clone_handler.cc:402
THD * m_clone_thd
the THD handle.
Definition: remote_clone_handler.h:290
mysql_mutex_t m_clone_read_mode_lock
the mutex for the clone external running status/read mode
Definition: remote_clone_handler.h:302
static void * launch_thread(void *arg)
The thread callback passed onto mysql_thread_create.
Definition: remote_clone_handler.cc:28
unsigned long m_clone_query_session_id
The session id for the clone query.
Definition: remote_clone_handler.h:309
enum_clone_presence_query_result check_clone_plugin_presence()
Check if clone plugin is present.
Definition: remote_clone_handler.cc:115
enum_clone_presence_query_result
What is the result when we check if the clone plugin is present.
Definition: remote_clone_handler.h:135
@ CLONE_CHECK_QUERY_ERROR
Definition: remote_clone_handler.h:138
@ CLONE_PLUGIN_NOT_PRESENT
Definition: remote_clone_handler.h:136
@ CLONE_PLUGIN_PRESENT
Definition: remote_clone_handler.h:137
Gcs_member_identifier * m_current_donor_address
The current donor address.
Definition: remote_clone_handler.h:321
void gr_clone_debug_point()
Function for debug points.
Definition: remote_clone_handler.cc:650
int before_message_handling(const Plugin_gcs_message &message, const std::string &message_origin, bool *skip_message) override
Executed before the message is processed.
Definition: remote_clone_handler.cc:109
Definition: sql_service_command.h:194
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:49
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:56
unsigned long long int ulonglong
Definition: my_inttypes.h:55
static char * password
Definition: mysql_secure_installation.cc:57
enum_primary_election_mode
Enum for election types.
Definition: primary_election_include.h:32
enum_primary_election_primary_change_status
Enum for primary change status.
Definition: primary_election_include.h:49
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:32
Definition: my_thread_bits.h:57
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
Definition: plugin_utils.h:47