State change in patroni 3.0.4
Since patroni 3.0.4, standby node nominal state is "streaming" instead of "running". Some services need to be changed to account for that. Reported in issue #28
This commit is contained in:
parent
e9f197b9d9
commit
2f250e846e
|
@ -165,7 +165,7 @@ Usage: check_patroni cluster_has_replica [OPTIONS]
|
||||||
Check if the cluster has healthy replicas.
|
Check if the cluster has healthy replicas.
|
||||||
|
|
||||||
A healthy replica:
|
A healthy replica:
|
||||||
* is in running state
|
* is in running or streaming state (V3.0.4)
|
||||||
* has a replica role
|
* has a replica role
|
||||||
* has a lag lower or equal to max_lag
|
* has a lag lower or equal to max_lag
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ Usage: check_patroni cluster_node_count [OPTIONS]
|
||||||
* running custom bootstrap script, custom bootstrap failed
|
* running custom bootstrap script, custom bootstrap failed
|
||||||
* starting, start failed
|
* starting, start failed
|
||||||
* restarting, restart failed
|
* restarting, restart failed
|
||||||
* running
|
* running, streaming (for a replica V3.0.4)
|
||||||
* stopping, stopped, stop failed
|
* stopping, stopped, stop failed
|
||||||
* creating replica
|
* creating replica
|
||||||
* crashed
|
* crashed
|
||||||
|
|
|
@ -229,7 +229,7 @@ def cluster_node_count(
|
||||||
* running custom bootstrap script, custom bootstrap failed
|
* running custom bootstrap script, custom bootstrap failed
|
||||||
* starting, start failed
|
* starting, start failed
|
||||||
* restarting, restart failed
|
* restarting, restart failed
|
||||||
* running
|
* running, streaming (for a replica V3.0.4)
|
||||||
* stopping, stopped, stop failed
|
* stopping, stopped, stop failed
|
||||||
* creating replica
|
* creating replica
|
||||||
* crashed
|
* crashed
|
||||||
|
@ -322,7 +322,7 @@ def cluster_has_replica(
|
||||||
|
|
||||||
\b
|
\b
|
||||||
A healthy replica:
|
A healthy replica:
|
||||||
* is in running state
|
* is in running or streaming state (V3.0.4)
|
||||||
* has a replica role
|
* has a replica role
|
||||||
* has a lag lower or equal to max_lag
|
* has a lag lower or equal to max_lag
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,11 @@ class ClusterHasReplica(PatroniResource):
|
||||||
for member in item_dict["members"]:
|
for member in item_dict["members"]:
|
||||||
# FIXME are there other acceptable states
|
# FIXME are there other acceptable states
|
||||||
if member["role"] == "replica":
|
if member["role"] == "replica":
|
||||||
if member["state"] == "running" and member["lag"] != "unknown":
|
# patroni 3.0.4 changed the standby state from running to streaming
|
||||||
|
if (
|
||||||
|
member["state"] in ["running", "streaming"]
|
||||||
|
and member["lag"] != "unknown" # noqa: W503
|
||||||
|
):
|
||||||
replicas.append({"name": member["name"], "lag": member["lag"]})
|
replicas.append({"name": member["name"], "lag": member["lag"]})
|
||||||
if self.max_lag is None or self.max_lag >= int(member["lag"]):
|
if self.max_lag is None or self.max_lag >= int(member["lag"]):
|
||||||
healthy_replica += 1
|
healthy_replica += 1
|
||||||
|
|
Loading…
Reference in a new issue