MySQL 26.10.0
Source Code Documentation
xcom_base.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef XCOM_BASE_H
25#define XCOM_BASE_H
26
27#include <stddef.h>
28#ifdef __APPLE__
29#include <stdio.h>
30#endif
31
32#ifndef _WIN32
33#include <netdb.h>
34#endif
35
36#include <memory>
37
40#include "xcom/site_struct.h"
41#include "xcom/task_arg.h"
42#include "xcom/task_debug.h"
43#include "xcom/x_platform.h"
44#include "xcom/xcom_cache.h"
46#include "xcom/xcom_os_layer.h"
47#include "xcom/xdr_utils.h"
48
49#define XCOM_THREAD_DEBUG 1
50
51typedef unsigned long long synode_cnt;
52
53#define SET_EXECUTED_MSG(x) \
54 do { \
55 XCOM_IFDBG(D_NONE, FN); \
56 set_executed_msg(x); \
57 } while (0)
58
59/* Constants */
60
61#ifdef XCOM_TRANSACTIONS
62static trans_id const last_trans = {0xffffffff, 0xffffffff};
63
64#endif
65
66extern int ARBITRATOR_HACK;
67extern task_arg null_arg;
68
69void *xcom_thread_main(void *cp);
70
71synode_no incr_synode(synode_no synode);
72
73bool_t reservation_is_stale(synode_no msgno);
74
75synode_no decr_synode(synode_no synode);
76
77char *dbg_pax_msg(pax_msg const *p);
78pax_msg *dispatch_op(site_def const *site, pax_msg *p, linkage *reply_queue);
79synode_no set_executed_msg(synode_no msgno);
80void request_values(synode_no find, synode_no end);
81void set_group(uint32_t id);
83int xcom_booted();
84int iamthegreatest(site_def const *s);
85void xcom_send(app_data_ptr a, pax_msg *msg);
88synode_no get_max_synode();
90int taskmain(xcom_port listen_port);
91void xcom_thread_init();
92site_def *install_node_group(app_data_ptr a);
93int xcom_taskmain2(xcom_port listen_port);
94void set_max_synode(synode_no synode);
95synode_no set_current_message(synode_no msgno);
96
97int is_real_recover(app_data_ptr a);
98
99void init_xcom_base();
100uint32_t new_id();
101synode_no get_boot_key();
105synode_no get_current_message();
107
108int is_node_v4_reachable(char *node_address);
109int is_node_v4_reachable_with_info(struct addrinfo *retrieved_addr_info);
110int are_we_allowed_to_upgrade_to_v6(app_data_ptr a);
111
112/**
113 Check whether a node number is within the supported XCom range.
114
115 @param node Node number to validate.
116
117 @retval true if the node number is smaller than @c NSERVERS.
118 @retval false otherwise.
119*/
120bool is_node_number_in_valid_range(node_no node);
121
122/**
123 Check whether the fields required to process a snapshot message are valid.
124
125 @param p Message to validate.
126
127 @retval true if the message has a snapshot payload and a valid sender number.
128 @retval false otherwise.
129*/
131
132/** Actions for handling a message in the snapshot receive path. */
135 process,
136 drop,
138};
139
140/**
141 Decide how an incoming message should be handled by the snapshot receive
142 policy before dispatch.
143
144 Non-snapshot messages are processed normally. Valid snapshot messages are
145 accepted while booting. Snapshot messages received after boot completes are
146 dropped.
147
148 @param p Incoming message to inspect.
149 @param boot_completed Whether this node has completed booting.
150
151 @retval snapshot_receive_action::not_snapshot for a non-snapshot message.
152 @retval snapshot_receive_action::process for a valid snapshot received while
153 booting.
154 @retval snapshot_receive_action::drop for a snapshot received after boot
155 completes.
156 @retval snapshot_receive_action::terminate_connection for an invalid snapshot
157 received while booting.
158*/
160 bool boot_completed);
161
162/**
163 * @brief Process incoming are_you_alive (i.e.: ping) messages and act
164 * accordingly
165 *
166 * GCS/XCom has a full mesh of connections between all nodes. A connects to B
167 * and B connects back to A.
168 *
169 * If we cut out B with, for instance, a firewall, we have the A->B connection
170 * silently dead, but we have the B->A connection alive. Since we only do
171 * monitoring on one half of the connection (the incoming messages), we will
172 * consider that B is alive, although we can't contact it. In the same way, B
173 * will consider that A is dead, since it does not receive any message from it.
174 *
175 * We must be able to break the outgoing connection if we detect that something
176 * is wrong, in order to make the bi-directional connection state consistent and
177 * report that node as unreachable. That can be done if we start receiving
178 * pings from a node that we consider that it is alive. After some pings,
179 * we just kill the outgoing connection, thus creating a consistent state.
180 *
181 * Breaking this connection should only occur if the node has already booted,
182 * meaning that the whole joining process is complete and the node is up and
183 * running. This is due to the fact that we receive pings as part of the
184 * process of joining a group.
185 *
186 * @param site current site definitions
187 * @param pm a possible ping message:
188 * @param has_client_already_booted check if this node has already booted
189 * @param current_time current XCom time
190 *
191 * @return int 1 if the node connection is closed. 0, otherwise.
192 */
193int pre_process_incoming_ping(site_def const *site, pax_msg const *pm,
194 int has_client_already_booted,
195 double current_time);
196
197#define RESET_CLIENT_MSG \
198 if (ep->client_msg) { \
199 msg_link_delete(&ep->client_msg); \
200 }
201
202#define APP ep->client_msg->p->a
203
204#define FIND_MAX (MIN_LENGTH / 10)
205
206#define x_actions \
207 X(x_fsm_wait) \
208 , X(x_fsm_poll), X(x_fsm_init), X(x_fsm_u_boot), X(x_fsm_add), \
209 X(x_fsm_net_boot), X(x_fsm_force_config), X(x_fsm_snapshot), \
210 X(x_fsm_local_snapshot), X(x_fsm_snapshot_wait), X(x_fsm_need_snapshot), \
211 X(x_fsm_complete), X(x_fsm_terminate), X(x_fsm_exit), X(x_fsm_timeout)
212#define X(a) a
213
216#undef X
217
218extern const char *xcom_actions_name[];
219
220struct add_args {
221 char *addr;
223 node_list *nl;
224};
225typedef struct add_args add_args;
226
228
229char const *xcom_fsm(xcom_actions action, task_arg fsmargs);
231
232void site_install_action(site_def *site, cargo_type operation);
233void send_client_add_node(char *srv, xcom_port port, node_list *nl);
234void send_client_remove_node(char *srv, xcom_port port, node_list *nl);
235
236typedef void (*xcom_full_data_receiver)(site_def const *site, pax_machine *pma,
237 app_data_ptr app,
238 delivery_status app_status);
240
241typedef void (*xcom_full_local_view_receiver)(site_def const *site,
242 node_set nodes);
244
245typedef void (*xcom_full_global_view_receiver)(site_def const *site,
246 synode_no message_id,
247 node_set nodes);
249
250typedef void (*xcom_data_receiver)(synode_no message_id, synode_no origin,
251 site_def const *site, node_set nodes,
252 u_int size, synode_no last_removed,
253 char *data);
255
256typedef void (*xcom_local_view_receiver)(synode_no message_id, node_set nodes);
258
259typedef void (*xcom_global_view_receiver)(synode_no config_id,
260 synode_no message_id, node_set nodes,
261 xcom_event_horizon);
263
264typedef void (*xcom_config_receiver)(app_data *a);
265
267
271
272typedef void (*app_snap_handler)(blob *gcs_snap, synode_no log_start,
273 synode_no log_end);
275
276typedef synode_no (*app_snap_getter)(blob *gcs_snap);
278
279typedef void (*xcom_state_change_cb)(int status);
284
285typedef int (*should_exit_getter)();
287
288typedef void (*xcom_recovery_cb)();
289
291
293
295
297
298app_data_ptr init_config_with_group(app_data *a, node_list *nl, cargo_type type,
299 uint32_t group_id);
300app_data_ptr init_set_event_horizon_msg(app_data *a, uint32_t group_id,
301 xcom_event_horizon event_horizon);
302app_data_ptr init_get_leaders_msg(app_data *a, uint32_t group_id);
303app_data_ptr init_set_cache_size_msg(app_data *a, uint64_t cache_limit);
304app_data_ptr init_get_event_horizon_msg(app_data *a, uint32_t group_id);
305app_data_ptr init_app_msg(app_data *a, char *payload, u_int payload_size);
306app_data_ptr init_terminate_command(app_data *a);
307
308void terminate_and_exit();
309
310/* Hook the logic to pop from the input channel. */
313/* Create a connection to the input channel's signalling socket. */
315/* Signal that the input channel has commands. */
317/* Destroy the connection to the input channel's signalling socket. */
319
320/*
321 Registers a callback that is called right after
322 the accept routine returns.
323 */
324typedef int (*xcom_socket_accept_cb)(int fd, site_def const *config);
326
330 uint32_t group_id);
332 uint32_t group_id);
334 uint32_t group_id);
336 uint32_t group_id);
338 uint32_t group_id);
340 uint32_t group_id);
342int64_t xcom_client_send_data(uint32_t size, char *data,
344xcom_event_horizon xcom_get_minimum_event_horizon();
345xcom_event_horizon xcom_get_maximum_event_horizon();
347 xcom_event_horizon *event_horizon);
349 xcom_event_horizon event_horizon);
352 uint64_t cache_limit);
354 uint32_t group_id,
355 synode_no_array *const synodes,
356 synode_app_data_array *const reply);
358int64_t xcom_send_client_app_data(connection_descriptor *fd, app_data_ptr a,
359 int force);
360
361std::unique_ptr<Network_provider_management_interface>
363
364std::unique_ptr<Network_provider_operations_interface>
366
367/**
368 Copies app data @c source into @c target and checks if the copy
369 succeeded. Sets *target to NULL if the copy fails.
370
371 @param[in, out] target The pax_msg to which the app_data will be copied.
372 @param source The app data that will be copied.
373 @retval TRUE if the copy was successful.
374 @retval FALSE if the copy failed, in which case *target is set to NULL;
375 a failed copy means that there was an error allocating memory for
376 the copy.
377*/
378bool_t safe_app_data_copy(pax_msg **target, app_data_ptr source);
379
380/**
381 * Initializes the message @c msg to go through a 3-phase, regular Paxos.
382 * Executed by Proposers.
383 *
384 * @param site XCom configuration
385 * @param p Paxos instance
386 * @param msg Message to send
387 * @param msgno Synode where @c msg will be proposed
388 * @param msg_type The type of the message, e.g. normal or no_op
389 */
390void prepare_push_3p(site_def const *site, pax_machine *p, pax_msg *msg,
391 synode_no msgno, pax_msg_type msg_type);
392/**
393 * Initializes the message @c p as a Prepare message, as in the message for
394 * Phase 1 (a) of the Paxos protocol.
395 * Executed by Proposers.
396 *
397 * @param p The message to send
398 */
400/**
401 * Initializes the message @c p as a Prepare message for a no-op, as in the
402 * message for Phase 1 (a) of the Paxos protocol.
403 * Executed by Proposers.
404 *
405 * @param p The no-op message to send
406 * @retval created paxos message of type no_op
407 */
409/**
410 * Process the incoming Prepare message from a Proposer, as in the message for
411 * Phase 1 (a) of the Paxos protocol.
412 * Executed by Acceptors.
413 *
414 * @param p Paxos instance
415 * @param pm Incoming Prepare message
416 * @param synode Synode of the Paxos instance/Accept message
417 * @retval pax_msg* the reply to send to the Proposer (as in the Phase 1 (b)
418 * message of the Paxos protocol) if the Acceptor accepts the Prepare
419 * @retval NULL otherwise
420 */
421pax_msg *handle_simple_prepare(pax_machine *p, pax_msg *pm, synode_no synode);
422/**
423 * Process the incoming acknowledge from an Acceptor to a sent Prepare, as in
424 * the message for Phase 1 (b) of the Paxos protocol.
425 * Executed by Proposers.
426 *
427 * @param site XCom configuration
428 * @param p Paxos instance
429 * @param m Incoming message
430 * @retval TRUE if a majority of Acceptors replied to the Proposer's Prepare
431 * @retval FALSE otherwise
432 */
434 pax_msg *m);
435/**
436 * Initializes the proposer's message to go through a 2-phase Paxos on the
437 * proposer's reserved ballot (0,_).
438 * Executed by Proposers.
439 *
440 * @param site XCom configuration
441 * @param p Paxos instance
442 */
443void prepare_push_2p(site_def const *site, pax_machine *p);
444/**
445 * Initializes the message @c p as an Accept message, as in the message for
446 * Phase 2 (a) of the Paxos protocol.
447 * Executed by Proposers.
448 *
449 * @param p The message to send
450 */
452/**
453 * Process the incoming Accept from a Proposer, as in the message for
454 * Phase 2 (a) of the Paxos protocol.
455 * Executed by Acceptors.
456 *
457 * @param p Paxos instance
458 * @param m Incoming Accept message
459 * @param synode Synode of the Paxos instance/Accept message
460 * @retval pax_msg* the reply to send to the Proposer (as in the Phase 2 (b)
461 * message of the Paxos protocol) if the Acceptor accepts the Accept
462 * @retval NULL otherwise
463 */
464pax_msg *handle_simple_accept(pax_machine *p, pax_msg *m, synode_no synode);
465/**
466 * Process the incoming acknowledge from an Acceptor to a sent Accept, as in
467 * the message for Phase 2 (b) of the Paxos protocol. Executed by Proposers.
468 *
469 * @param site XCom configuration
470 * @param p Paxos instance
471 * @param m Incoming message
472 * @retval pax_msg* the Learn message to send to Leaners if a majority of
473 * Acceptors replied to the Proposer's Accept
474 * @retval NULL otherwise
475 */
477 pax_msg *m);
478/**
479 * Process the incoming tiny, i.e. without the learned value, Learn message.
480 * Executed by Learners.
481 *
482 * @param site XCom configuration
483 * @param pm Paxos instance
484 * @param p Incoming message
485 */
486void handle_tiny_learn(site_def const *site, pax_machine *pm, pax_msg *p);
487/**
488 * Process the incoming Learn message.
489 * Executed by Learners.
490 *
491 * @param site XCom configuration
492 * @param p Paxos instance
493 * @param m Incoming message
494 */
495void handle_learn(site_def const *site, pax_machine *p, pax_msg *m);
496/**
497 * @retval 1 if the value for the Paxos instance @c *p has been learned
498 * @retval 0 otherwise
499 */
501/** @return true if we should process the incoming need_boot_op message passed
502 * in parameter p. */
504/**
505 * Initializes the message @c p as a need_boot_op message.
506 *
507 * @param p The message to send
508 * @param identity The unique incarnation identifier of this XCom instance
509 */
510void init_need_boot_op(pax_msg *p, node_address *identity);
511
512int xcom_client_set_max_leaders(connection_descriptor *fd, node_no max_leaders,
513 uint32_t group_id);
514
515void init_set_max_leaders(uint32_t group_id, app_data *a, node_no max_leaders);
516void init_set_leaders(uint32_t group_id, app_data *a,
517 leader_array const leaders);
518void init_set_leaders(uint32_t group_id, app_data *a, u_int n,
519 char const *names[]);
520void init_set_leaders(uint32_t group_id, app_data *leader_app,
521 leader_array const leaders, app_data *max_app,
522 node_no max_leaders);
523void init_set_leaders(uint32_t group_id, app_data *leader_app, u_int n,
524 char const *names[], app_data *max_app,
525 node_no max_leaders);
526
528 leader_array const leaders, uint32_t group_id);
530 char const *names[], uint32_t group_id);
532 leader_array const leaders, node_no max_leaders,
533 uint32_t group_id);
535 char const *names[], node_no max_leaders,
536 uint32_t group_id);
537
538int xcom_client_get_leaders(connection_descriptor *fd, uint32_t group_id,
539 leader_info_data *leaders);
540
541typedef void (*xcom_election_cb)(leader_array leaders);
543
544static inline char *strerr_msg(char *buf, size_t len, int nr) {
545#if defined(_WIN32)
546 strerror_s(buf, len, nr);
547#else
548 snprintf(buf, len, "%s", strerror(nr));
549#endif
550 return buf;
551}
552
553void xcom_sleep(unsigned int seconds);
554
555#define XCOM_COMMS_ERROR 1
556#define XCOM_COMMS_OTHER 2
557#define XCOM_COMMS_OK 0
559
560extern "C" synode_no get_delivered_msg();
561void set_max_synode_from_unified_boot(synode_no unified_boot_synode);
563synode_no get_default_start(app_data_ptr a);
564synode_no get_last_delivered_msg();
565void set_log_end(gcs_snapshot *gcs);
566
567extern "C" void synthesize_leaders(leader_array *leaders);
568
569#define XCOM_FSM(action, arg) \
570 do { \
571 const char *s = xcom_fsm(action, arg); \
572 G_TRACE("%f %s:%d", seconds(), __FILE__, __LINE__); \
573 G_DEBUG("new state %s", s); \
574 } while (0)
575
577bool_t handle_max_leaders(app_data_ptr a);
578
579#endif
static char buf[MAX_BUF]
Definition: conf_to_src.cc:74
const char * p
Definition: ctype-mb.cc:1227
Definition: buf0block_hint.cc:30
constexpr value_type blob
Definition: classic_protocol_constants.h:272
std::chrono::seconds seconds
Definition: authorize_manager.cc:71
Container::const_iterator find(const Container &c, Value &&value)
Definition: generic.h:40
size_t size(const char *const c)
Definition: base64.h:46
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:220
char * addr
Definition: xcom_base.h:221
xcom_port port
Definition: xcom_base.h:222
node_list * nl
Definition: xcom_base.h:223
Definition: node_connection.h:47
Definition: simset.h:36
Definition: xcom_cache.h:95
Definition: site_struct.h:43
Definition: task_arg.h:42
__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:214
void set_xcom_logger(xcom_logger x)
Definition: xcom_interface.cc:106
const char * xcom_actions_name[]
Definition: xcom_base.cc:7469
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:1757
void set_xcom_recovery_begin_cb(xcom_recovery_cb x)
void terminate_and_exit()
Definition: xcom_base.cc:3923
void(* xcom_global_view_receiver)(synode_no config_id, synode_no message_id, node_set nodes, xcom_event_horizon)
Definition: xcom_base.h:259
void init_xcom_base()
Definition: xcom_base.cc:927
int taskmain(xcom_port listen_port)
void set_xcom_comms_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1119
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:7148
int xcom_client_get_leaders(connection_descriptor *fd, uint32_t group_id, leader_info_data *leaders)
Definition: xcom_base.cc:8966
site_def const * get_proposer_site()
Definition: xcom_base.cc:915
synode_no get_default_start(app_data_ptr a)
site_def * get_executor_site_rw()
Definition: xcom_base.cc:911
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:8732
void set_xcom_run_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1117
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:3043
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:5444
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:4894
void send_x_fsm_complete()
Definition: xcom_base.cc:7448
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:7183
synode_no get_delivered_msg()
Definition: xcom_base.cc:921
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:250
int(* should_exit_getter)()
Definition: xcom_base.h:285
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:324
app_data_ptr init_get_event_horizon_msg(app_data *a, uint32_t group_id)
Definition: xcom_base.cc:7212
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:272
synode_no get_max_synode()
Definition: xcom_base.cc:513
void set_app_snap_handler(app_snap_handler x)
Definition: xcom_base.cc:8033
int set_xcom_socket_accept_cb(xcom_socket_accept_cb x)
Definition: xcom_network_provider_native_lib.cc:60
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:8673
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:288
void xcom_send(app_data_ptr a, pax_msg *msg)
Definition: xcom_base.cc:1807
synode_no get_boot_key()
void check_tasks()
void start_run_tasks()
app_data_ptr init_set_event_horizon_msg(app_data *a, uint32_t group_id, xcom_event_horizon event_horizon)
Definition: xcom_base.cc:7192
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:5173
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:5130
task_arg null_arg
Definition: task.cc:111
synode_no(* app_snap_getter)(blob *gcs_snap)
Definition: xcom_base.h:276
void init_set_max_leaders(uint32_t group_id, app_data *a, node_no max_leaders)
Definition: xcom_base.cc:8862
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:6722
synode_no set_current_message(synode_no msgno)
Definition: xcom_base.cc:3086
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:1630
uint32_t new_id()
Create a new (hopefully unique) ID.
Definition: xcom_base.cc:1833
void handle_tiny_learn(site_def const *site, pax_machine *pm, pax_msg *p)
Process the incoming tiny, i.e.
Definition: xcom_base.cc:5215
void init_set_leaders(uint32_t group_id, app_data *a, leader_array const leaders)
Definition: xcom_base.cc:8890
void site_install_action(site_def *site, cargo_type operation)
Definition: xcom_base.cc:1916
int64_t xcom_send_client_app_data(connection_descriptor *fd, app_data_ptr a, int force)
Definition: xcom_base.cc:8267
int xcom_client_enable_arbitrator(connection_descriptor *fd)
Definition: xcom_base.cc:8811
xcom_event_horizon xcom_get_maximum_event_horizon()
Definition: xcom_base.cc:5619
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:5506
void(* xcom_state_change_cb)(int status)
Definition: xcom_base.h:279
int xcom_client_convert_into_local_server(connection_descriptor *const fd)
Definition: xcom_base.cc:8851
void synthesize_leaders(leader_array *leaders)
Definition: xcom_base.cc:1974
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:8824
site_def * install_node_group(app_data_ptr a)
Definition: xcom_base.cc:2028
void set_xcom_expel_cb(xcom_state_change_cb x)
Definition: xcom_base.cc:1120
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:1212
void set_max_synode(synode_no synode)
Definition: xcom_base.cc:2037
int is_node_v4_reachable(char *node_address)
Definition: xcom_base.cc:8213
void xcom_thread_deinit()
Definition: xcom_base.cc:1005
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:8195
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:241
void set_group(uint32_t id)
Set node group.
Definition: xcom_base.cc:658
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:8232
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:5071
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:245
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:1689
void(* xcom_election_cb)(leader_array leaders)
Definition: xcom_base.h:541
synode_no incr_synode(synode_no synode)
Definition: xcom_base.cc:708
int iamthegreatest(site_def const *s)
Definition: xcom_base.cc:2763
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:1118
bool_t xcom_input_signal(void)
Definition: xcom_base.cc:1276
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:544
bool_t reservation_is_stale(synode_no msgno)
Definition: xcom_base.cc:1794
void set_max_synode_from_unified_boot(synode_no unified_boot_synode)
void set_should_exit_getter(should_exit_getter x)
Definition: task.cc:1161
void(* xcom_local_view_receiver)(synode_no message_id, node_set nodes)
Definition: xcom_base.h:256
app_data_ptr init_terminate_command(app_data *a)
void set_app_snap_getter(app_snap_getter x)
Definition: xcom_base.cc:8036
int pm_finished(pax_machine *p)
Definition: xcom_base.cc:771
int xcom_client_set_max_leaders(connection_descriptor *fd, node_no max_leaders, uint32_t group_id)
Definition: xcom_base.cc:8870
xcom_event_horizon xcom_get_minimum_event_horizon()
Definition: xcom_base.cc:5615
synode_no get_last_delivered_msg()
Definition: xcom_base.cc:925
site_def const * get_executor_site()
Definition: xcom_base.cc:910
void(* xcom_config_receiver)(app_data *a)
Definition: xcom_base.h:264
unsigned long long synode_cnt
Definition: xcom_base.h:51
bool is_valid_snapshot_message(pax_msg const *p)
Check whether the fields required to process a snapshot message are valid.
Definition: xcom_base.cc:517
app_data_ptr init_app_msg(app_data *a, char *payload, u_int payload_size)
Definition: xcom_base.cc:7216
snapshot_receive_action
Actions for handling a message in the snapshot receive path.
Definition: xcom_base.h:133
int xcom_client_set_leaders(connection_descriptor *fd, leader_array const leaders, uint32_t group_id)
#define x_actions
Definition: xcom_base.h:206
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:5289
char const * xcom_fsm(xcom_actions action, task_arg fsmargs)
Definition: xcom_base.cc:8020
snapshot_receive_action get_snapshot_receive_action(pax_msg const *p, bool boot_completed)
Decide how an incoming message should be handled by the snapshot receive policy before dispatch.
Definition: xcom_base.cc:528
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:5494
std::unique_ptr< Network_provider_operations_interface > get_network_operations_interface()
Definition: xcom_base.cc:8943
int xcom_client_remove_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)
Definition: xcom_base.cc:8683
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:311
int xcom_client_set_cache_limit(connection_descriptor *fd, uint64_t cache_limit)
Definition: xcom_base.cc:8837
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:1741
int64_t xcom_client_send_die(connection_descriptor *fd)
Definition: xcom_base.cc:8345
pax_msg * dispatch_op(site_def const *site, pax_msg *p, linkage *reply_queue)
Definition: xcom_base.cc:6525
int xcom_taskmain2(xcom_port listen_port)
Definition: xcom_base.cc:1494
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:1639
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:8938
void xcom_input_free_signal_connection(void)
Definition: xcom_base.cc:1292
app_data_ptr init_get_leaders_msg(app_data *a, uint32_t group_id)
Definition: xcom_base.cc:7208
void set_xcom_full_data_receiver(xcom_full_data_receiver x)
void set_log_end(gcs_snapshot *gcs)
Definition: xcom_base.cc:7567
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:4953
void set_xcom_input_try_pop_cb(xcom_input_try_pop_cb pop)
Definition: xcom_base.cc:1122
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:236
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:7232
int reply_handler_task(task_arg arg)
Definition: xcom_base.cc:7028
bool_t handle_max_leaders(app_data_ptr a)
Definition: xcom_base.cc:3852
bool is_node_number_in_valid_range(node_no node)
Check whether a node number is within the supported XCom range.
Definition: xcom_base.cc:515
void set_xcom_config_receiver(xcom_config_receiver x)
Definition: xcom_interface.cc:96
void xcom_thread_init()
Definition: xcom_base.cc:972
unsigned short xcom_port
Definition: xcom_common.h:46
struct xcom_input_request * xcom_input_request_ptr
Definition: xcom_input_request.h:33
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:100