mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Apply suggestions from code review
Co-authored-by: Israel <[email protected]>
This commit is contained in:
co-authored by
Israel
parent
94e128c51a
commit
ebdc197f08
+6
-6
@@ -698,7 +698,7 @@ class Ha(object):
|
||||
return self.global_config.is_synchronous_mode
|
||||
|
||||
def is_quorum_commit_mode(self) -> bool:
|
||||
""":returns: `True` if quorum commit replication is requested and "supported"."""
|
||||
"""``True`` if quorum commit replication is requested and "supported"."""
|
||||
return self.global_config.is_quorum_commit_mode and self.state_handler.supports_multiple_sync
|
||||
|
||||
def is_failsafe_mode(self) -> bool:
|
||||
@@ -732,8 +732,8 @@ class Ha(object):
|
||||
def _process_quorum_replication(self) -> None:
|
||||
"""Process synchronous replication state when quorum commit is requested.
|
||||
|
||||
Synchronous standbys are registered in two places postgresql.conf and DCS. The order of updating them must
|
||||
keep the invariant that `quorum + sync >= len(set(quorum pool)|set(sync pool))`. This is done using
|
||||
Synchronous standbys are registered in two places: ``postgresql.conf`` and DCS. The order of updating them must
|
||||
keep the invariant that ``quorum + sync >= len(set(quorum pool)|set(sync pool))``. This is done using
|
||||
:class:`QuorumStateResolver` that given a current state and set of desired synchronous nodes and replication
|
||||
level outputs changes to DCS and synchronous replication in correct order to reach the desired state.
|
||||
In case any of those steps causes an error we can just bail out and let next iteration rediscover the state
|
||||
@@ -876,7 +876,7 @@ class Ha(object):
|
||||
we can promote immediately and let normal quorum resolver process handle any membership changes later.
|
||||
Otherwise, we will just reset DCS state to ourselves and add replicas as they connect.
|
||||
|
||||
:returns: `True` if on success or `False` if failed to update /sync key in DCS.
|
||||
:returns: ``True`` if on success or ``False`` if failed to update /sync key in DCS.
|
||||
"""
|
||||
if not self.is_synchronous_mode():
|
||||
self.disable_synchronous_replication()
|
||||
@@ -1122,7 +1122,7 @@ class Ha(object):
|
||||
|
||||
:param wal_position: Current wal position.
|
||||
|
||||
:returns `True` when node is lagging
|
||||
:returns: ``True`` when node is lagging
|
||||
"""
|
||||
lag = (self.cluster.last_lsn or 0) - wal_position
|
||||
return lag > self.global_config.maximum_lag_on_failover
|
||||
@@ -1133,7 +1133,7 @@ class Ha(object):
|
||||
:param members: the list of nodes to check against
|
||||
:param check_replication_lag: whether to take the replication lag into account.
|
||||
If the lag exceeds configured threshold the node disqualifies itself.
|
||||
:returns: `True` if the node is eligible to become the new leader. Since this method is executed
|
||||
:returns: ``True`` if the node is eligible to become the new leader. Since this method is executed
|
||||
on multiple nodes independently it is possible that multiple nodes could count
|
||||
themselves as the healthiest because they received/replayed up to the same LSN,
|
||||
but this is totally fine.
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ class QuorumStateResolver:
|
||||
break
|
||||
|
||||
def __handle_non_steady_cases(self) -> Iterator[Transition]:
|
||||
"""Handle cases when set of transitions produces on previous run was interrupted.
|
||||
"""Handle cases when set of transitions produced on previous run was interrupted.
|
||||
|
||||
:yields: transitions as :class:`Transition` objects.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user