MySQL 8.0.40
Source Code Documentation
xcom_base.h File Reference
#include <stddef.h>
#include <netdb.h>
#include <memory>
#include "xcom/network/include/network_management_interface.h"
#include "xcom/network/network_provider_manager.h"
#include "xcom/site_struct.h"
#include "xcom/task_arg.h"
#include "xcom/task_debug.h"
#include "xcom/x_platform.h"
#include "xcom/xcom_cache.h"
#include "xcom/xcom_input_request.h"
#include "xcom/xcom_os_layer.h"
#include "xcom/xdr_utils.h"

Go to the source code of this file.

Classes

struct  add_args
 

Macros

#define XCOM_THREAD_DEBUG   1
 
#define SET_EXECUTED_MSG(x)
 
#define RESET_CLIENT_MSG
 
#define APP   ep->client_msg->p->a
 
#define FIND_MAX   (MIN_LENGTH / 10)
 
#define x_actions
 
#define X(a)   a
 
#define XCOM_COMMS_ERROR   1
 
#define XCOM_COMMS_OTHER   2
 
#define XCOM_COMMS_OK   0
 
#define XCOM_FSM(action, arg)
 

Typedefs

typedef unsigned long long synode_cnt
 
typedef enum xcom_actions xcom_actions
 
typedef struct add_args add_args
 
typedef void(* xcom_full_data_receiver) (site_def const *site, pax_machine *pma, app_data_ptr app, delivery_status app_status)
 
typedef void(* xcom_full_local_view_receiver) (site_def const *site, node_set nodes)
 
typedef void(* xcom_full_global_view_receiver) (site_def const *site, synode_no message_id, node_set nodes)
 
typedef void(* xcom_data_receiver) (synode_no message_id, synode_no origin, site_def const *site, node_set nodes, u_int size, synode_no last_removed, char *data)
 
typedef void(* xcom_local_view_receiver) (synode_no message_id, node_set nodes)
 
typedef void(* xcom_global_view_receiver) (synode_no config_id, synode_no message_id, node_set nodes, xcom_event_horizon)
 
typedef void(* xcom_config_receiver) (app_data *a)
 
typedef void(* app_snap_handler) (blob *gcs_snap, synode_no log_start, synode_no log_end)
 
typedef synode_no(* app_snap_getter) (blob *gcs_snap)
 
typedef void(* xcom_state_change_cb) (int status)
 
typedef int(* should_exit_getter) ()
 
typedef void(* xcom_recovery_cb) ()
 
typedef xcom_input_request_ptr(* xcom_input_try_pop_cb) (void)
 
typedef int(* xcom_socket_accept_cb) (int fd, site_def const *config)
 
typedef void(* xcom_election_cb) (leader_array leaders)
 

Enumerations

enum  xcom_actions { x_actions }
 

Functions

void * xcom_thread_main (void *cp)
 
synode_no incr_synode (synode_no synode)
 
synode_no decr_synode (synode_no synode)
 
char * dbg_pax_msg (pax_msg const *p)
 
pax_msgdispatch_op (site_def const *site, pax_msg *p, linkage *reply_queue)
 
synode_no set_executed_msg (synode_no msgno)
 
void request_values (synode_no find, synode_no end)
 
void set_group (uint32_t id)
 Set node group. More...
 
void check_tasks ()
 
int xcom_booted ()
 
int iamthegreatest (site_def const *s)
 
void xcom_send (app_data_ptr a, pax_msg *msg)
 
int reply_handler_task (task_arg arg)
 
int acceptor_learner_task (task_arg arg)
 
synode_no get_max_synode ()
 
void xcom_thread_deinit ()
 
int taskmain (xcom_port listen_port)
 
void xcom_thread_init ()
 
site_definstall_node_group (app_data_ptr a)
 
int xcom_taskmain2 (xcom_port listen_port)
 
void set_max_synode (synode_no synode)
 
synode_no set_current_message (synode_no msgno)
 
int is_real_recover (app_data_ptr a)
 
void init_xcom_base ()
 
uint32_t new_id ()
 Create a new (hopefully unique) ID. More...
 
synode_no get_boot_key ()
 
site_def const * get_executor_site ()
 
site_defget_executor_site_rw ()
 
site_def const * get_proposer_site ()
 
synode_no get_current_message ()
 
void start_run_tasks ()
 
int is_node_v4_reachable (char *node_address)
 
int is_node_v4_reachable_with_info (struct addrinfo *retrieved_addr_info)
 
int are_we_allowed_to_upgrade_to_v6 (app_data_ptr a)
 
int pre_process_incoming_ping (site_def const *site, pax_msg const *pm, int has_client_already_booted, double current_time)
 Process incoming are_you_alive (i.e. More...
 
synode_no xcom_get_last_removed_from_cache ()
 
char const * xcom_fsm (xcom_actions action, task_arg fsmargs)
 
void site_post_install_action (site_def *site)
 
void site_install_action (site_def *site, cargo_type operation)
 
void send_client_add_node (char *srv, xcom_port port, node_list *nl)
 
void send_client_remove_node (char *srv, xcom_port port, node_list *nl)
 
void set_xcom_full_data_receiver (xcom_full_data_receiver x)
 
void set_xcom_full_local_view_receiver (xcom_full_local_view_receiver x)
 
void set_xcom_full_global_view_receiver (xcom_full_global_view_receiver x)
 
void set_xcom_data_receiver (xcom_data_receiver x)
 
void set_xcom_local_view_receiver (xcom_local_view_receiver x)
 
void set_xcom_global_view_receiver (xcom_global_view_receiver x)
 
void set_xcom_config_receiver (xcom_config_receiver x)
 
void set_xcom_logger (xcom_logger x)
 
void set_xcom_debugger (xcom_debugger x)
 
void set_xcom_debugger_check (xcom_debugger_check x)
 
void set_app_snap_handler (app_snap_handler x)
 
void set_app_snap_getter (app_snap_getter x)
 
void set_xcom_run_cb (xcom_state_change_cb x)
 
void set_xcom_terminate_cb (xcom_state_change_cb x)
 
void set_xcom_exit_cb (xcom_state_change_cb x)
 
void set_xcom_expel_cb (xcom_state_change_cb x)
 
void set_should_exit_getter (should_exit_getter x)
 
void set_xcom_recovery_init_cb (xcom_recovery_cb x)
 
void set_xcom_recovery_restart_cb (xcom_recovery_cb x)
 
void set_xcom_recovery_begin_cb (xcom_recovery_cb x)
 
void set_xcom_recovery_end_cb (xcom_recovery_cb x)
 
app_data_ptr init_config_with_group (app_data *a, node_list *nl, cargo_type type, uint32_t group_id)
 
app_data_ptr init_set_event_horizon_msg (app_data *a, uint32_t group_id, xcom_event_horizon event_horizon)
 
app_data_ptr init_get_leaders_msg (app_data *a, uint32_t group_id)
 
app_data_ptr init_set_cache_size_msg (app_data *a, uint64_t cache_limit)
 
app_data_ptr init_get_event_horizon_msg (app_data *a, uint32_t group_id)
 
app_data_ptr init_app_msg (app_data *a, char *payload, u_int payload_size)
 
app_data_ptr init_terminate_command (app_data *a)
 
void terminate_and_exit ()
 
void set_xcom_input_try_pop_cb (xcom_input_try_pop_cb pop)
 
bool_t xcom_input_new_signal_connection (char const *address, xcom_port port)
 
bool_t xcom_input_signal (void)
 
void xcom_input_free_signal_connection (void)
 
int set_xcom_socket_accept_cb (xcom_socket_accept_cb x)
 
int xcom_client_disable_arbitrator (connection_descriptor *fd)
 
int xcom_client_enable_arbitrator (connection_descriptor *fd)
 
int xcom_client_add_node (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int xcom_client_boot (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int xcom_client_force_add_node (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int xcom_client_force_config (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int xcom_client_force_remove_node (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int xcom_client_remove_node (connection_descriptor *fd, node_list *nl, uint32_t group_id)
 
int64_t xcom_client_send_die (connection_descriptor *fd)
 
int64_t xcom_client_send_data (uint32_t size, char *data, connection_descriptor *fd)
 
xcom_event_horizon xcom_get_minimum_event_horizon ()
 
xcom_event_horizon xcom_get_maximum_event_horizon ()
 
int xcom_client_get_event_horizon (connection_descriptor *fd, uint32_t group_id, xcom_event_horizon *event_horizon)
 
int xcom_client_set_event_horizon (connection_descriptor *fd, uint32_t group_id, xcom_event_horizon event_horizon)
 
int xcom_client_terminate_and_exit (connection_descriptor *fd)
 
int xcom_client_set_cache_limit (connection_descriptor *fd, uint64_t cache_limit)
 
int xcom_client_get_synode_app_data (connection_descriptor *const fd, uint32_t group_id, synode_no_array *const synodes, synode_app_data_array *const reply)
 
int xcom_client_convert_into_local_server (connection_descriptor *const fd)
 
int64_t xcom_send_client_app_data (connection_descriptor *fd, app_data_ptr a, int force)
 
std::unique_ptr< Network_provider_management_interfaceget_network_management_interface ()
 
std::unique_ptr< Network_provider_operations_interfaceget_network_operations_interface ()
 
bool_t safe_app_data_copy (pax_msg **target, app_data_ptr source)
 Copies app data source into target and checks if the copy succeeded. More...
 
void prepare_push_3p (site_def const *site, pax_machine *p, pax_msg *msg, synode_no msgno, pax_msg_type msg_type)
 Initializes the message msg to go through a 3-phase, regular Paxos. More...
 
void init_prepare_msg (pax_msg *p)
 Initializes the message p as a Prepare message, as in the message for Phase 1 (a) of the Paxos protocol. More...
 
pax_msgcreate_noop (pax_msg *p)
 Initializes the message p as a Prepare message for a no-op, as in the message for Phase 1 (a) of the Paxos protocol. More...
 
pax_msghandle_simple_prepare (pax_machine *p, pax_msg *pm, synode_no synode)
 Process the incoming Prepare message from a Proposer, as in the message for Phase 1 (a) of the Paxos protocol. More...
 
bool_t handle_simple_ack_prepare (site_def const *site, pax_machine *p, pax_msg *m)
 Process the incoming acknowledge from an Acceptor to a sent Prepare, as in the message for Phase 1 (b) of the Paxos protocol. More...
 
void prepare_push_2p (site_def const *site, pax_machine *p)
 Initializes the proposer's message to go through a 2-phase Paxos on the proposer's reserved ballot (0,_). More...
 
void init_propose_msg (pax_msg *p)
 Initializes the message p as an Accept message, as in the message for Phase 2 (a) of the Paxos protocol. More...
 
pax_msghandle_simple_accept (pax_machine *p, pax_msg *m, synode_no synode)
 Process the incoming Accept from a Proposer, as in the message for Phase 2 (a) of the Paxos protocol. More...
 
pax_msghandle_simple_ack_accept (site_def const *site, pax_machine *p, pax_msg *m)
 Process the incoming acknowledge from an Acceptor to a sent Accept, as in the message for Phase 2 (b) of the Paxos protocol. More...
 
void handle_tiny_learn (site_def const *site, pax_machine *pm, pax_msg *p)
 Process the incoming tiny, i.e. More...
 
void handle_learn (site_def const *site, pax_machine *p, pax_msg *m)
 Process the incoming Learn message. More...
 
int pm_finished (pax_machine *p)
 
bool_t should_handle_need_boot (site_def const *site, pax_msg *p)
 
void init_need_boot_op (pax_msg *p, node_address *identity)
 Initializes the message p as a need_boot_op message. More...
 
int xcom_client_set_max_leaders (connection_descriptor *fd, node_no max_leaders, uint32_t group_id)
 
void init_set_max_leaders (uint32_t group_id, app_data *a, node_no max_leaders)
 
void init_set_leaders (uint32_t group_id, app_data *a, leader_array const leaders)
 
void init_set_leaders (uint32_t group_id, app_data *a, u_int n, char const *names[])
 
void init_set_leaders (uint32_t group_id, app_data *leader_app, leader_array const leaders, app_data *max_app, node_no max_leaders)
 
void init_set_leaders (uint32_t group_id, app_data *leader_app, u_int n, char const *names[], app_data *max_app, node_no max_leaders)
 
int xcom_client_set_leaders (connection_descriptor *fd, leader_array const leaders, uint32_t group_id)
 
int xcom_client_set_leaders (connection_descriptor *fd, u_int n, char const *names[], uint32_t group_id)
 
int xcom_client_set_leaders (connection_descriptor *fd, leader_array const leaders, node_no max_leaders, uint32_t group_id)
 
int xcom_client_set_leaders (connection_descriptor *fd, u_int n, char const *names[], node_no max_leaders, uint32_t group_id)
 
int xcom_client_get_leaders (connection_descriptor *fd, uint32_t group_id, leader_info_data *leaders)
 
void set_xcom_election_cb (xcom_election_cb x)
 
static char * strerr_msg (char *buf, size_t len, int nr)
 
void xcom_sleep (unsigned int seconds)
 
void set_xcom_comms_cb (xcom_state_change_cb x)
 
synode_no get_delivered_msg ()
 
void set_max_synode_from_unified_boot (synode_no unified_boot_synode)
 
void send_x_fsm_complete ()
 
synode_no get_default_start (app_data_ptr a)
 
synode_no get_last_delivered_msg ()
 
void set_log_end (gcs_snapshot *gcs)
 
void synthesize_leaders (leader_array *leaders)
 
bool_t handle_max_leaders (app_data_ptr a)
 

Variables

int ARBITRATOR_HACK
 
task_arg null_arg
 
const char * xcom_actions_name []
 

Macro Definition Documentation

◆ APP

#define APP   ep->client_msg->p->a

◆ FIND_MAX

#define FIND_MAX   (MIN_LENGTH / 10)

◆ RESET_CLIENT_MSG

#define RESET_CLIENT_MSG
Value:
if (ep->client_msg) { \
msg_link_delete(&ep->client_msg); \
}

◆ SET_EXECUTED_MSG

#define SET_EXECUTED_MSG (   x)
Value:
do { \
IFDBG(D_NONE, FN); \
set_executed_msg(x); \
} while (0)
#define FN
Definition: gcs_debug.h:308
@ D_NONE
Definition: gcs_debug.h:174

◆ X

#define X (   a)    a

◆ x_actions

#define x_actions
Value:
X(x_fsm_wait) \
, X(x_fsm_poll), X(x_fsm_init), X(x_fsm_u_boot), X(x_fsm_add), \
X(x_fsm_net_boot), X(x_fsm_force_config), X(x_fsm_snapshot), \
X(x_fsm_local_snapshot), X(x_fsm_snapshot_wait), X(x_fsm_need_snapshot), \
X(x_fsm_complete), X(x_fsm_terminate), X(x_fsm_exit), X(x_fsm_timeout)
#define X(a)
Definition: xcom_base.h:160

◆ XCOM_COMMS_ERROR

#define XCOM_COMMS_ERROR   1

◆ XCOM_COMMS_OK

#define XCOM_COMMS_OK   0

◆ XCOM_COMMS_OTHER

#define XCOM_COMMS_OTHER   2

◆ XCOM_FSM

#define XCOM_FSM (   action,
  arg 
)
Value:
do { \
const char *s = xcom_fsm(action, arg); \
G_TRACE("%f %s:%d", seconds(), __FILE__, __LINE__); \
G_DEBUG("new state %s", s); \
} while (0)
repeated Action action
Definition: replication_group_member_actions.proto:43
double seconds()
Definition: task.cc:310
char const * xcom_fsm(xcom_actions action, task_arg fsmargs)
Definition: xcom_base.cc:7707

◆ XCOM_THREAD_DEBUG

#define XCOM_THREAD_DEBUG   1

Typedef Documentation

◆ add_args

typedef struct add_args add_args

◆ app_snap_getter

typedef synode_no(* app_snap_getter) (blob *gcs_snap)

◆ app_snap_handler

typedef void(* app_snap_handler) (blob *gcs_snap, synode_no log_start, synode_no log_end)

◆ should_exit_getter

typedef int(* should_exit_getter) ()

◆ synode_cnt

typedef unsigned long long synode_cnt

◆ xcom_actions

typedef enum xcom_actions xcom_actions

◆ xcom_config_receiver

typedef void(* xcom_config_receiver) (app_data *a)

◆ xcom_data_receiver

typedef void(* xcom_data_receiver) (synode_no message_id, synode_no origin, site_def const *site, node_set nodes, u_int size, synode_no last_removed, char *data)

◆ xcom_election_cb

typedef void(* xcom_election_cb) (leader_array leaders)

◆ xcom_full_data_receiver

typedef void(* xcom_full_data_receiver) (site_def const *site, pax_machine *pma, app_data_ptr app, delivery_status app_status)

◆ xcom_full_global_view_receiver

typedef void(* xcom_full_global_view_receiver) (site_def const *site, synode_no message_id, node_set nodes)

◆ xcom_full_local_view_receiver

typedef void(* xcom_full_local_view_receiver) (site_def const *site, node_set nodes)

◆ xcom_global_view_receiver

typedef void(* xcom_global_view_receiver) (synode_no config_id, synode_no message_id, node_set nodes, xcom_event_horizon)

◆ xcom_input_try_pop_cb

typedef xcom_input_request_ptr(* xcom_input_try_pop_cb) (void)

◆ xcom_local_view_receiver

typedef void(* xcom_local_view_receiver) (synode_no message_id, node_set nodes)

◆ xcom_recovery_cb

typedef void(* xcom_recovery_cb) ()

◆ xcom_socket_accept_cb

typedef int(* xcom_socket_accept_cb) (int fd, site_def const *config)

◆ xcom_state_change_cb

typedef void(* xcom_state_change_cb) (int status)

Enumeration Type Documentation

◆ xcom_actions

Enumerator
x_actions 

Function Documentation

◆ acceptor_learner_task()

int acceptor_learner_task ( task_arg  arg)

◆ are_we_allowed_to_upgrade_to_v6()

int are_we_allowed_to_upgrade_to_v6 ( app_data_ptr  a)

◆ check_tasks()

void check_tasks ( )

◆ create_noop()

pax_msg * create_noop ( pax_msg p)

Initializes the message p as a Prepare message for a no-op, as in the message for Phase 1 (a) of the Paxos protocol.

Executed by Proposers.

Parameters
pThe no-op message to send
Return values
createdpaxos message of type no_op

◆ dbg_pax_msg()

char * dbg_pax_msg ( pax_msg const *  p)

◆ decr_synode()

synode_no decr_synode ( synode_no  synode)

◆ dispatch_op()

pax_msg * dispatch_op ( site_def const *  site,
pax_msg p,
linkage reply_queue 
)

◆ get_boot_key()

synode_no get_boot_key ( )

◆ get_current_message()

synode_no get_current_message ( )

◆ get_default_start()

synode_no get_default_start ( app_data_ptr  a)

◆ get_delivered_msg()

synode_no get_delivered_msg ( )

◆ get_executor_site()

site_def const * get_executor_site ( )

◆ get_executor_site_rw()

site_def * get_executor_site_rw ( )

◆ get_last_delivered_msg()

synode_no get_last_delivered_msg ( )

◆ get_max_synode()

synode_no get_max_synode ( )

◆ get_network_management_interface()

std::unique_ptr< Network_provider_management_interface > get_network_management_interface ( )

◆ get_network_operations_interface()

std::unique_ptr< Network_provider_operations_interface > get_network_operations_interface ( )

◆ get_proposer_site()

site_def const * get_proposer_site ( )

◆ handle_learn()

void handle_learn ( site_def const *  site,
pax_machine p,
pax_msg m 
)

Process the incoming Learn message.

Executed by Learners.

Parameters
siteXCom configuration
pPaxos instance
mIncoming message

◆ handle_max_leaders()

bool_t handle_max_leaders ( app_data_ptr  a)

◆ handle_simple_accept()

pax_msg * handle_simple_accept ( pax_machine p,
pax_msg m,
synode_no  synode 
)

Process the incoming Accept from a Proposer, as in the message for Phase 2 (a) of the Paxos protocol.

Executed by Acceptors.

Parameters
pPaxos instance
mIncoming Accept message
synodeSynode of the Paxos instance/Accept message
Return values
pax_msg*the reply to send to the Proposer (as in the Phase 2 (b) message of the Paxos protocol) if the Acceptor accepts the Accept
NULLotherwise

◆ handle_simple_ack_accept()

pax_msg * handle_simple_ack_accept ( site_def const *  site,
pax_machine p,
pax_msg m 
)

Process the incoming acknowledge from an Acceptor to a sent Accept, as in the message for Phase 2 (b) of the Paxos protocol.

Executed by Proposers.

Parameters
siteXCom configuration
pPaxos instance
mIncoming message
Return values
pax_msg*the Learn message to send to Leaners if a majority of Acceptors replied to the Proposer's Accept
NULLotherwise

◆ handle_simple_ack_prepare()

bool_t handle_simple_ack_prepare ( site_def const *  site,
pax_machine p,
pax_msg m 
)

Process the incoming acknowledge from an Acceptor to a sent Prepare, as in the message for Phase 1 (b) of the Paxos protocol.

Executed by Proposers.

Parameters
siteXCom configuration
pPaxos instance
mIncoming message
Return values
TRUEif a majority of Acceptors replied to the Proposer's Prepare
FALSEotherwise

◆ handle_simple_prepare()

pax_msg * handle_simple_prepare ( pax_machine p,
pax_msg pm,
synode_no  synode 
)

Process the incoming Prepare message from a Proposer, as in the message for Phase 1 (a) of the Paxos protocol.

Executed by Acceptors.

Parameters
pPaxos instance
pmIncoming Prepare message
synodeSynode of the Paxos instance/Accept message
Return values
pax_msg*the reply to send to the Proposer (as in the Phase 1 (b) message of the Paxos protocol) if the Acceptor accepts the Prepare
NULLotherwise

◆ handle_tiny_learn()

void handle_tiny_learn ( site_def const *  site,
pax_machine pm,
pax_msg p 
)

Process the incoming tiny, i.e.

without the learned value, Learn message. Executed by Learners.

Parameters
siteXCom configuration
pmPaxos instance
pIncoming message

◆ iamthegreatest()

int iamthegreatest ( site_def const *  s)

◆ incr_synode()

synode_no incr_synode ( synode_no  synode)

◆ init_app_msg()

app_data_ptr init_app_msg ( app_data *  a,
char *  payload,
u_int  payload_size 
)

◆ init_config_with_group()

app_data_ptr init_config_with_group ( app_data *  a,
node_list *  nl,
cargo_type  type,
uint32_t  group_id 
)

◆ init_get_event_horizon_msg()

app_data_ptr init_get_event_horizon_msg ( app_data *  a,
uint32_t  group_id 
)

◆ init_get_leaders_msg()

app_data_ptr init_get_leaders_msg ( app_data *  a,
uint32_t  group_id 
)

◆ init_need_boot_op()

void init_need_boot_op ( pax_msg p,
node_address *  identity 
)

Initializes the message p as a need_boot_op message.

Parameters
pThe message to send
identityThe unique incarnation identifier of this XCom instance

◆ init_prepare_msg()

void init_prepare_msg ( pax_msg p)

Initializes the message p as a Prepare message, as in the message for Phase 1 (a) of the Paxos protocol.

Executed by Proposers.

Parameters
pThe message to send

◆ init_propose_msg()

void init_propose_msg ( pax_msg p)

Initializes the message p as an Accept message, as in the message for Phase 2 (a) of the Paxos protocol.

Executed by Proposers.

Parameters
pThe message to send

◆ init_set_cache_size_msg()

app_data_ptr init_set_cache_size_msg ( app_data *  a,
uint64_t  cache_limit 
)

◆ init_set_event_horizon_msg()

app_data_ptr init_set_event_horizon_msg ( app_data *  a,
uint32_t  group_id,
xcom_event_horizon  event_horizon 
)

◆ init_set_leaders() [1/4]

void init_set_leaders ( uint32_t  group_id,
app_data *  a,
leader_array const  leaders 
)

◆ init_set_leaders() [2/4]

void init_set_leaders ( uint32_t  group_id,
app_data *  a,
u_int  n,
char const *  names[] 
)

◆ init_set_leaders() [3/4]

void init_set_leaders ( uint32_t  group_id,
app_data *  leader_app,
leader_array const  leaders,
app_data *  max_app,
node_no  max_leaders 
)

◆ init_set_leaders() [4/4]

void init_set_leaders ( uint32_t  group_id,
app_data *  leader_app,
u_int  n,
char const *  names[],
app_data *  max_app,
node_no  max_leaders 
)

◆ init_set_max_leaders()

void init_set_max_leaders ( uint32_t  group_id,
app_data *  a,
node_no  max_leaders 
)

◆ init_terminate_command()

app_data_ptr init_terminate_command ( app_data *  a)

◆ init_xcom_base()

void init_xcom_base ( )

Reset lsn

◆ install_node_group()

site_def * install_node_group ( app_data_ptr  a)

◆ is_node_v4_reachable()

int is_node_v4_reachable ( char *  node_address)

◆ is_node_v4_reachable_with_info()

int is_node_v4_reachable_with_info ( struct addrinfo *  retrieved_addr_info)

◆ is_real_recover()

int is_real_recover ( app_data_ptr  a)

◆ new_id()

uint32_t new_id ( )

Create a new (hopefully unique) ID.

The basic idea is to create a hash from the host ID and a timestamp.

◆ pm_finished()

int pm_finished ( pax_machine p)
Return values
1if the value for the Paxos instance *p has been learned
0otherwise

◆ pre_process_incoming_ping()

int pre_process_incoming_ping ( site_def const *  site,
pax_msg const *  pm,
int  has_client_already_booted,
double  current_time 
)

Process incoming are_you_alive (i.e.

: ping) messages and act accordingly

GCS/XCom has a full mesh of connections between all nodes. A connects to B and B connects back to A.

If we cut out B with, for instance, a firewall, we have the A->B connection silently dead, but we have the B->A connection alive. Since we only do monitoring on one half of the connection (the incoming messages), we will consider that B is alive, although we can't contact it. In the same way, B will consider that A is dead, since it does not receive any message from it.

We must be able to break the outgoing connection if we detect that something is wrong, in order to make the bi-directional connection state consistent and report that node as unreachable. That can be done if we start receiving pings from a node that we consider that it is alive. After some pings, we just kill the outgoing connection, thus creating a consistent state.

Breaking this connection should only occur if the node has already booted, meaning that the whole joining process is complete and the node is up and running. This is due to the fact that we receive pings as part of the process of joining a group.

Parameters
sitecurrent site definitions
pma possible ping message:
has_client_already_bootedcheck if this node has already booted
current_timecurrent XCom time
Returns
int 1 if the node connection is closed. 0, otherwise.

◆ prepare_push_2p()

void prepare_push_2p ( site_def const *  site,
pax_machine p 
)

Initializes the proposer's message to go through a 2-phase Paxos on the proposer's reserved ballot (0,_).

Executed by Proposers.

Parameters
siteXCom configuration
pPaxos instance

◆ prepare_push_3p()

void prepare_push_3p ( site_def const *  site,
pax_machine p,
pax_msg msg,
synode_no  msgno,
pax_msg_type  msg_type 
)

Initializes the message msg to go through a 3-phase, regular Paxos.

Executed by Proposers.

Parameters
siteXCom configuration
pPaxos instance
msgMessage to send
msgnoSynode where msg will be proposed
msg_typeThe type of the message, e.g. normal or no_op

◆ reply_handler_task()

int reply_handler_task ( task_arg  arg)

◆ request_values()

void request_values ( synode_no  find,
synode_no  end 
)

◆ safe_app_data_copy()

bool_t safe_app_data_copy ( pax_msg **  target,
app_data_ptr  source 
)

Copies app data source into target and checks if the copy succeeded.

Sets *target to NULL if the copy fails.

Parameters
[in,out]targetThe pax_msg to which the app_data will be copied.
sourceThe app data that will be copied.
Return values
TRUEif the copy was successful.
FALSEif the copy failed, in which case *target is set to NULL; a failed copy means that there was an error allocating memory for the copy.

◆ send_client_add_node()

void send_client_add_node ( char *  srv,
xcom_port  port,
node_list *  nl 
)

◆ send_client_remove_node()

void send_client_remove_node ( char *  srv,
xcom_port  port,
node_list *  nl 
)

◆ send_x_fsm_complete()

void send_x_fsm_complete ( )

◆ set_app_snap_getter()

void set_app_snap_getter ( app_snap_getter  x)

◆ set_app_snap_handler()

void set_app_snap_handler ( app_snap_handler  x)

◆ set_current_message()

synode_no set_current_message ( synode_no  msgno)

◆ set_executed_msg()

synode_no set_executed_msg ( synode_no  msgno)

◆ set_group()

void set_group ( uint32_t  id)

Set node group.

◆ set_log_end()

void set_log_end ( gcs_snapshot *  gcs)

◆ set_max_synode()

void set_max_synode ( synode_no  synode)

◆ set_max_synode_from_unified_boot()

void set_max_synode_from_unified_boot ( synode_no  unified_boot_synode)

◆ set_should_exit_getter()

void set_should_exit_getter ( should_exit_getter  x)

◆ set_xcom_comms_cb()

void set_xcom_comms_cb ( xcom_state_change_cb  x)

◆ set_xcom_config_receiver()

void set_xcom_config_receiver ( xcom_config_receiver  x)

◆ set_xcom_data_receiver()

void set_xcom_data_receiver ( xcom_data_receiver  x)

◆ set_xcom_debugger()

void set_xcom_debugger ( xcom_debugger  x)

◆ set_xcom_debugger_check()

void set_xcom_debugger_check ( xcom_debugger_check  x)

◆ set_xcom_election_cb()

void set_xcom_election_cb ( xcom_election_cb  x)

◆ set_xcom_exit_cb()

void set_xcom_exit_cb ( xcom_state_change_cb  x)

◆ set_xcom_expel_cb()

void set_xcom_expel_cb ( xcom_state_change_cb  x)

◆ set_xcom_full_data_receiver()

void set_xcom_full_data_receiver ( xcom_full_data_receiver  x)

◆ set_xcom_full_global_view_receiver()

void set_xcom_full_global_view_receiver ( xcom_full_global_view_receiver  x)

◆ set_xcom_full_local_view_receiver()

void set_xcom_full_local_view_receiver ( xcom_full_local_view_receiver  x)

◆ set_xcom_global_view_receiver()

void set_xcom_global_view_receiver ( xcom_global_view_receiver  x)

◆ set_xcom_input_try_pop_cb()

void set_xcom_input_try_pop_cb ( xcom_input_try_pop_cb  pop)

◆ set_xcom_local_view_receiver()

void set_xcom_local_view_receiver ( xcom_local_view_receiver  x)

◆ set_xcom_logger()

void set_xcom_logger ( xcom_logger  x)

◆ set_xcom_recovery_begin_cb()

void set_xcom_recovery_begin_cb ( xcom_recovery_cb  x)

◆ set_xcom_recovery_end_cb()

void set_xcom_recovery_end_cb ( xcom_recovery_cb  x)

◆ set_xcom_recovery_init_cb()

void set_xcom_recovery_init_cb ( xcom_recovery_cb  x)

◆ set_xcom_recovery_restart_cb()

void set_xcom_recovery_restart_cb ( xcom_recovery_cb  x)

◆ set_xcom_run_cb()

void set_xcom_run_cb ( xcom_state_change_cb  x)

◆ set_xcom_socket_accept_cb()

int set_xcom_socket_accept_cb ( xcom_socket_accept_cb  x)

◆ set_xcom_terminate_cb()

void set_xcom_terminate_cb ( xcom_state_change_cb  x)

◆ should_handle_need_boot()

bool_t should_handle_need_boot ( site_def const *  site,
pax_msg p 
)
Returns
true if we should process the incoming need_boot_op message passed in parameter p.

◆ site_install_action()

void site_install_action ( site_def site,
cargo_type  operation 
)

◆ site_post_install_action()

void site_post_install_action ( site_def site)

◆ start_run_tasks()

void start_run_tasks ( )

◆ strerr_msg()

static char * strerr_msg ( char *  buf,
size_t  len,
int  nr 
)
inlinestatic

◆ synthesize_leaders()

void synthesize_leaders ( leader_array *  leaders)

◆ taskmain()

int taskmain ( xcom_port  listen_port)

◆ terminate_and_exit()

void terminate_and_exit ( )

◆ xcom_booted()

int xcom_booted ( )

◆ xcom_client_add_node()

int xcom_client_add_node ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_boot()

int xcom_client_boot ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_convert_into_local_server()

int xcom_client_convert_into_local_server ( connection_descriptor *const  fd)

◆ xcom_client_disable_arbitrator()

int xcom_client_disable_arbitrator ( connection_descriptor fd)

◆ xcom_client_enable_arbitrator()

int xcom_client_enable_arbitrator ( connection_descriptor fd)

◆ xcom_client_force_add_node()

int xcom_client_force_add_node ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_force_config()

int xcom_client_force_config ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_force_remove_node()

int xcom_client_force_remove_node ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_get_event_horizon()

int xcom_client_get_event_horizon ( connection_descriptor fd,
uint32_t  group_id,
xcom_event_horizon *  event_horizon 
)

◆ xcom_client_get_leaders()

int xcom_client_get_leaders ( connection_descriptor fd,
uint32_t  group_id,
leader_info_data *  leaders 
)

◆ xcom_client_get_synode_app_data()

int xcom_client_get_synode_app_data ( connection_descriptor *const  fd,
uint32_t  group_id,
synode_no_array *const  synodes,
synode_app_data_array *const  reply 
)

◆ xcom_client_remove_node()

int xcom_client_remove_node ( connection_descriptor fd,
node_list *  nl,
uint32_t  group_id 
)

◆ xcom_client_send_data()

int64_t xcom_client_send_data ( uint32_t  size,
char *  data,
connection_descriptor fd 
)

◆ xcom_client_send_die()

int64_t xcom_client_send_die ( connection_descriptor fd)

◆ xcom_client_set_cache_limit()

int xcom_client_set_cache_limit ( connection_descriptor fd,
uint64_t  cache_limit 
)

◆ xcom_client_set_event_horizon()

int xcom_client_set_event_horizon ( connection_descriptor fd,
uint32_t  group_id,
xcom_event_horizon  event_horizon 
)

◆ xcom_client_set_leaders() [1/4]

int xcom_client_set_leaders ( connection_descriptor fd,
leader_array const  leaders,
node_no  max_leaders,
uint32_t  group_id 
)

◆ xcom_client_set_leaders() [2/4]

int xcom_client_set_leaders ( connection_descriptor fd,
leader_array const  leaders,
uint32_t  group_id 
)

◆ xcom_client_set_leaders() [3/4]

int xcom_client_set_leaders ( connection_descriptor fd,
u_int  n,
char const *  names[],
node_no  max_leaders,
uint32_t  group_id 
)

◆ xcom_client_set_leaders() [4/4]

int xcom_client_set_leaders ( connection_descriptor fd,
u_int  n,
char const *  names[],
uint32_t  group_id 
)

◆ xcom_client_set_max_leaders()

int xcom_client_set_max_leaders ( connection_descriptor fd,
node_no  max_leaders,
uint32_t  group_id 
)

◆ xcom_client_terminate_and_exit()

int xcom_client_terminate_and_exit ( connection_descriptor fd)

◆ xcom_fsm()

char const * xcom_fsm ( xcom_actions  action,
task_arg  fsmargs 
)

◆ xcom_get_last_removed_from_cache()

synode_no xcom_get_last_removed_from_cache ( )

◆ xcom_get_maximum_event_horizon()

xcom_event_horizon xcom_get_maximum_event_horizon ( )

◆ xcom_get_minimum_event_horizon()

xcom_event_horizon xcom_get_minimum_event_horizon ( )

◆ xcom_input_free_signal_connection()

void xcom_input_free_signal_connection ( void  )

◆ xcom_input_new_signal_connection()

bool_t xcom_input_new_signal_connection ( char const *  address,
xcom_port  port 
)

◆ xcom_input_signal()

bool_t xcom_input_signal ( void  )

◆ xcom_send()

void xcom_send ( app_data_ptr  a,
pax_msg msg 
)

◆ xcom_send_client_app_data()

int64_t xcom_send_client_app_data ( connection_descriptor fd,
app_data_ptr  a,
int  force 
)

◆ xcom_sleep()

void xcom_sleep ( unsigned int  seconds)

◆ xcom_taskmain2()

int xcom_taskmain2 ( xcom_port  listen_port)

◆ xcom_thread_deinit()

void xcom_thread_deinit ( )

◆ xcom_thread_init()

void xcom_thread_init ( )

◆ xcom_thread_main()

void * xcom_thread_main ( void *  cp)

Variable Documentation

◆ ARBITRATOR_HACK

int ARBITRATOR_HACK
extern

◆ null_arg

task_arg null_arg
extern

◆ xcom_actions_name

const char* xcom_actions_name[]
extern