MySQL 8.4.2
Source Code Documentation
|
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <rpc/rpc.h>
#include <stdlib.h>
#include <string.h>
#include "xcom/xcom_profile.h"
#include "my_compiler.h"
#include "xcom/node_connection.h"
#include "xcom/node_list.h"
#include "xcom/node_no.h"
#include "xcom/retry.h"
#include "xcom/server_struct.h"
#include "xcom/simset.h"
#include "xcom/site_def.h"
#include "xcom/site_struct.h"
#include "xcom/sock_probe.h"
#include "xcom/synode_no.h"
#include "xcom/task.h"
#include "xcom/task_debug.h"
#include "xcom/task_net.h"
#include "xcom/task_os.h"
#include "xcom/x_platform.h"
#include "xcom/xcom_base.h"
#include "xcom/xcom_common.h"
#include "xcom/xcom_detector.h"
#include "xcom/xcom_memory.h"
#include "xcom/xcom_msg_queue.h"
#include "xcom/xcom_scope_guard.h"
#include "xcom/xcom_statistics.h"
#include "xcom/xcom_transport.h"
#include "xcom/xcom_vp_str.h"
#include "xcom/xdr_utils.h"
#include "xdr_gen/xcom_vp.h"
#include "xcom/network/network_provider_manager.h"
#include <openssl/err.h>
#include <openssl/ssl.h>
Classes | |
struct | parse_buf |
Macros | |
#define | MY_XCOM_PROTO x_1_9 |
#define | SERVER_MAX (2 * NSERVERS) |
#define | XDRFUNC xdrfunc |
#define | CRC32CSTART 0xFFFFFFFF |
#define | TAG_START 313 |
#define | TERMINATE_CLIENT(ep) |
#define | EMIT if (!emit(p)) return 0 |
Typedefs | |
typedef int(* | node_set_selector) (site_def const *s, node_no node) |
typedef struct parse_buf | parse_buf |
Functions | |
static void | shut_srv (server *s) |
static int | pm (xcom_port port) |
int | close_open_connection (connection_descriptor *conn) |
connection_descriptor * | open_new_connection (const char *server, xcom_port port, int connection_timeout, network_provider_dynamic_log_level log_level) |
connection_descriptor * | open_new_local_connection (const char *server, xcom_port port) |
bool | is_able_to_connect_to_node (const char *server, const xcom_port port) |
Tests connectivity to another node under the current configuration setup. More... | |
result | set_nodelay (int fd) |
void | init_xcom_transport (xcom_port listen_port) |
void | reset_srv_buf (srv_buf *sb) |
static void | alive (server *s) |
static u_int | srv_buf_capacity (srv_buf *sb) |
static u_int | srv_buf_free_space (srv_buf *sb) |
static u_int | srv_buf_buffered (srv_buf *sb) |
static char * | srv_buf_extract_ptr (srv_buf *sb) |
static char * | srv_buf_insert_ptr (srv_buf *sb) |
static void | advance_extract_ptr (srv_buf *sb, u_int len) |
static u_int | get_srv_buf (srv_buf *sb, char *data, u_int len) |
static void | advance_insert_ptr (srv_buf *sb, u_int len) |
static u_int | put_srv_buf (srv_buf *sb, char *data, u_int len) |
int | flush_srv_buf (server *s, int64_t *ret) |
int | is_new_node_eligible_for_ipv6 (xcom_proto incoming_proto, const site_def *current_site_def) |
Checks if an incoming node is eligible to enter the group. More... | |
static int | _send_msg (server *s, pax_msg *p, node_no to, int64_t *ret) |
void | write_protoversion (unsigned char *buf, xcom_proto proto_vers) |
xcom_proto | read_protoversion (unsigned char *p) |
int | check_protoversion (xcom_proto x_proto, xcom_proto negotiated) |
int | send_proto (connection_descriptor *con, xcom_proto x_proto, x_msg_type x_type, unsigned int tag, int64_t *ret) |
int | apply_xdr (void *buff, uint32_t bufflen, xdrproc_t xdrfunc, void *xdrdata, enum xdr_op op) |
void | dbg_app_data (app_data_ptr a) |
static int | serialize (void *p, xcom_proto x_proto, uint32_t *out_len, xdrproc_t xdrfunc, char **out_buf) |
static int | old_proto_knows (xcom_proto x_proto, pax_op op) |
int | serialize_msg (pax_msg *p, xcom_proto x_proto, uint32_t *buflen, char **buf) |
int | deserialize_msg (pax_msg *p, xcom_proto x_proto, char *buf, uint32_t buflen) |
void | init_crc32c () |
static server * | mksrv (char *srv, xcom_port port) |
static server * | addsrv (char *srv, xcom_port port) |
static void | rmsrv (int i) |
static void | init_collect () |
void | get_all_site_defs (site_def ***s, uint32_t *n) |
static void | mark_site_servers (site_def *site) |
static void | mark () |
static void | sweep () |
void | garbage_collect_servers () |
static void | freesrv (server *s) |
double | server_active (site_def const *s, node_no i) |
int | srv_ref (server *s) |
int | srv_unref (server *s) |
int | incoming_connection_task (task_arg arg) |
void | server_detected (server *s) |
Updates timestamp of server. More... | |
static int | dial (server *s, network_provider_dynamic_log_level dial_call_log_level) |
int | send_msg (server *s, node_no from, node_no to, uint32_t group_id, pax_msg *p) |
static int | _send_server_msg (site_def const *s, node_no to, pax_msg *p) |
int | send_server_msg (site_def const *s, node_no to, pax_msg *p) |
static int | all (site_def const *s, node_no node) |
static int | not_self (site_def const *s, node_no node) |
static int | send_to_node_set (site_def const *s, node_no max, pax_msg *p, node_set_selector test_func, const char *dbg) |
int | send_to_all_site (site_def const *s, pax_msg *p, const char *dbg) |
int | send_to_all_except_self (site_def const *s, pax_msg *p, const char *dbg) |
int | send_to_all (pax_msg *p, const char *dbg) |
static int | send_other_loop (site_def const *s, pax_msg *p, const char *dbg) |
int | send_to_others (site_def const *s, pax_msg *p, const char *dbg) |
int | send_to_someone (site_def const *s, pax_msg *p, const char *dbg) |
int | send_to_acceptors (pax_msg *p, const char *dbg) |
static int | read_bytes (connection_descriptor const *rfd, char *p, uint32_t n, server *s, int64_t *ret) |
Reads n bytes from connection rfd without buffering reads. More... | |
static int | buffered_read_bytes (connection_descriptor const *rfd, srv_buf *buf, char *p, uint32_t n, server *s, int64_t *ret) |
Reads n bytes from connection rfd with buffering reads. More... | |
void | get_header_1_0 (unsigned char header_buf[], uint32_t *msgsize, x_msg_type *x_type, unsigned int *tag) |
void | put_header_1_0 (unsigned char header_buf[], uint32_t msgsize, x_msg_type x_type, unsigned int tag) |
int | read_msg (connection_descriptor *rfd, pax_msg *p, server *s, int64_t *ret) |
Reads message from connection rfd without buffering reads. More... | |
int | buffered_read_msg (connection_descriptor *rfd, srv_buf *buf, pax_msg *p, server *s, int64_t *ret) |
Reads message from connection rfd with buffering reads. More... | |
static unsigned int | incr_tag (unsigned int tag) |
static void | start_protocol_negotiation (channel *outgoing) |
void | wakeup_sender () |
static server * | find_server (server *table[], int n, char *name, xcom_port port) |
bool | is_server_in_current_view (server *sp) |
Checks if a given server is currently in use in the current view. More... | |
int | sender_task (task_arg arg) |
int | local_sender_task (task_arg arg) |
void | update_servers (site_def *s, cargo_type operation) |
void | invalidate_servers (const site_def *old_site_def, const site_def *new_site_def) |
int | tcp_reaper_task (task_arg arg) |
void | ssl_free_con (connection_descriptor *con) |
void | close_connection (connection_descriptor *con) |
void | shutdown_connection (connection_descriptor *con) |
void | reset_connection (connection_descriptor *con) |
xcom_proto | common_xcom_version (site_def const *site) |
xcom_proto | set_latest_common_proto (xcom_proto x_proto) |
xcom_proto | get_latest_common_proto () |
xcom_proto | negotiate_protocol (xcom_proto proto_vers) |
xcom_proto | minimum_ipv6_version () |
Returns the version from which nodes are able to speak IPv6. More... | |
static int | emit (parse_buf *p) |
static int | match_port (parse_buf *p, xcom_port *port) |
static int | match_ipv6 (parse_buf *p) |
static int | match_ipv4_or_name (parse_buf *p) |
static int | match_address (parse_buf *p) |
static int | match_ip_and_port (char const *address, char ip[IP_MAX_SIZE], xcom_port *port) |
int | get_ip_and_port (char const *address, char ip[IP_MAX_SIZE], xcom_port *port) |
Get the ip and port object from a given address in the authorized input format. More... | |
Variables | |
xcom_proto const | my_min_xcom_version |
xcom_proto const | my_xcom_version |
static int const | NAGLE = 0 |
int | xcom_shutdown |
static xcom_port | xcom_listen_port = 0 |
static xdrproc_t | pax_msg_func [] |
static uint32_t | crc_table [256] |
static server * | all_servers [SERVER_MAX] |
static int | maxservers = 0 |
linkage | connect_wait |
static xcom_proto | latest_common_proto = MY_XCOM_PROTO |
#define CRC32CSTART 0xFFFFFFFF |
#define MY_XCOM_PROTO x_1_9 |
#define SERVER_MAX (2 * NSERVERS) |
#define TAG_START 313 |
#define TERMINATE_CLIENT | ( | ep | ) |
#define XDRFUNC xdrfunc |
typedef int(* node_set_selector) (site_def const *s, node_no node) |
|
static |
|
static |
|
static |
Reads n bytes from connection rfd with buffering reads.
[in] | rfd | Pointer to open connection. |
[in,out] | buf | Used for buffering reads. Originally initialized by caller, maintained by buffered_read_bytes. |
[out] | p | Output buffer. |
[in] | n | Number of bytes to read |
[out] | s | Pointer to server. |
[out] | ret | Number of bytes read, or -1 if failure. |
0 | if task should terminate. |
1 | if it should continue. |
int buffered_read_msg | ( | connection_descriptor * | rfd, |
srv_buf * | buf, | ||
pax_msg * | p, | ||
server * | s, | ||
int64_t * | ret | ||
) |
Reads message from connection rfd with buffering reads.
[in] | rfd | Pointer to open connection. |
[in,out] | buf | Used for buffering reads. |
[out] | p | Output buffer. |
[out] | s | Pointer to server. Server timestamp updated if not 0. |
[out] | ret | Number of bytes read, or -1 if failure. |
0 | if task should terminate. |
1 | if it should continue. |
int check_protoversion | ( | xcom_proto | x_proto, |
xcom_proto | negotiated | ||
) |
void close_connection | ( | connection_descriptor * | con | ) |
int close_open_connection | ( | connection_descriptor * | conn | ) |
xcom_proto common_xcom_version | ( | site_def const * | site | ) |
void dbg_app_data | ( | app_data_ptr | a | ) |
int deserialize_msg | ( | pax_msg * | p, |
xcom_proto | x_proto, | ||
char * | buf, | ||
uint32_t | buflen | ||
) |
|
static |
|
static |
int flush_srv_buf | ( | server * | s, |
int64_t * | ret | ||
) |
|
static |
void garbage_collect_servers | ( | ) |
void get_all_site_defs | ( | site_def *** | s, |
uint32_t * | n | ||
) |
void get_header_1_0 | ( | unsigned char | header_buf[], |
uint32_t * | msgsize, | ||
x_msg_type * | x_type, | ||
unsigned int * | tag | ||
) |
int get_ip_and_port | ( | char const * | address, |
char | ip[IP_MAX_SIZE], | ||
xcom_port * | port | ||
) |
Get the ip and port object from a given address in the authorized input format.
For IP v4 is IP (or) NAME:PORT and for IPv6 is [IP (or) NAME]:PORT
address | input address to parse |
ip | the resulting IP or Name |
port | the resulting port |
xcom_proto get_latest_common_proto | ( | ) |
int incoming_connection_task | ( | task_arg | arg | ) |
|
inlinestatic |
|
static |
void init_crc32c | ( | ) |
void init_xcom_transport | ( | xcom_port | listen_port | ) |
bool is_able_to_connect_to_node | ( | const char * | server, |
const xcom_port | port | ||
) |
Tests connectivity to another node under the current configuration setup.
This function verifies that this node is able to successfully reach to the other node. It is used to do a sanity check at when a new member is about to be added to the list of participants and to check local node connectivity, in order to validate configurations.
int is_new_node_eligible_for_ipv6 | ( | xcom_proto | incoming_proto, |
const site_def * | current_site_def | ||
) |
Checks if an incoming node is eligible to enter the group.
This function checks if a new node entering the group is able to be part of it. This is needed duw to downgrade procedures to server versions that do not speak IPv6. One will check if:
If all of the above hold true we are able to proceed and add the node. Else, we must fail.
1 | in case of success. |
bool is_server_in_current_view | ( | server * | sp | ) |
Checks if a given server is currently in use in the current view.
sp | the server to check |
int local_sender_task | ( | task_arg | arg | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
xcom_proto minimum_ipv6_version | ( | ) |
Returns the version from which nodes are able to speak IPv6.
xcom_proto negotiate_protocol | ( | xcom_proto | proto_vers | ) |
|
static |
|
inlinestatic |
connection_descriptor * open_new_connection | ( | const char * | server, |
xcom_port | port, | ||
int | connection_timeout, | ||
network_provider_dynamic_log_level | log_level | ||
) |
connection_descriptor * open_new_local_connection | ( | const char * | server, |
xcom_port | port | ||
) |
|
static |
void put_header_1_0 | ( | unsigned char | header_buf[], |
uint32_t | msgsize, | ||
x_msg_type | x_type, | ||
unsigned int | tag | ||
) |
|
static |
Reads n bytes from connection rfd without buffering reads.
[in] | rfd | Pointer to open connection. |
[out] | p | Output buffer. |
[in] | n | Number of bytes to read. |
[out] | s | Pointer to server. |
[out] | ret | Number of bytes read, or -1 if failure. |
0 | if task should terminate. |
1 | if it should continue. |
int read_msg | ( | connection_descriptor * | rfd, |
pax_msg * | p, | ||
server * | s, | ||
int64_t * | ret | ||
) |
Reads message from connection rfd without buffering reads.
[in] | rfd | Pointer to open connection. |
[out] | p | Output buffer. |
[in,out] | s | Pointer to server. Server timestamp updated if not 0. |
[in,out] | ret | Number of bytes read, or -1 if failure. |
0 | if task should terminate. |
1 | if it should continue. |
xcom_proto read_protoversion | ( | unsigned char * | p | ) |
void reset_connection | ( | connection_descriptor * | con | ) |
void reset_srv_buf | ( | srv_buf * | sb | ) |
|
static |
int send_proto | ( | connection_descriptor * | con, |
xcom_proto | x_proto, | ||
x_msg_type | x_type, | ||
unsigned int | tag, | ||
int64_t * | ret | ||
) |
int send_to_acceptors | ( | pax_msg * | p, |
const char * | dbg | ||
) |
int send_to_all | ( | pax_msg * | p, |
const char * | dbg | ||
) |
|
inlinestatic |
int sender_task | ( | task_arg | arg | ) |
|
static |
int serialize_msg | ( | pax_msg * | p, |
xcom_proto | x_proto, | ||
uint32_t * | buflen, | ||
char ** | buf | ||
) |
double server_active | ( | site_def const * | s, |
node_no | i | ||
) |
void server_detected | ( | server * | s | ) |
Updates timestamp of server.
[in] | s | Pointer to server. |
xcom_proto set_latest_common_proto | ( | xcom_proto | x_proto | ) |
result set_nodelay | ( | int | fd | ) |
|
static |
void shutdown_connection | ( | connection_descriptor * | con | ) |
|
static |
|
static |
int srv_ref | ( | server * | s | ) |
int srv_unref | ( | server * | s | ) |
void ssl_free_con | ( | connection_descriptor * | con | ) |
|
static |
|
static |
int tcp_reaper_task | ( | task_arg | arg | ) |
void update_servers | ( | site_def * | s, |
cargo_type | operation | ||
) |
void wakeup_sender | ( | ) |
void write_protoversion | ( | unsigned char * | buf, |
xcom_proto | proto_vers | ||
) |
|
static |
linkage connect_wait |
|
static |
|
static |
|
static |
xcom_proto const my_min_xcom_version |
xcom_proto const my_xcom_version |
|
static |
|
static |
|
static |
|
extern |