From e71d91bfd0a2e892d9845fa47d4319587c4b5008 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Thu, 24 Sep 2026 08:44:44 +0000 Subject: [PATCH] chore(libxce-failover): log the status that triggered each failover rotation (bug-1850) xcecli_retry_next's "xcecli failover: attempt N -> host:port" line now carries "(after status=)". Without it a log cannot tell a dead connection from a healthy primary's commit-timeout or admission-backpressure reply -- the distinction bug-1850 (the live scheduler re-joining every ~100s) needs to find its triggering rc. Diagnostic only; no behavior change. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/lib/client_failover.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/client_failover.c b/src/lib/client_failover.c index ab85f522..238b7722 100644 --- a/src/lib/client_failover.c +++ b/src/lib/client_failover.c @@ -388,8 +388,11 @@ bool xcecli_retry_next(api_ctx_t* ac, int* rc, bool is_write, int port = (ac->conf != NULL && cur >= 0 && cur < ac->conf->nmasters) ? ac->conf->master_ports[cur] : 0; - INFO("xcecli failover: attempt %d → %s:%d", st->attempt, - host ? host : "(null)", port); + /* bug-1850: include the status that triggered this rotation -- without + * it a log cannot tell a dead connection from a healthy primary's + * commit-timeout or admission-backpressure reply. */ + INFO("xcecli failover: attempt %d → %s:%d (after status=%d)", st->attempt, + host ? host : "(null)", port, *rc); /* ReconnectRejoinHook (1.2): a stateful consumer re-establishes its session * on the freshly-connected primary AFTER reconnect/recovery and BEFORE the