![]()  | 
  
    MySQL 8.4.7
    
   Source Code Documentation 
   | 
 
#include <replication_threads_api.h>
Public Member Functions | |
| Replication_thread_api (const char *channel_interface) | |
| Replication_thread_api () | |
| ~Replication_thread_api ()=default | |
| void | set_channel_name (const char *channel_name) | 
| Set the channel name to be used on the interface method invocation.  More... | |
| int | initialize_channel (char *hostname, uint port, char *user, char *password, bool use_ssl, char *ssl_ca, char *ssl_capath, char *ssl_cert, char *ssl_cipher, char *ssl_key, char *ssl_crl, char *ssl_crlpath, bool ssl_verify_server_cert, int priority, int retry_count, bool preserve_logs, char *public_key_path, bool get_public_key, char *compression_algorithm, uint zstd_compression_level, char *tls_version, char *tls_ciphersuites, bool ignore_ws_mem_limit, bool allow_drop_write_set) | 
| Initializes a channel connection in a similar way to a change replication source command.  More... | |
| int | start_threads (bool start_receiver, bool start_applier, std::string *view_id, bool wait_for_connection, enum_channel_until_condition until_condition=CHANNEL_UNTIL_VIEW_ID) | 
| Start the Applier/Receiver threads according to the given options.  More... | |
| int | stop_threads (bool stop_receiver, bool stop_applier) | 
| Stops the channel threads according to the given options.  More... | |
| int | purge_logs (bool reset_all) | 
| Purges the relay logs.  More... | |
| bool | is_receiver_thread_running () | 
| Checks if the receiver thread is running.  More... | |
| bool | is_receiver_thread_stopping () | 
| Checks if the receiver thread is stopping.  More... | |
| bool | is_applier_thread_running () | 
| Checks if the applier thread is running.  More... | |
| bool | is_applier_thread_stopping () | 
| Checks if the applier thread is stopping.  More... | |
| int | queue_packet (const char *buf, ulong event_len) | 
| Queues a event packet into the current active channel relay log.  More... | |
| bool | is_applier_thread_waiting () | 
| Checks if the applier, and its workers when parallel applier is enabled, has already consumed all relay log, that is, applier is waiting for transactions to be queued.  More... | |
| int | wait_for_gtid_execution (double timeout) | 
| Checks if all the queued transactions were executed.  More... | |
| int | wait_for_gtid_execution (std::string &retrieved_set, double timeout, bool update_THD_status=true) | 
| Checks if all the set transactions were executed.  More... | |
| int | get_applier_thread_ids (unsigned long **thread_ids) | 
| Method to get applier ids from the configured channel.  More... | |
| bool | is_own_event_applier (my_thread_id id, const char *channel_name=nullptr) | 
| Checks if the given id matches any of the event applying threads for the configured channel.  More... | |
| bool | is_own_event_receiver (my_thread_id id) | 
| Checks if the given id matches the receiver thread for the configured channel.  More... | |
| rpl_gno | get_last_delivered_gno (rpl_sidno sidno) | 
| Returns last GNO from the applier for a given UUID.  More... | |
| void | set_stop_wait_timeout (ulong timeout) | 
| Sets the threads shutdown timeout.  More... | |
| bool | get_retrieved_gtid_set (std::string &retrieved_set, const char *channel_name=nullptr) | 
| Returns the retrieved gtid set from the receiver thread.  More... | |
| bool | is_partial_transaction_on_relay_log () | 
| Checks if the channel's relay log contains partial transaction.  More... | |
| bool | get_channel_credentials (std::string &username, std::string &password, const char *channel_name=nullptr) | 
| Method to get the credentials configured for a channel.  More... | |
| bool | get_channel_network_namespace (std::string &net_ns, const char *channel_name=nullptr) | 
| Method to get the network namespace configured for a channel.  More... | |
| bool | is_any_channel_using_uuid_for_assign_gtids_to_anonymous_transaction (const char *uuid_param) | 
| Checks if any channel uses the same UUID for assign_gtids_to_anonymous_transactions as the given uuid.  More... | |
Static Public Member Functions | |
| static int | rpl_channel_stop_all (int threads_to_stop, long timeout) | 
| Interface to Channel Service Interface channel_stop_all method.  More... | |
| static int | rpl_binlog_dump_thread_kill () | 
| Interface to kill binlog dump thread.  More... | |
| static int | delete_credential (const char *channel_name) | 
| Interface to remove stored credentials from thread api.  More... | |
Private Attributes | |
| ulong | stop_wait_timeout | 
| const char * | interface_channel | 
| Replication_thread_api::Replication_thread_api | ( | const char * | channel_interface | ) | 
| Replication_thread_api::Replication_thread_api | ( | ) | 
      
  | 
  default | 
      
  | 
  static | 
