Skip to content

Commit d2388a9

Browse files
DPE-7726: Start observer on non-Primary Patroni start to speedup re-join
The current PG16 logic relies on Juju update-status or on_topology_change observer events, while in some cases we start Patroni without the Observer, causing a long waiting story till the next update-status arrives.
1 parent 22bc0ff commit d2388a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/charm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,7 @@ def _on_update_status(self, _) -> None:
19271927

19281928
if not self._patroni.member_started and self._patroni.is_member_isolated:
19291929
self._patroni.restart_patroni()
1930+
self._observer.start_observer()
19301931
return
19311932

19321933
# Update the sync-standby endpoint in the async replication data.
@@ -2056,8 +2057,9 @@ def _handle_processes_failures(self) -> bool:
20562057
logger.info("PostgreSQL data directory was not empty. Moved pg_wal")
20572058
return True
20582059
try:
2059-
self._patroni.restart_patroni()
20602060
logger.info("restarted PostgreSQL because it was not running")
2061+
self._patroni.restart_patroni()
2062+
self._observer.start_observer()
20612063
return True
20622064
except RetryError:
20632065
logger.error("failed to restart PostgreSQL after checking that it was not running")

0 commit comments

Comments
 (0)