49#define XCOM_THREAD_DEBUG 1
53#define SET_EXECUTED_MSG(x) \
56 set_executed_msg(x); \
61#ifdef XCOM_TRANSACTIONS
62static trans_id
const last_trans = {0xffffffff, 0xffffffff};
142 int has_client_already_booted,
143 double current_time);
145#define RESET_CLIENT_MSG \
146 if (ep->client_msg) { \
147 msg_link_delete(&ep->client_msg); \
150#define APP ep->client_msg->p->a
152#define FIND_MAX (MIN_LENGTH / 10)
156 , X(x_fsm_poll), X(x_fsm_init), X(x_fsm_u_boot), X(x_fsm_add), \
157 X(x_fsm_net_boot), X(x_fsm_force_config), X(x_fsm_snapshot), \
158 X(x_fsm_local_snapshot), X(x_fsm_snapshot_wait), X(x_fsm_need_snapshot), \
159 X(x_fsm_complete), X(x_fsm_terminate), X(x_fsm_exit), X(x_fsm_timeout)
186 delivery_status app_status);
194 synode_no message_id,
199 site_def const *site, node_set nodes,
200 u_int size, synode_no last_removed,
208 synode_no message_id, node_set nodes,
249 xcom_event_horizon event_horizon);
295 xcom_event_horizon *event_horizon);
297 xcom_event_horizon event_horizon);
300 uint64_t cache_limit);
303 synode_no_array *
const synodes,
304 synode_app_data_array *
const reply);
309std::unique_ptr<Network_provider_management_interface>
312std::unique_ptr<Network_provider_operations_interface>
339 synode_no msgno, pax_msg_type msg_type);
465 leader_array
const leaders);
467 char const *names[]);
469 leader_array
const leaders, app_data *max_app,
470 node_no max_leaders);
472 char const *names[], app_data *max_app,
473 node_no max_leaders);
476 leader_array
const leaders, uint32_t group_id);
478 char const *names[], uint32_t group_id);
480 leader_array
const leaders, node_no max_leaders,
483 char const *names[], node_no max_leaders,
487 leader_info_data *leaders);
494 strerror_s(
buf, len, nr);
496 snprintf(
buf, len,
"%s", strerror(nr));
503#define XCOM_COMMS_ERROR 1
504#define XCOM_COMMS_OTHER 2
505#define XCOM_COMMS_OK 0
517#define XCOM_FSM(action, arg) \
519 const char *s = xcom_fsm(action, arg); \
520 G_TRACE("%f %s:%d", seconds(), __FILE__, __LINE__); \
521 G_DEBUG("new state %s", s); \
const char * p
Definition: ctype-mb.cc:1237
dberr_t log_start(log_t &log, lsn_t checkpoint_lsn, lsn_t start_lsn, bool allow_checkpoints=true)
Starts the initialized redo log system using a provided checkpoint_lsn and current lsn.
Definition: log0log.cc:710
Definition: buf0block_hint.cc:30
constexpr value_type blob
Definition: classic_protocol_constants.h:272
const byte * find(const Pages *pages, const page_id_t &page_id) noexcept
Find a doublewrite copy of a page.
Definition: buf0dblwr.cc:3563
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
Definition: srv0dynamic_procedures.h:48
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42
required string type
Definition: replication_group_member_actions.proto:34
repeated Action action
Definition: replication_group_member_actions.proto:43
struct pax_msg pax_msg
Definition: site_struct.h:37
Definition: xcom_base.h:168
char * addr
Definition: xcom_base.h:169
xcom_port port
Definition: xcom_base.h:170
node_list * nl
Definition: xcom_base.h:171
Definition: node_connection.h:47
Definition: xcom_cache.h:95
Definition: site_struct.h:43
Definition: task_arg.h:42
double seconds()
Definition: task.cc:310
__u_int u_int
Definition: types.h:73
int bool_t
Definition: types.h:35
int n
Definition: xcom_base.cc:509
xcom_actions
Definition: xcom_base.h:162
void set_xcom_logger(xcom_logger x)
Definition: xcom_interface.cc:106
const char * xcom_actions_name[]
Definition: xcom_base.cc:7157
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...
Definition: xcom_base.cc:1719
void set_xcom_recovery_begin_cb(xcom_recovery_cb x)
void terminate_and_exit()
Definition: xcom_base.cc:3820
void(* xcom_global_view_receiver)(synode_no config_id, synode_no message_id, node_set nodes, xcom_event_horizon)
Definition: xcom_base.h:207
void init_xcom_base()
Definition: xcom_base.cc:892
int taskmain(xcom_port listen_port)
void set_xcom_comms_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1084
int xcom_client_force_config(connection_descriptor *fd, node_list *nl, uint32_t group_id)
void xcom_sleep(unsigned int seconds)
Definition: xcom_base.cc:6837
int xcom_client_get_leaders(connection_descriptor *fd, uint32_t group_id, leader_info_data *leaders)
Definition: xcom_base.cc:8654
site_def const * get_proposer_site()
Definition: xcom_base.cc:880
synode_no get_default_start(app_data_ptr a)
site_def * get_executor_site_rw()
Definition: xcom_base.cc:876
int is_real_recover(app_data_ptr a)
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)
Definition: xcom_base.cc:8420
void set_xcom_run_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1082
void set_xcom_recovery_init_cb(xcom_recovery_cb x)
void * xcom_thread_main(void *cp)
synode_no set_executed_msg(synode_no msgno)
Definition: xcom_base.cc:2945
int xcom_client_get_event_horizon(connection_descriptor *fd, uint32_t group_id, xcom_event_horizon *event_horizon)
bool_t should_handle_need_boot(site_def const *site, pax_msg *p)
Definition: xcom_base.cc:5329
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.
Definition: xcom_base.cc:4783
void send_x_fsm_complete()
Definition: xcom_base.cc:7136
void set_xcom_global_view_receiver(xcom_global_view_receiver x)
Definition: xcom_interface.cc:89
app_data_ptr init_config_with_group(app_data *a, node_list *nl, cargo_type type, uint32_t group_id)
Definition: xcom_base.cc:6872
synode_no get_delivered_msg()
Definition: xcom_base.cc:886
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)
Definition: xcom_base.h:198
int(* should_exit_getter)()
Definition: xcom_base.h:233
void set_xcom_recovery_end_cb(xcom_recovery_cb x)
int(* xcom_socket_accept_cb)(int fd, site_def const *config)
Definition: xcom_base.h:272
app_data_ptr init_get_event_horizon_msg(app_data *a, uint32_t group_id)
Definition: xcom_base.cc:6901
void set_xcom_debugger_check(xcom_debugger_check x)
Definition: xcom_interface.cc:110
void(* app_snap_handler)(blob *gcs_snap, synode_no log_start, synode_no log_end)
Definition: xcom_base.h:220
synode_no get_max_synode()
Definition: xcom_base.cc:513
void set_app_snap_handler(app_snap_handler x)
Definition: xcom_base.cc:7720
int set_xcom_socket_accept_cb(xcom_socket_accept_cb x)
Definition: xcom_network_provider_native_lib.cc:61
void set_xcom_full_global_view_receiver(xcom_full_global_view_receiver x)
int xcom_client_add_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)
Definition: xcom_base.cc:8361
char * dbg_pax_msg(pax_msg const *p)
int xcom_client_boot(connection_descriptor *fd, node_list *nl, uint32_t group_id)
void(* xcom_recovery_cb)()
Definition: xcom_base.h:236
void xcom_send(app_data_ptr a, pax_msg *msg)
Definition: xcom_base.cc:1756
app_data_ptr init_set_event_horizon_msg(app_data *a, uint32_t group_id, xcom_event_horizon event_horizon)
Definition: xcom_base.cc:6881
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)...
Definition: xcom_base.cc:5058
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.
Definition: xcom_base.cc:5015
task_arg null_arg
Definition: task.cc:107
synode_no(* app_snap_getter)(blob *gcs_snap)
Definition: xcom_base.h:224
void init_set_max_leaders(uint32_t group_id, app_data *a, node_no max_leaders)
Definition: xcom_base.cc:8550
void set_xcom_debugger(xcom_debugger x)
Definition: xcom_interface.cc:108
void request_values(synode_no find, synode_no end)
int acceptor_learner_task(task_arg arg)
Definition: xcom_base.cc:6478
synode_no set_current_message(synode_no msgno)
Definition: xcom_base.cc:2988
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 protoc...
Definition: xcom_base.cc:1593
uint32_t new_id()
Create a new (hopefully unique) ID.
Definition: xcom_base.cc:1782
void handle_tiny_learn(site_def const *site, pax_machine *pm, pax_msg *p)
Process the incoming tiny, i.e.
Definition: xcom_base.cc:5100
void init_set_leaders(uint32_t group_id, app_data *a, leader_array const leaders)
Definition: xcom_base.cc:8578
void site_install_action(site_def *site, cargo_type operation)
Definition: xcom_base.cc:1865
int64_t xcom_send_client_app_data(connection_descriptor *fd, app_data_ptr a, int force)
Definition: xcom_base.cc:7954
int xcom_client_enable_arbitrator(connection_descriptor *fd)
Definition: xcom_base.cc:8499
xcom_event_horizon xcom_get_maximum_event_horizon()
Definition: xcom_base.cc:5504
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.
Definition: xcom_base.cc:5391
void(* xcom_state_change_cb)(int status)
Definition: xcom_base.h:227
int xcom_client_convert_into_local_server(connection_descriptor *const fd)
Definition: xcom_base.cc:8539
void synthesize_leaders(leader_array *leaders)
Definition: xcom_base.cc:1923
int xcom_client_force_remove_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)
int xcom_booted()
Definition: xcom_recover.cc:65
int xcom_client_disable_arbitrator(connection_descriptor *fd)
Definition: xcom_base.cc:8512
site_def * install_node_group(app_data_ptr a)
Definition: xcom_base.cc:1977
void set_xcom_expel_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1085
void send_client_add_node(char *srv, xcom_port port, node_list *nl)
bool_t xcom_input_new_signal_connection(char const *address, xcom_port port)
Definition: xcom_base.cc:1177
void set_max_synode(synode_no synode)
Definition: xcom_base.cc:1986
int is_node_v4_reachable(char *node_address)
Definition: xcom_base.cc:7900
void xcom_thread_deinit()
Definition: xcom_base.cc:970
synode_no get_current_message()
Definition: xcom_base.cc:448
int is_node_v4_reachable_with_info(struct addrinfo *retrieved_addr_info)
Definition: xcom_base.cc:7882
void set_xcom_terminate_cb(xcom_state_change_cb x)
int xcom_client_set_event_horizon(connection_descriptor *fd, uint32_t group_id, xcom_event_horizon event_horizon)
void(* xcom_full_local_view_receiver)(site_def const *site, node_set nodes)
Definition: xcom_base.h:189
void set_group(uint32_t id)
Set node group.
Definition: xcom_base.cc:626
void set_xcom_full_local_view_receiver(xcom_full_local_view_receiver x)
int are_we_allowed_to_upgrade_to_v6(app_data_ptr a)
Definition: xcom_base.cc:7919
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...
Definition: xcom_base.cc:4959
void send_client_remove_node(char *srv, xcom_port port, node_list *nl)
void(* xcom_full_global_view_receiver)(site_def const *site, synode_no message_id, node_set nodes)
Definition: xcom_base.h:193
int xcom_client_terminate_and_exit(connection_descriptor *fd)
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 protoc...
Definition: xcom_base.cc:1651
void(* xcom_election_cb)(leader_array leaders)
Definition: xcom_base.h:489
synode_no incr_synode(synode_no synode)
Definition: xcom_base.cc:676
int iamthegreatest(site_def const *s)
Definition: xcom_base.cc:2665
synode_no xcom_get_last_removed_from_cache()
void set_xcom_election_cb(xcom_election_cb x)
void set_xcom_exit_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1083
bool_t xcom_input_signal(void)
Definition: xcom_base.cc:1241
int64_t xcom_client_send_data(uint32_t size, char *data, connection_descriptor *fd)
static char * strerr_msg(char *buf, size_t len, int nr)
Definition: xcom_base.h:492
void set_max_synode_from_unified_boot(synode_no unified_boot_synode)
void set_should_exit_getter(should_exit_getter x)
Definition: task.cc:1136
void(* xcom_local_view_receiver)(synode_no message_id, node_set nodes)
Definition: xcom_base.h:204
app_data_ptr init_terminate_command(app_data *a)
void set_app_snap_getter(app_snap_getter x)
Definition: xcom_base.cc:7723
int pm_finished(pax_machine *p)
Definition: xcom_base.cc:739
int xcom_client_set_max_leaders(connection_descriptor *fd, node_no max_leaders, uint32_t group_id)
Definition: xcom_base.cc:8558
xcom_event_horizon xcom_get_minimum_event_horizon()
Definition: xcom_base.cc:5500
synode_no get_last_delivered_msg()
Definition: xcom_base.cc:890
site_def const * get_executor_site()
Definition: xcom_base.cc:875
void(* xcom_config_receiver)(app_data *a)
Definition: xcom_base.h:212
unsigned long long synode_cnt
Definition: xcom_base.h:51
app_data_ptr init_app_msg(app_data *a, char *payload, u_int payload_size)
Definition: xcom_base.cc:6905
int xcom_client_set_leaders(connection_descriptor *fd, leader_array const leaders, uint32_t group_id)
#define x_actions
Definition: xcom_base.h:154
void set_xcom_local_view_receiver(xcom_local_view_receiver x)
Definition: xcom_interface.cc:85
void handle_learn(site_def const *site, pax_machine *p, pax_msg *m)
Process the incoming Learn message.
Definition: xcom_base.cc:5174
char const * xcom_fsm(xcom_actions action, task_arg fsmargs)
Definition: xcom_base.cc:7707
void init_need_boot_op(pax_msg *p, node_address *identity)
Initializes the message p as a need_boot_op message.
Definition: xcom_base.cc:5379
std::unique_ptr< Network_provider_operations_interface > get_network_operations_interface()
Definition: xcom_base.cc:8631
int xcom_client_remove_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)
Definition: xcom_base.cc:8371
int xcom_client_force_add_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)
xcom_input_request_ptr(* xcom_input_try_pop_cb)(void)
Definition: xcom_base.h:259
int xcom_client_set_cache_limit(connection_descriptor *fd, uint64_t cache_limit)
Definition: xcom_base.cc:8525
int ARBITRATOR_HACK
Definition: xcom_base.cc:350
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.
Definition: xcom_base.cc:1703
int64_t xcom_client_send_die(connection_descriptor *fd)
Definition: xcom_base.cc:8032
pax_msg * dispatch_op(site_def const *site, pax_msg *p, linkage *reply_queue)
Definition: xcom_base.cc:6363
int xcom_taskmain2(xcom_port listen_port)
Definition: xcom_base.cc:1458
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 ...
Definition: xcom_base.cc:1602
void set_xcom_data_receiver(xcom_data_receiver x)
Definition: xcom_interface.cc:83
std::unique_ptr< Network_provider_management_interface > get_network_management_interface()
Definition: xcom_base.cc:8626
void xcom_input_free_signal_connection(void)
Definition: xcom_base.cc:1257
app_data_ptr init_get_leaders_msg(app_data *a, uint32_t group_id)
Definition: xcom_base.cc:6897
void set_xcom_full_data_receiver(xcom_full_data_receiver x)
void set_log_end(gcs_snapshot *gcs)
Definition: xcom_base.cc:7255
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 ...
Definition: xcom_base.cc:4842
void set_xcom_input_try_pop_cb(xcom_input_try_pop_cb pop)
Definition: xcom_base.cc:1087
synode_no decr_synode(synode_no synode)
void set_xcom_recovery_restart_cb(xcom_recovery_cb x)
void(* xcom_full_data_receiver)(site_def const *site, pax_machine *pma, app_data_ptr app, delivery_status app_status)
Definition: xcom_base.h:184
void site_post_install_action(site_def *site)
app_data_ptr init_set_cache_size_msg(app_data *a, uint64_t cache_limit)
Definition: xcom_base.cc:6921
int reply_handler_task(task_arg arg)
Definition: xcom_base.cc:6742
bool_t handle_max_leaders(app_data_ptr a)
Definition: xcom_base.cc:3749
void set_xcom_config_receiver(xcom_config_receiver x)
Definition: xcom_interface.cc:96
void xcom_thread_init()
Definition: xcom_base.cc:937
unsigned short xcom_port
Definition: xcom_common.h:46
int(* xcom_debugger_check)(const int64_t debug_options)
Definition: xcom_logger.h:79
void(* xcom_debugger)(const char *format,...)
Definition: xcom_logger.h:77
void(* xcom_logger)(const int64_t level, const char *message)
Definition: xcom_logger.h:76
static int pm(xcom_port port)
Definition: xcom_transport.cc:99