forked from lei.chen/myxce
feat(ha-config-bootstrap): implement OP_ctrlHello state sync handler (task 9.3)
This commit is contained in:
parent
0ec0ffa7e3
commit
94bf5d94b8
9 changed files with 396 additions and 3 deletions
|
|
@ -15,6 +15,8 @@ typedef struct repl_config_req_s repl_config_req_t;
|
|||
typedef struct repl_config_push_req_s repl_config_push_req_t;
|
||||
typedef struct upgrade_config_req_s upgrade_config_req_t;
|
||||
typedef struct heartbeat_msg_s heartbeat_msg_t;
|
||||
typedef struct ctrl_hello_req_s ctrl_hello_req_t;
|
||||
typedef struct ctrl_hello_reply_s ctrl_hello_reply_t;
|
||||
|
||||
typedef struct {
|
||||
char* resname;
|
||||
|
|
@ -183,6 +185,7 @@ typedef struct {
|
|||
repl_config_reply_t* replconfigreplymsg;
|
||||
repl_config_push_reply_t* replconfigpushreplymsg;
|
||||
upgrade_config_reply_t* upgradeconfigreplymsg;
|
||||
ctrl_hello_reply_t* ctrlhelloreplymsg;
|
||||
} data;
|
||||
/* Req 7: standby redirect fields — populated when status == XCE_ERR_STANDBY */
|
||||
char *redirect_host;
|
||||
|
|
@ -217,6 +220,9 @@ typedef struct {
|
|||
repl_config_push_req_t* replconfigpushrequestmsg;
|
||||
upgrade_config_req_t* upgradeconfigrequestmsg;
|
||||
heartbeat_msg_t* heartbeatmsg;
|
||||
ctrl_hello_req_t* ctrlhellomsg;
|
||||
void* walcatchupentrymsg; /* wal_catchup_entry_t* */
|
||||
void* snapshottransfermsg; /* snapshot_transfer_t* */
|
||||
} body;
|
||||
} xce_request_t;
|
||||
|
||||
|
|
@ -355,4 +361,18 @@ struct heartbeat_msg_s {
|
|||
uint64_t committed_config_tag; /* Req 8: primary's committed config tag */
|
||||
};
|
||||
|
||||
/* CtrlHello state sync (Req 6.5, 6.6, 6.7) */
|
||||
struct ctrl_hello_req_s {
|
||||
char *name; /* standby's logical name */
|
||||
xce_data_t *key; /* SHA-256(cluster_name + shared_secret) auth key */
|
||||
uint64_t applied_lsn; /* standby's last applied WAL LSN */
|
||||
uint64_t config_tag; /* standby's current config tag */
|
||||
};
|
||||
|
||||
struct ctrl_hello_reply_s {
|
||||
uint64_t committed_lsn; /* primary's committed WAL LSN */
|
||||
int needs_snapshot; /* 1 if standby LSN < oldest WAL segment */
|
||||
uint64_t config_tag; /* primary's current config tag */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue