Skip to content

Commit

Permalink
Addressing review comments (will squash)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedodd committed Jun 2, 2022
1 parent db78a4d commit 07e950e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
env:
PYTHONWARNINGS: ignore

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion docs/SETTINGS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Dynamic configuration is stored in the DCS (Distributed Configuration Store) and
- **max\_timelines\_history**: maximum number of timeline history items kept in DCS. Default value: 0. When set to 0, it keeps the full history in DCS.
- **master\_start\_timeout**: the amount of time a master is allowed to recover from failures before failover is triggered (in seconds). Default is 300 seconds. When set to 0 failover is done immediately after a crash is detected if possible. When using asynchronous replication a failover can cause lost transactions. Worst case failover time for master failure is: loop\_wait + master\_start\_timeout + loop\_wait, unless master\_start\_timeout is zero, in which case it's just loop\_wait. Set the value according to your durability/availability tradeoff.
- **master\_stop\_timeout**: the number of seconds Patroni is allowed to wait when stopping Postgres and effective only when synchronous_mode is enabled. When set to > 0 and the synchronous_mode is enabled, Patroni sends SIGKILL to the postmaster if the stop operation is running for more than the value set by master_stop_timeout. Set the value according to your durability/availability tradeoff. If the parameter is not set or set <= 0, master_stop_timeout does not apply.
- **static\_primary**: enables a few optimizations to ensure that a cluster configured with a static primary will not unnecessarily demote the cluster primary. This is useful for cases where a cluster is running as a single-node cluster. When this value is set, replicas will refuse to boot until the config value is removed from DCS config.
- **static\_primary**: enables a few optimizations to ensure that a cluster configured with a static primary will not unnecessarily demote the cluster primary. This is useful for cases where a cluster is running as a single-node cluster. When this value is set, replicas will refuse to boot until the config value is removed from DCS config. **WARNING:** this feature is currently designed for use in single-node Patroni clusters. If additional members are added to a cluster with a configured static primary, those members must be running Patroni >= 2.2.0, else they will eventually violate cluster consensus, which is not safe for your data. The current behavior of replicas added to a cluster with a static primary is to shutdown. Better support for replicas with a static primary is being planned.
- **synchronous\_mode**: turns on synchronous replication mode. In this mode a replica will be chosen as synchronous and only the latest leader and synchronous replica are able to participate in leader election. Synchronous mode makes sure that successfully committed transactions will not be lost at failover, at the cost of losing availability for writes when Patroni cannot ensure transaction durability. See :ref:`replication modes documentation <replication_modes>` for details.
- **synchronous\_mode\_strict**: prevents disabling synchronous replication if no synchronous replicas are available, blocking all client writes to the master. See :ref:`replication modes documentation <replication_modes>` for details.
- **postgresql**:
Expand Down
2 changes: 1 addition & 1 deletion features/static_primary.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: static primary
Given I start postgres0 as static primary
Then postgres0 is a leader after 10 seconds
And there is a non empty initialize key in DCS after 15 seconds
When I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "loop_wait": 2, "synchronous_mode": true}
When I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "loop_wait": 2}
Then I receive a response code 200
When I start postgres1 with a configured static primary will not boot after 20 seconds
And I start postgres2 with a configured static primary will not boot after 20 seconds
Expand Down
4 changes: 2 additions & 2 deletions patroni/ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def is_leader(self):
def is_static_primary(self):
"""Check if this node is configured as the static primary of the cluster."""
static_primary = self.patroni.config.get('static_primary')
name = self.patroni.config.get('name')
name = self.state_handler.name
if static_primary is None or name is None:
return False
return static_primary == name
Expand Down Expand Up @@ -714,7 +714,6 @@ def is_failover_possible(self, members, check_synchronous=True, cluster_lsn=None
ret = False
cluster_timeline = self.cluster.timeline
if self.is_static_primary():
logger.warning('manual failover: not possible when instance is static primary')
return ret
members = [m for m in members if m.name != self.state_handler.name and not m.nofailover and m.api_url]
if check_synchronous and self.is_synchronous_mode():
Expand Down Expand Up @@ -993,6 +992,7 @@ def process_manual_failover_from_leader(self):

def process_unhealthy_cluster(self):
"""Cluster has no leader key"""

if self.is_healthiest_node():
if self.acquire_lock():
failover = self.cluster.failover
Expand Down

0 comments on commit 07e950e

Please sign in to comment.