Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/multisite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Details of the configuration parameters
Time to live of site leader lock. If the site is unable to elect a functioning leader within this timeout, a different site can take over the leader role. Must be a few times longer than the usual ``ttl`` value in order to prevent unnecessary site failovers.
``retry_timeout``
How long the global etcd cluster can be inaccessible before the cluster is demoted. Must be a few times longer than the usual ``retry_timeout`` value in order to prevent unnecessary site failovers.
``restore_command``
PostgreSQL restore\_command to use to fetch WAL files from remote site.

Passwords in the YAML configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
13 changes: 13 additions & 0 deletions patroni/multisite.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ def _replication_slot(self) -> Optional[str]:
site_config = global_config.sites.get(self.name)
return site_config and site_config.get('slot')

@property
def _restore_command(self) -> Optional[str]:
site_config = global_config.sites.get(self.name)
if site_config and 'restore_command' in site_config:
return site_config['restore_command']

return self.config.get('restore_command')

def _disconnected_operation(self):
self._standby_config = {'restore_command': 'false'}

Expand All @@ -207,6 +215,11 @@ def _set_standby_config(self, other: Member):
slot = self._replication_slot
if slot:
new_config['primary_slot_name'] = slot

restore_command = self._restore_command
if restore_command:
new_config['restore_command'] = restore_command

old_conf, self._standby_config = self._standby_config, new_config
except KeyError:
old_conf = self._standby_config
Expand Down
Loading