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=<rc>)". 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) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-24 08:44:44 +00:00
parent 5b891b50c2
commit e71d91bfd0
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2

View file

@ -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