![]()  | 
  
    MySQL 8.0.44
    
   Source Code Documentation 
   | 
 
Class that hold the logic to decide if we should or not execute a clone operation and the logic to launch it. More...
#include <remote_clone_handler.h>
Public Types | |
| enum | enum_clone_check_result {  DO_CLONE = 0 , DO_RECOVERY = 1 , CHECK_ERROR = 2 , NO_RECOVERY_POSSIBLE = 3 , CLONE_CHECKS_END = 4 }  | 
| The possible results when checking what is the recovery strategy.  More... | |
Public Member Functions | |
| Remote_clone_handler (ulonglong threshold, ulong components_stop_timeout) | |
| Constructor for the remote cloning handler.  More... | |
| ~Remote_clone_handler () override | |
| The destructor.  More... | |
| void | set_clone_threshold (ulonglong threshold) | 
| Set the class threshold for clone activation.  More... | |
| int | extract_donor_info (std::tuple< uint, uint, uint, bool > *donor_info) | 
| enum_clone_check_result | check_clone_preconditions () | 
| Check if clone or distributed recovery shall be used for provisioning.  More... | |
| int | clone_server (const std::string &group_name, const std::string &view_id) | 
| Launch the clone process with some preliminary checks.  More... | |
| void | terminate_clone_process (bool rejoin) | 
| Terminate the clone process.  More... | |
| void | lock_gr_clone_read_mode_lock () | 
| Lock when trying to set the read mode and a clone might be running.  More... | |
| void | unlock_gr_clone_read_mode_lock () | 
| Unlock when trying to set the read mode and a clone might be running.  More... | |
  Public Member Functions inherited from Group_event_observer | |
| virtual | ~Group_event_observer ()=0 | 
Private Types | |
| enum | enum_clone_presence_query_result { CLONE_PLUGIN_NOT_PRESENT = 0 , CLONE_PLUGIN_PRESENT = 1 , CLONE_CHECK_QUERY_ERROR = 2 } | 
| What is the result when we check if the clone plugin is present.  More... | |
| enum | enum_clone_query_status { CLONE_QUERY_NOT_EXECUTING = 0 , CLONE_QUERY_EXECUTING = 1 , CLONE_QUERY_EXECUTED = 2 } | 
| What are the states of the clone execution query.  More... | |
Private Member Functions | |
| 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.  More... | |
| 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.  More... | |
| int | before_message_handling (const Plugin_gcs_message &message, const std::string &message_origin, bool *skip_message) override | 
| Executed before the message is processed.  More... | |
| void | clone_thread_handle () | 
| The clone thread process.  More... | |
| enum_clone_presence_query_result | check_clone_plugin_presence () | 
| Check if clone plugin is present.  More... | |
| void | get_clone_donors (std::list< Group_member_info * > &suitable_donors) | 
| Get all the valid members for cloning.  More... | |
| int | set_clone_ssl_options (Sql_service_command_interface *sql_command_interface) | 
| Configure the SSL options for the clone plugin.  More... | |
| int | fallback_to_recovery_or_leave (bool critical_error=false) | 
| In error fall back to recovery or error out.  More... | |
| 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.  More... | |
| int | evaluate_server_connection (Sql_service_command_interface *sql_command_interface) | 
| Checks if the server connection was not killed.  More... | |
| 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.  More... | |
| int | kill_clone_query () | 
| Kill the current query executing a clone.  More... | |
| bool | evaluate_error_code (int error_code) | 
| Given a error code it evaluates if the error is critical or not.  More... | |
| void | gr_clone_debug_point () | 
| Function for debug points.  More... | |
Static Private Member Functions | |
| static void * | launch_thread (void *arg) | 
| The thread callback passed onto mysql_thread_create.  More... | |
Private Attributes | |
| std::string | m_group_name | 
| The group to which the recovering member belongs.  More... | |
| std::string | m_view_id | 
| The view id when the clone started.  More... | |
| THD * | m_clone_thd | 
| the THD handle.  More... | |
| thread_state | m_clone_process_thd_state | 
| the state of the thread.  More... | |
| my_thread_handle | m_thd_handle | 
| the thread handle.  More... | |
| mysql_mutex_t | m_run_lock | 
| the mutex for controlling access to the thread itself.  More... | |
| mysql_cond_t | m_run_cond | 
| the cond_var used to signal the thread.  More... | |
| mysql_mutex_t | m_clone_query_lock | 
| the mutex for the clone process query.  More... | |
| mysql_mutex_t | m_clone_read_mode_lock | 
| the mutex for the clone external running status/read mode  More... | |
| bool | m_being_terminated | 
| Is the process being terminated.  More... | |
| enum_clone_query_status | m_clone_query_status | 
| What is the status on the read only mode enabling query.  More... | |
| unsigned long | m_clone_query_session_id | 
| The session id for the clone query.  More... | |
| ulonglong | m_clone_activation_threshold | 
| The threshold after which the clone process is invoked.  More... | |
| mysql_mutex_t | m_donor_list_lock | 
| the mutex for donor list accesses.  More... | |
| std::list< Group_member_info * > | m_suitable_donors | 
| The list of available donors.  More... | |
| Gcs_member_identifier * | m_current_donor_address | 
| The current donor address.  More... | |
| ulong | m_stop_wait_timeout | 
| Timeout on shutdown.  More... | |
Class that hold the logic to decide if we should or not execute a clone operation and the logic to launch it.
      
  | 
  private | 