Interface to remove stored credentials from thread api.
Removes credentials for the channel from thread api.
| channel_name | Credential associated channel name | 
| 0 | OK | 
| !=0 | Error | 
| int Replication_thread_api::get_applier_thread_ids | ( | unsigned long ** | thread_ids | ) | 
Method to get applier ids from the configured channel.
| [out] | thread_ids | The retrieved thread ids. | 
| <= | 0 Some error occurred or the applier is not present | 
| > | 0 Number of appliers | 
| bool Replication_thread_api::get_channel_credentials | ( | std::string & | username, | 
| std::string & | password, | ||
| const char * | channel_name = nullptr  | 
        ||
| ) | 
Method to get the credentials configured for a channel.
| [out] | username | The user to extract | 
| [out] | password | The password to extract | 
| [in] | channel_name | The name of the channel to get the information. | 
| false | OK | 
| true | Error, channel not found | 
| bool Replication_thread_api::get_channel_network_namespace | ( | std::string & | net_ns, | 
| const char * | channel_name = nullptr  | 
        ||
| ) | 
Method to get the network namespace configured for a channel.
| [out] | net_ns | The network namespace to extract | 
| [in] | channel_name | The name of the channel to get the information. | 
| false | OK | 
| true | Error, channel not found | 
Returns last GNO from the applier for a given UUID.
| sidno | the SIDNO of the group UUID, so that we get the last GNO of group's already certified transactions on relay log. | 
| GNO | value | 
| bool Replication_thread_api::get_retrieved_gtid_set | ( | std::string & | retrieved_set, | 
| const char * | channel_name = nullptr  | 
        ||
| ) | 
Returns the retrieved gtid set from the receiver thread.
| [out] | retrieved_set | the set in string format. | 
| channel_name | the name of the channel to get the information. | 
| true | there was an error. | 
| false | the operation has succeeded. | 
| int Replication_thread_api::initialize_channel | ( | char * | hostname, | 
| uint | port, | ||
| char * | user, | ||
| char * | password, | ||
| bool | use_ssl, | ||
| char * | ssl_ca, | ||
| char * | ssl_capath, | ||
| char * | ssl_cert, | ||
| char * | ssl_cipher, | ||
| char * | ssl_key, | ||
| char * | ssl_crl, | ||
| char * | ssl_crlpath, | ||
| bool | ssl_verify_server_cert, | ||
| int | priority, | ||
| int | retry_count, | ||
| bool | preserve_logs, | ||
| char * | public_key_path, | ||
| bool | get_public_key, | ||
| char * | compression_algorithm, | ||
| uint | zstd_compression_level, | ||
| char * | tls_version, | ||
| char * | tls_ciphersuites, | ||
| bool | ignore_ws_mem_limit, | ||
| bool | allow_drop_write_set | ||
| ) | 
Initializes a channel connection in a similar way to a change replication source command.
| hostname | The channel hostname | 
| port | The channel port | 
| user | The user used in the receiver connection | 
| password | The password used in the receiver connection | 
| use_ssl | Force the use of SSL on recovery connections | 
| ssl_ca | SSL trusted certificate authorities file | 
| ssl_capath | A directory with trusted CA files | 
| ssl_cert | The certificate file for secure connections | 
| ssl_cipher | The list of ciphers to use | 
| ssl_key | The SSL key file | 
| ssl_crl | SSL revocation list file | 
| ssl_crlpath | Path with revocation list files | 
| ssl_verify_server_cert | verify the hostname against the certificate | 
| priority | The channel priority on event application | 
| retry_count | The number of retries when connecting | 
| preserve_logs | If logs should be always preserved | 
| public_key_path | The file with public key path information | 
| get_public_key | Preference to get public key if unavailable. | 
| compression_algorithm | The compression algorithm | 
| zstd_compression_level | The compression level | 
| tls_version | TLS versions | 
| tls_ciphersuites | Permissible ciphersuites for TLS 1.3. | 
| ignore_ws_mem_limit | Shall ignore write set mem limits | 
| allow_drop_write_set | Shall not require write set to be preserved | 
| 0 | OK | 
| !=0 | Error on channel creation | 
| bool Replication_thread_api::is_any_channel_using_uuid_for_assign_gtids_to_anonymous_transaction | ( | const char * | uuid_param | ) | 
Checks if any channel uses the same UUID for assign_gtids_to_anonymous_transactions as the given uuid.
| [in] | uuid_param | the group name | 
| true | at least one channel has the same uuid | 
| false | none of the the channels have the same uuid | 
| bool Replication_thread_api::is_applier_thread_running | ( | ) | 
Checks if the applier thread is running.
| true | the thread is running | 
| false | the thread is stopped | 
| bool Replication_thread_api::is_applier_thread_stopping | ( | ) | 
Checks if the applier thread is stopping.
| true | the thread is stopping | 
| false | the thread is not stopping | 
| bool Replication_thread_api::is_applier_thread_waiting | ( | ) | 
Checks if the applier, and its workers when parallel applier is enabled, has already consumed all relay log, that is, applier is waiting for transactions to be queued.
| true | the applier is waiting | 
| false | otherwise | 
| bool Replication_thread_api::is_own_event_applier | ( | my_thread_id | id, | 
| const char * | channel_name = nullptr  | 
        ||
| ) | 
Checks if the given id matches any of the event applying threads for the configured channel.
| id | the thread id | 
| channel_name | the channel name which needs to be checked. It is an optional parameter. | 
| true | the id matches a SQL or worker thread | 
| false | the id doesn't match any thread | 
| bool Replication_thread_api::is_own_event_receiver | ( | my_thread_id | id | ) | 
Checks if the given id matches the receiver thread for the configured channel.
| id | the thread id | 
| true | the id matches an IO thread | 
| false | the id doesn't match any thread | 
| bool Replication_thread_api::is_partial_transaction_on_relay_log | ( | ) | 
Checks if the channel's relay log contains partial transaction.
| true | If relaylog contains partial transaction. | 
| false | If relaylog does not contain partial transaction. | 
| bool Replication_thread_api::is_receiver_thread_running | ( | ) | 
Checks if the receiver thread is running.
| true | the thread is running | 
| false | the thread is stopped | 
| bool Replication_thread_api::is_receiver_thread_stopping | ( | ) | 
Checks if the receiver thread is stopping.
| true | the thread is stopping | 
| false | the thread is not stopping | 
| int Replication_thread_api::purge_logs | ( | bool | reset_all | ) | 
Purges the relay logs.
| reset_all | If true, the method will purge logs and remove the channel If false, the channel logs will be deleted and recreated but the channel info will be preserved. | 
| 0 | OK | 
| !=0 | Error purging channel logs | 
| int Replication_thread_api::queue_packet | ( | const char * | buf, | 
| ulong | event_len | ||
| ) | 
Queues a event packet into the current active channel relay log.
| buf | the event buffer | 
| event_len | the event buffer length | 
| 0 | OK | 
| != | 0 Error on queue | 
      
  | 
  static | 
Interface to kill binlog dump thread.
Kills binlog dump thread thus killing all slave connections.
| 0 | OK | 
      
  | 
  static | 
Interface to Channel Service Interface channel_stop_all method.
Stops all the running channel threads according to the given options.
| threads_to_stop | The types of threads to be stopped | 
| timeout | The max time in which the thread should stop | 
| 0 | OK | 
| !=0 | Error | 
      
  | 
  inline | 
Set the channel name to be used on the interface method invocation.
| channel_name | the name to be used. | 
      
  | 
  inline | 
Sets the threads shutdown timeout.
| [in] | timeout | the timeout | 
| int Replication_thread_api::start_threads | ( | bool | start_receiver, | 
| bool | start_applier, | ||
| std::string * | view_id, | ||
| bool | wait_for_connection, | ||
| enum_channel_until_condition | until_condition = CHANNEL_UNTIL_VIEW_ID  | 
        ||
| ) | 
Start the Applier/Receiver threads according to the given options.
If the receiver thread is to be started, connection credential must be supported.
| start_receiver | Is the receiver thread to be started | 
| start_applier | Is the applier thread to be started | 
| view_id | The view id, that can be used to activate the until view id clause. | 
| wait_for_connection | If when starting the receiver, the method should wait for the connection to succeed | 
| until_condition | the replication until condition that can be applied to channels for the recovery. | 
| 0 | OK | 
| REPLICATION_THREAD_START_ERROR | Error when launching on of the threads | 
| REPLICATION_THREAD_START_IO_NOT_CONNECTED | Error when the threads start, but the IO thread cannot connect | 
| int Replication_thread_api::stop_threads | ( | bool | stop_receiver, | 
| bool | stop_applier | ||
| ) | 
Stops the channel threads according to the given options.
| stop_receiver | if the receiver thread should be stopped | 
| stop_applier | if the applier thread should be stopped | 
| 0 | OK | 
| !=0 | Error stopping channel thread | 
| int Replication_thread_api::wait_for_gtid_execution | ( | double | timeout | ) | 
Checks if all the queued transactions were executed.
| timeout | the time (seconds) after which the method returns if the above condition was not satisfied | 
| 0 | All transactions were executed | 
| REPLICATION_THREAD_WAIT_TIMEOUT_ERROR | A timeout occurred | 
| REPLICATION_THREAD_WAIT_NO_INFO_ERROR | An error occurred | 
| int Replication_thread_api::wait_for_gtid_execution | ( | std::string & | retrieved_set, | 
| double | timeout, | ||
| bool | update_THD_status = true  | 
        ||
| ) | 
Checks if all the set transactions were executed.
| retrieved_set | the set in string format of transaction to wait for | 
| timeout | the time (seconds) after which the method returns if the above condition was not satisfied | 
| update_THD_status | Shall the method update the THD stage | 
| 0 | All transactions were executed | 
| REPLICATION_THREAD_WAIT_TIMEOUT_ERROR | A timeout occurred | 
| REPLICATION_THREAD_WAIT_NO_INFO_ERROR | An error occurred | 
      
  | 
  private | 
      
  | 
  private |