You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by "MisterRaindrop (via GitHub)" <gi...@apache.org> on 2026/10/22 07:44:36 UTC
Re: [PR] gpstate: fix false "Acting as Primary" report for hot standby mirrors [cloudberry]
MisterRaindrop commented on PR #1743:
URL: https://github.com/apache/cloudberry/pull/1743#issuecomment-6335535088
Thanks for the fix, @jangjang0401. I reproduced the problem and verified the patch on a demo cluster (3 primaries + 3 mirrors, built from this branch in the Rocky 8 build image).
With `hot_standby=on`, a mirror that is still in recovery (`pg_is_in_recovery()` = `t`) answers `pg_isready` with 0 (`PQPING_OK`), which is the cause you describe.
| Scenario | `main` | this PR |
|---|---|---|
| `hot_standby=off` | mirrors `Up` | – |
| `hot_standby=on`, mirrors streaming | all 3 mirrors `Acting as Primary`, with warnings | all 3 mirrors `Up`, no warnings |
| `hot_standby=on`, one mirror promoted with `pg_ctl promote` before FTS noticed | – | only that mirror is `Acting as Primary`; the other two are `Up` |
So healthy hot standbys are no longer flagged, and a mirror that has really been promoted still is. The only consumer of the status string is `clsSystemState.py`, so correcting it there doesn't leave another caller behind.
I pushed one commit on top (a54731c2943) so this can move forward:
- unit tests in `test_unit_gpstate.py` for the value `_add_replication_info()` now returns: the walreceiver state for streaming / catchup / startup, and `None` when the primary is down, can't be queried, or doesn't show exactly one standby connection. All 28 tests in the file pass; the state test fails against `main` (`'streaming' != None`).
- one sentence in the comment beside the check: a hot standby whose WAL receiver hasn't reached streaming yet (e.g. still in `startup`) is reported as `Acting as Primary` until it does.
Please squash when merging, since the branch carries a merge from `main`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org