| Remote_clone_handler::Remote_clone_handler | ( | ulonglong | threshold, | 
| ulong | components_stop_timeout | ||
| ) | 
Constructor for the remote cloning handler.
| threshold | The threshold for clone activation | 
| components_stop_timeout | The stop timeout in error cases | 
      
  | 
  override | 
The destructor.
      
  | 
  overrideprivatevirtual | 
Executed after primary election.
| primary_uuid | the elected primary | 
| primary_change_status | if the primary changed after the election | 
| election_mode | what was the election mode | 
| error | if there was and error on the process | 
Implements Group_event_observer.
      
  | 
  overrideprivatevirtual | 
Executed after view install and before primary election.
| joining | members joining the group | |
| leaving | members leaving the group | |
| group | members in the group | |
| is_leaving | is the member leaving | |
| [out] | skip_election | skip primary election on view | 
| [out] | election_mode | election mode | 
| [out] | suggested_primary | what should be the next primary to elect | 
Implements Group_event_observer.
      
  | 
  overrideprivatevirtual | 
Executed before the message is processed.
| message | The GCS message | |
| message_origin | The member that sent this message (address) | |
| [out] | skip_message | skip message handling if true | 
Implements Group_event_observer.
      
  | 
  private | 
Check if clone plugin is present.
| CLONE_PLUGIN_NOT_PRESENT | The plugin is not present or active | 
| CLONE_PLUGIN_PRESENT | The plugin is present and active | 
| CLONE_CHECK_QUERY_ERROR | There was an error when checking | 
| Remote_clone_handler::enum_clone_check_result Remote_clone_handler::check_clone_preconditions | ( | ) | 
Check if clone or distributed recovery shall be used for provisioning.
| DO_CLONE | Do a remote clone | 
| DO_RECOVERY | Don't clone, use distributed recovery | 
| CHECK_ERROR | Error when choosing the strategy | 
| NO_RECOVERY_POSSIBLE | No available members for clone or recovery | 
| int Remote_clone_handler::clone_server | ( | const std::string & | group_name, | 
| const std::string & | view_id | ||
| ) | 
Launch the clone process with some preliminary checks.
| group_name | The group name | 
| view_id | The view id when clone started | 
| 0 | the thread launched successfully | 
| != | 0 for some reason we did not launch the thread | 
      
  | 
  private | 
The clone thread process.
      
  | 
  private | 
Given a error code it evaluates if the error is critical or not.
Basically it tells us if there is still data in the server.
| [in] | error_code | the clone returned error | 
| true | error is critical | 
| false | error is not critical | 
      
  | 
  private | 
Checks if the server connection was not killed.
If so, establish a new one.
| [in] | sql_command_interface | the server connection | 
| 0 | yes | 
| != | 0 some error occurred | 
      
  | 
  private | 
In error fall back to recovery or error out.
| [in] | critical_error | the error prevent distributed recovery | 
Before falling back to recovery check if there are valid donors Since cloning can be time consuming valid members may have left or joined in the meanwhile.
      
  | 
  private | 
Get all the valid members for cloning.
| [out] | suitable_donors | the list of possible donors | 
      
  | 
  private | 
Function for debug points.
      
  | 
  private | 
Kill the current query executing a clone.
| 0 | the kill query was successful | 
| != | 0 some error occurred | 
      
  | 
  staticprivate | 
The thread callback passed onto mysql_thread_create.
| [in] | arg | a pointer to a Remote_clone_handler instance. | 
      
  | 
  inline | 
Lock when trying to set the read mode and a clone might be running.
      
  | 
  private | 
Executes the query to remotely clone a server.
| [in] | sql_command_interface | the connection to use | 
| [in] | hostname | the hostname to use | 
| [in] | port | the port to use | 
| [in] | username | the username to use | 
| [in] | password | the password to use | 
| [in] | use_ssl | make clone use SSL | 
| 0 | the clone was successful | 
| != | 0 some error occurred | 
      
  | 
  private | 
Configure the SSL options for the clone plugin.
| [in] | sql_command_interface | the connection to use | 
      
  | 
  inline | 
Set the class threshold for clone activation.
| threshold | The threshold for clone activation | 
| void Remote_clone_handler::terminate_clone_process | ( | bool | rejoin | ) | 
Terminate the clone process.
| rejoin | Are we terminating or rejoining in the plugin | 
      
  | 
  inline | 
Unlock when trying to set the read mode and a clone might be running.
      
  | 
  private | 
Executes the query to change the allowed donor list for clone.
| [in] | sql_command_interface | the connection to use | 
| [in] | hostname | the hostname to set | 
| [in] | port | the port to set | 
| 0 | the value was set | 
| != | 0 some error occurred | 
      
  | 
  private | 
Is the process being terminated.
      
  | 
  private | 
The threshold after which the clone process is invoked.
      
  | 
  private | 
the state of the thread.
      
  | 
  private | 
the mutex for the clone process query.
      
  | 
  private | 
The session id for the clone query.
      
  | 
  private | 
What is the status on the read only mode enabling query.
      
  | 
  private | 
the mutex for the clone external running status/read mode
      
  | 
  private | 
the THD handle.
      
  | 
  private | 
The current donor address.
      
  | 
  private | 
the mutex for donor list accesses.
      
  | 
  private | 
The group to which the recovering member belongs.
      
  | 
  private | 
the cond_var used to signal the thread.
      
  | 
  private | 
the mutex for controlling access to the thread itself.
      
  | 
  private | 
Timeout on shutdown.
      
  | 
  private | 
The list of available donors.
      
  | 
  private | 
the thread handle.
      
  | 
  private | 
The view id when the clone started.