feat(ha-repl-hardening): add StateReport to RequestReply capnp schema (task 1.1)

Add StateReport struct {appliedLsn, configTag} as stateReportMsg @15
variant in RequestReply.data union. Standby populates this in heartbeat
replies so the primary can track per-standby convergence.

capnpc-c 1.0.1 has a bug with inline :group inside codecgen unions;
workaround uses named outer struct (wire-equivalent). typemap.h
extended with state_report_t and union member for C codec access.
This commit is contained in:
Rongsong Shen 2026-06-04 13:34:11 +00:00
parent e31673dd88
commit 9a977b3a43
3 changed files with 16 additions and 1 deletions

View file

@ -186,6 +186,12 @@ typedef struct {
uint64_t peer_last_log_lsn;
} request_vote_reply_t;
/* Heartbeat reply state report — carries standby's applied_lsn and config_tag */
typedef struct {
uint64_t applied_lsn;
uint64_t config_tag;
} state_report_t;
typedef struct {
uint64_t seq;
uint32_t opcode;
@ -201,6 +207,7 @@ typedef struct {
upgrade_config_reply_t* upgradeconfigreplymsg;
ctrl_hello_reply_t* ctrlhelloreplymsg;
request_vote_reply_t* requestvotereplymsg;
state_report_t* state_report;
} data;
/* Req 7: standby redirect fields — populated when status == XCE_ERR_STANDBY */
char *redirect_host;