24#ifndef REMOTE_CLONE_HANDLER_INCLUDED
25#define REMOTE_CLONE_HANDLER_INCLUDED
106 int clone_server(
const std::string &group_name,
const std::string &view_id);
152 const std::vector<Gcs_member_identifier> &leaving,
153 const std::vector<Gcs_member_identifier> &group,
154 bool is_leaving,
bool *skip_election,
156 std::string &suggested_primary)
override;
158 std::string primary_uuid,
162 const std::string &message_origin,
163 bool *skip_message)
override;
222 std::string &hostname, std::string &
port);
252 std::string &hostname, std::string &
port,
253 std::string &username, std::string &
password,
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
Class that others can extend to receive notifications about views and primary elections.
Definition: group_event_observer.h:40
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
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:35
mysql_cond_t m_run_cond
the cond_var used to signal the thread.
Definition: remote_clone_handler.h:299
ulonglong m_clone_activation_threshold
The threshold after which the clone process is invoked.
Definition: remote_clone_handler.h:313
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:635
int extract_donor_info(std::tuple< uint, uint, uint, bool > *donor_info)
Definition: remote_clone_handler.cc:153
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:475
enum_clone_check_result
The possible results when checking what is the recovery strategy.
Definition: remote_clone_handler.h:38
@ NO_RECOVERY_POSSIBLE
Definition: remote_clone_handler.h:42
@ DO_RECOVERY
Definition: remote_clone_handler.h:40
@ CLONE_CHECKS_END
Definition: remote_clone_handler.h:43
@ CHECK_ERROR
Definition: remote_clone_handler.h:41
@ DO_CLONE
Definition: remote_clone_handler.h:39
int evaluate_server_connection(Sql_service_command_interface *sql_command_interface)
Checks if the server connection was not killed.
Definition: remote_clone_handler.cc:549
enum_clone_query_status
What are the states of the clone execution query.
Definition: remote_clone_handler.h:143
@ CLONE_QUERY_EXECUTED
Definition: remote_clone_handler.h:146
@ CLONE_QUERY_EXECUTING
Definition: remote_clone_handler.h:145
@ CLONE_QUERY_NOT_EXECUTING
Definition: remote_clone_handler.h:144
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:583
bool m_being_terminated
Is the process being terminated.
Definition: remote_clone_handler.h:306
enum_clone_check_result check_clone_preconditions()
Check if clone or distributed recovery shall be used for provisioning.
Definition: remote_clone_handler.cc:271
std::string m_view_id
The view id when the clone started.
Definition: remote_clone_handler.h:288
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:449
void clone_thread_handle()
The clone thread process.
Definition: remote_clone_handler.cc:658
mysql_mutex_t m_donor_list_lock
the mutex for donor list accesses.
Definition: remote_clone_handler.h:316
my_thread_handle m_thd_handle
the thread handle.
Definition: remote_clone_handler.h:295
void set_clone_threshold(ulonglong threshold)
Set the class threshold for clone activation.
Definition: remote_clone_handler.h:63
Remote_clone_handler(ulonglong threshold, ulong components_stop_timeout)
Constructor for the remote cloning handler.
Definition: remote_clone_handler.cc:35
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:123
int kill_clone_query()
Kill the current query executing a clone.
Definition: remote_clone_handler.cc:516
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:105
~Remote_clone_handler() override
The destructor.
Definition: remote_clone_handler.cc:57
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:72
void get_clone_donors(std::list< Group_member_info * > &suitable_donors)
Get all the valid members for cloning.
Definition: remote_clone_handler.cc:341
std::string m_group_name
The group to which the recovering member belongs.
Definition: remote_clone_handler.h:286
enum_clone_query_status m_clone_query_status
What is the status on the read only mode enabling query.
Definition: remote_clone_handler.h:308
mysql_mutex_t m_run_lock
the mutex for controlling access to the thread itself.
Definition: remote_clone_handler.h:297
std::list< Group_member_info * > m_suitable_donors
The list of available donors.
Definition: remote_clone_handler.h:319
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:368
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:130
thread_state m_clone_process_thd_state
the state of the thread.
Definition: remote_clone_handler.h:293
ulong m_stop_wait_timeout
Timeout on shutdown.
Definition: remote_clone_handler.h:325
void terminate_clone_process(bool rejoin)
Terminate the clone process.
Definition: remote_clone_handler.cc:563
mysql_mutex_t m_clone_query_lock
the mutex for the clone process query.
Definition: remote_clone_handler.h:301
int fallback_to_recovery_or_leave(bool critical_error=false)
In error fall back to recovery or error out.
Definition: remote_clone_handler.cc:396
THD * m_clone_thd
the THD handle.
Definition: remote_clone_handler.h:291
mysql_mutex_t m_clone_read_mode_lock
the mutex for the clone external running status/read mode
Definition: remote_clone_handler.h:303
static void * launch_thread(void *arg)
The thread callback passed onto mysql_thread_create.
Definition: remote_clone_handler.cc:30
unsigned long m_clone_query_session_id
The session id for the clone query.
Definition: remote_clone_handler.h:310
enum_clone_presence_query_result check_clone_plugin_presence()
Check if clone plugin is present.
Definition: remote_clone_handler.cc:117
enum_clone_presence_query_result
What is the result when we check if the clone plugin is present.
Definition: remote_clone_handler.h:136
@ CLONE_CHECK_QUERY_ERROR
Definition: remote_clone_handler.h:139
@ CLONE_PLUGIN_NOT_PRESENT
Definition: remote_clone_handler.h:137
@ CLONE_PLUGIN_PRESENT
Definition: remote_clone_handler.h:138
Gcs_member_identifier * m_current_donor_address
The current donor address.
Definition: remote_clone_handler.h:322
void gr_clone_debug_point()
Function for debug points.
Definition: remote_clone_handler.cc:644
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:111
Definition: sql_service_command.h:195
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
unsigned long long int ulonglong
Definition: my_inttypes.h:56
static char * password
Definition: mysql_secure_installation.cc:58
enum_primary_election_mode
Enum for election types.
Definition: primary_election_include.h:33
enum_primary_election_primary_change_status
Enum for primary change status.
Definition: primary_election_include.h:50
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
Definition: my_thread_bits.h:58
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: plugin_utils.h:48