Repository navigation
fix(failover): publish the failover quorum only once replicas are aligned - #12023
leonardoce wants to merge 1 commit into
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
…gned With quorum-based failover enabled, the primary lists the synchronous standbys in the FailoverQuorum resource right after applying a new synchronous replication configuration. Those standbys were not necessarily up to date: for example, right after a promotion they may still be catching up with the new primary. The operator could then consider a failover safe while some transactions acknowledged under the previous configuration were not on enough of the listed standbys, and promoting a replica could lose them. The primary now takes its current WAL position when it detects a change in the standby list, empties the FailoverQuorum resource, and publishes the new list only when at least as many listed standbys as the configured synchronous number are streaming and have flushed that position. Until then no failover is allowed, and the check is repeated every second without blocking the rest of the reconciliation. If the configuration changes again while waiting, the position is taken again. If the instance manager restarts, a later position is taken, which can only make the check stricter. Signed-off-by: Leonardo Cecchi <[email protected]> Assisted-by: Claude
bc2de22 to
3ffa690
Compare
|
Thanks for picking this up. I think one gap remains: the captured LSN doesn't cover the delay Example, 2 instances, @GellertBabel's commit closes this by requesting a I've sent an updated PostgreSQL patch (based on Ants Aasma's) that applies the reload during fast |
With quorum-based failover enabled, the primary lists the synchronous standbys in the FailoverQuorum resource right after applying a new synchronous replication configuration. Those standbys were not necessarily up to date: for example, right after a promotion they may still be catching up with the new primary. The operator could then consider a failover safe while some transactions acknowledged under the previous configuration were not on enough of the listed standbys, and promoting a replica could lose them.
The primary now takes its current WAL position when it detects a change in the standby list, empties the FailoverQuorum resource, and publishes the new list only when at least as many listed standbys as the configured synchronous number are streaming and have flushed that position. Until then no failover is allowed, and the check is repeated every second without blocking the rest of the reconciliation.
If the configuration changes again while waiting, the position is taken again. If the instance manager restarts, a later position is taken, which can only make the check stricter.
Refs #8790