fix(ha): wire raft trace to DEBUG3; drop NOP on promoted ep; fix --vcpus in deploy script
- ha.c: add raft_cb_trace callback wired to s_real_cbs.on_trace; emits RAFT[pN] term=T event=E at DEBUG3 level, visible with -vvv flag. - ha.c: repl_ack_decode_and_dispatch now silently drops OPCode_nop and OPCode_reply instead of WARNING — heartbeat NOP replies from standbys arrive on promoted endpoints and are expected. - deploy-ha.sh: fix --vcpu -> --vcpus; add \$VERBOSE passthrough so start.sh respects VERBOSE=-vvv from the environment.
This commit is contained in:
parent
7b39650229
commit
d00d3bb051
2 changed files with 94 additions and 1 deletions
|
|
@ -550,6 +550,19 @@ static int raft_cb_persist(void *ctx, uint64_t term, int voted_for)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* raft_cb_trace: emit raft state-machine events at DEBUG3 level.
|
||||
* Active when controller is started with -vvv; suppressed otherwise. */
|
||||
static void raft_cb_trace(void *ctx, const char *event, const char *detail)
|
||||
{
|
||||
ha_state_t *ha = (ha_state_t *)ctx;
|
||||
tlog(TLOG_DEBUG3, "RAFT[%s] term=%" PRIu64 " event=%s%s%s",
|
||||
ha->my_priority == 0 ? "p0" :
|
||||
ha->my_priority == 1 ? "p1" : "p2",
|
||||
atomic_load_explicit(&ha->term, memory_order_relaxed),
|
||||
event,
|
||||
detail ? " " : "", detail ? detail : "");
|
||||
}
|
||||
|
||||
static const raft_callbacks_t s_real_cbs = {
|
||||
.on_send_vote_request = raft_cb_send_vote_request,
|
||||
.on_vote_eligible = raft_cb_vote_eligible,
|
||||
|
|
@ -559,7 +572,7 @@ static const raft_callbacks_t s_real_cbs = {
|
|||
.on_schedule_timeout = raft_cb_schedule_timeout,
|
||||
.on_cancel_timeout = raft_cb_cancel_timeout,
|
||||
.on_start_election_after_delay = raft_cb_start_election_after_delay,
|
||||
.on_trace = NULL,
|
||||
.on_trace = raft_cb_trace,
|
||||
};
|
||||
|
||||
/* ── PRNG seeding ───────────────────────────────────────────── */
|
||||
|
|
@ -2058,6 +2071,8 @@ static int repl_ack_decode_and_dispatch(endpoint_t *ep, vote_ep_ctx_t *vctx)
|
|||
|
||||
if (opcode == OPCode_replCatchUpDone) {
|
||||
ha_repl_ack_received(ha, c);
|
||||
} else if (opcode == OPCode_nop || opcode == OPCode_reply) {
|
||||
/* Heartbeat NOP reply or generic reply — silently drop */
|
||||
} else {
|
||||
WARN("repl_ack_decode_and_dispatch: unexpected opcode %d on promoted ep",
|
||||
opcode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue