24#ifndef GCS_MYSQL_NETWORK_PROVIDER_INCLUDED
25#define GCS_MYSQL_NETWORK_PROVIDER_INCLUDED
111 const char *
user,
const char *passwd,
112 const char *db,
unsigned int port,
113 const char *unix_socket,
114 unsigned long clientflag) = 0;
128 const unsigned char *arg,
size_t length,
129 bool skip_check) = 0;
200 const void *arg) = 0;
216 const char *ca,
const char *capath,
217 const char *cipher) = 0;
239 const char *passwd,
const char *db,
240 unsigned int port,
const char *unix_socket,
241 unsigned long clientflag)
override;
247 const unsigned char *arg,
size_t length,
248 bool skip_check)
override;
297 const void *arg)
override;
304 const char *ca,
const char *capath,
305 const char *cipher)
override;
388 [
this](
const auto &client_connection) {
389 m_native_interface->mysql_close(client_connection.second);
390 m_native_interface->mysql_free(client_connection.second);
400 std::pair<bool, int>
start()
override;
405 std::pair<bool, int>
stop()
override;
435 const std::string &address,
const unsigned short port,
495 switch (net_provider_log_level) {
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
Implementation of Gcs_mysql_network_provider_auth_interface that retrieves auth data from MySQL.
Definition: gcs_mysql_network_provider.h:71
Gcs_mysql_network_provider_auth_interface_impl()
Definition: gcs_mysql_network_provider.h:73
Replication_thread_api m_recovery_channel
Definition: gcs_mysql_network_provider.h:85
virtual ~Gcs_mysql_network_provider_auth_interface_impl() override
Definition: gcs_mysql_network_provider.h:75
bool get_credentials(std::string &username, std::string &password) override
Get the user credentials needed to establish MySQL connections.
Definition: gcs_mysql_network_provider.cc:42
IoC interface to allow abstraction of the retrieval of Security Credentials.
Definition: gcs_mysql_network_provider.h:45
virtual bool get_credentials(std::string &username, std::string &password)=0
Get the user credentials needed to establish MySQL connections.
virtual ~Gcs_mysql_network_provider_auth_interface()
Definition: gcs_mysql_network_provider.h:47
Internal implementation of Gcs_mysql_network_provider_native_interface_impl that serves as a proxy fo...
Definition: gcs_mysql_network_provider.h:228
MYSQL * mysql_init(MYSQL *sock) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:66
bool restore_original_network_namespace() override
Implementation of.
Definition: gcs_mysql_network_provider.cc:128
int channel_get_network_namespace(std::string &net_ns) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:100
bool set_network_namespace(const std::string &network_namespace) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:113
unsigned int mysql_errno(MYSQL *mysql) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:61
void mysql_free(void *ptr) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:80
virtual ~Gcs_mysql_network_provider_native_interface_impl() override
Definition: gcs_mysql_network_provider.h:232
Gcs_mysql_network_provider_native_interface_impl()
Definition: gcs_mysql_network_provider.h:230
int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:84
bool mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:89
Replication_thread_api m_recovery_channel
Definition: gcs_mysql_network_provider.h:308
MYSQL * mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:47
bool send_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *arg, size_t length, bool skip_check) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:55
void mysql_close(MYSQL *sock) override
Implementation of.
Definition: gcs_mysql_network_provider.cc:71
IoC interface to allow abstraction of MySQL Client API.
Definition: gcs_mysql_network_provider.h:92
virtual unsigned int mysql_errno(MYSQL *mysql)=0
Proxy method to mysql_errno from the MySQL client API.
virtual MYSQL * mysql_init(MYSQL *sock)=0
Proxy method to mysql_init from the MySQL Client API.
virtual int channel_get_network_namespace(std::string &net_ns)=0
Method to get the network namespace configured for a channel.
virtual bool send_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *arg, size_t length, bool skip_check)=0
Proxy method to simple_command from the MySQL client API.
virtual void mysql_close(MYSQL *sock)=0
Proxy method to mysql_close from the MySQL Client API.
virtual int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)=0
Proxy method to mysql_options from the MySQL Memory API.
virtual bool restore_original_network_namespace()=0
Restore original network namespace used to be active before a new network namespace has been set.
virtual void mysql_free(void *ptr)=0
Proxy method to mysql_free from the MySQL Memory API.
virtual bool set_network_namespace(const std::string &network_namespace)=0
Set active network namespace specified by a name.
virtual MYSQL * mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag)=0
Proxy method to mysql_real_connect from the MySQL client API.
virtual ~Gcs_mysql_network_provider_native_interface()
Definition: gcs_mysql_network_provider.h:94
virtual bool mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)=0
Proxy method to mysql_ssl_set from the MySQL Memory API.
Utilitarian class for Gcs_mysql_network_provider.
Definition: gcs_mysql_network_provider.h:468
static constexpr int OUT_OF_RANGE_LOG_LEVEL
Definition: gcs_mysql_network_provider.h:471
static bool is_retryable_connection_handoff_error(unsigned int error_number)
Check whether a MySQL client error represents transient contention on the incoming connection handoff...
Definition: gcs_mysql_network_provider.cc:416
static int log_level_adaptation(int coded_log_level, network_provider_dynamic_log_level log_level)
Converts from the intended developer fixed level to a dynamic level provided from the API call,...
Definition: gcs_mysql_network_provider.h:537
static int from_network_provider_dynamic_log_level_mapping(network_provider_dynamic_log_level net_provider_log_level)
Maps between Network Provider generic log level and MySQL error Log level.
Definition: gcs_mysql_network_provider.h:493
Implementation of a.
Definition: gcs_mysql_network_provider.h:315
std::map< int, THD * > m_incoming_connection_map
A map that holds THDs for incoming MySQL Server connections.
Definition: gcs_mysql_network_provider.h:342
Network_configuration_parameters m_config_parameters
Definition: gcs_mysql_network_provider.h:348
enum_transport_protocol get_communication_stack() const override
Get the communication stack implemented by this class.
Definition: gcs_mysql_network_provider.h:412
mysql_mutex_t m_GR_LOCK_connection_map_mutex
Definition: gcs_mysql_network_provider.h:345
int close_connection(const Network_connection &connection) override
Closes an open connection to another XCom endpoint served by the same Network provider.
Definition: gcs_mysql_network_provider.cc:366
Gcs_mysql_network_provider_auth_interface * m_auth_provider
External IoC dependencies.
Definition: gcs_mysql_network_provider.h:355
std::pair< bool, int > stop() override
See.
Definition: gcs_mysql_network_provider.cc:142
bool configure_secure_connections(const Network_configuration_parameters ¶ms) override
See.
Definition: gcs_mysql_network_provider.cc:170
std::pair< bool, int > start() override
See.
Definition: gcs_mysql_network_provider.cc:136
bool finalize_secure_connections_context() override
Definition: gcs_mysql_network_provider.cc:199
bool configure(const Network_configuration_parameters ¶ms) override
See.
Definition: gcs_mysql_network_provider.cc:165
std::unique_ptr< Network_connection > open_connection(const std::string &address, const unsigned short port, const Network_security_credentials &security_credentials, int connection_timeout=Network_provider::default_connection_timeout(), network_provider_dynamic_log_level log_level=network_provider_dynamic_log_level::PROVIDED) override
See.
Definition: gcs_mysql_network_provider.cc:203
Gr_incoming_connection_status set_new_connection(THD *thd, Network_connection *connection)
Register and publish an incoming MySQL Server connection.
Definition: gcs_mysql_network_provider.cc:399
virtual ~Gcs_mysql_network_provider() override
Definition: gcs_mysql_network_provider.h:384
void cleanup_secure_connections_context() override
Definition: gcs_mysql_network_provider.cc:193
Gcs_mysql_network_provider_native_interface * m_native_interface
Definition: gcs_mysql_network_provider.h:356
std::map< int, MYSQL * > m_connection_map
A map that holds all open MySQL client connections.
Definition: gcs_mysql_network_provider.h:326
Gcs_mysql_network_provider(Gcs_mysql_network_provider_auth_interface *auth_provider, Gcs_mysql_network_provider_native_interface *native_interface)
Construct a new Gcs_mysql_network_provider.
Definition: gcs_mysql_network_provider.h:367
Class that provides Network Namespace services.
Definition: network_provider.h:251
Base class for External Network Providers.
Definition: network_provider.h:306
static constexpr int default_connection_timeout()
Definition: network_provider.h:465
Definition: replication_threads_api.h:37
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_destroy(M)
Definition: mysql_mutex.h:46
#define mysql_mutex_init(K, M, A)
Definition: mysql_mutex.h:41
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:48
@ WARNING_LEVEL
Definition: my_loglevel.h:44
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
@ SYSTEM_LEVEL
Definition: my_loglevel.h:42
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
mysql_option
Definition: mysql.h:170
static char * password
Definition: mysql_secure_installation.cc:58
char * user
Definition: mysqladmin.cc:67
const char * host
Definition: mysqladmin.cc:66
static MYSQL * sock
Definition: mysqlcheck.cc:57
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:323
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static loglevel log_level(const Sql_condition *condition)
Definition: histogram.cc:1750
Definition: system_info_linux.cc:46
enum_transport_protocol
Enum that describes the available XCom Communication Stacks.
Definition: network_provider.h:45
@ MYSQL_PROTOCOL
Definition: network_provider.h:48
@ SSL_DISABLED
Definition: network_provider.h:57
network_provider_dynamic_log_level
Dynamic log level enum values.
Definition: network_provider.h:103
PSI_mutex_key key_GR_LOCK_connection_map
Definition: plugin_psi.h:133
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string network_namespace
Definition: replication_asynchronous_connection_failover.proto:34
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
Gr_incoming_connection_status
Result of handing an incoming MySQL protocol connection to Group Replication.
Definition: rpl_group_replication.h:94
Possible configuration parameters.
Definition: network_provider.h:191
struct ssl_parameters ssl_params
Definition: network_provider.h:194
Represents an open connection.
Definition: network_provider.h:201
Security credentials to establish a connection.
Definition: network_provider.h:134
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
int ssl_mode
Definition: network_provider.h:172
#define MY_MUTEX_INIT_FAST
Definition: thr_mutex.h:67