From 75f11005f645ef06bb5a3a4c94063241e93f234f Mon Sep 17 00:00:00 2001 From: avandras Date: Wed, 10 Dec 2025 16:55:38 +0100 Subject: [PATCH 1/3] Pick up slot name from config --- patroni/multisite.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/patroni/multisite.py b/patroni/multisite.py index 2a0b08cc0..22352a80f 100644 --- a/patroni/multisite.py +++ b/patroni/multisite.py @@ -190,6 +190,7 @@ def _set_standby_config(self, other: Member): 'port': other.data['port'], 'create_replica_methods': ['basebackup'], 'leader_site': other.name, + 'primary_slot_name': other.data['primary_slot_name'], } except KeyError: old_conf = self._standby_config @@ -383,6 +384,7 @@ def touch_member(self): data = { 'host': self.config['host'], 'port': self.config['port'], + 'primary_slot_name': self.config['primary_slot_name'], } logger.info(f"Touching member {self.name} with {data!r}") self.dcs.touch_member(data) From 54891f5450daa1385a09c4f344c784d458d80c3b Mon Sep 17 00:00:00 2001 From: avandras Date: Wed, 10 Dec 2025 18:11:29 +0100 Subject: [PATCH 2/3] Add documentation for replication slots --- docs/multisite.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/multisite.rst b/docs/multisite.rst index a0ca9de8d..46ea0ff0e 100644 --- a/docs/multisite.rst +++ b/docs/multisite.rst @@ -110,6 +110,7 @@ An example configuration for two Patroni sites: - 10.0.0.1:2379 host: 10.0.1.1,10.0.1.2,10.0.1.3 # How the leader of the other site(s) can connect to the primary on this site port: 5432 + primary_slot_name: dr # Multisite failover timeouts ttl: 90 retry_timeout: 40 @@ -130,6 +131,8 @@ Details of the configuration parameters Comma-separated list of IPs of the Patroni nodes that can become a primary on the present site ``port`` Postgres port, through which other sites' members can connect to this site. It can be specified once if all nodes use the same port, or as a comma-separated list matching the different port numbers, in the order used in the ``host`` key. +``primary_slot_name`` + Optional name of the physical slot used to retain WAL for site failovers. If in use, the slot has to be defined in the dynamic configuration. ``ttl`` 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`` From d2c080368d4a8cf9c0c46756a7c85b220a4d267c Mon Sep 17 00:00:00 2001 From: avandras Date: Fri, 12 Dec 2025 14:36:33 +0100 Subject: [PATCH 3/3] Make primary_slot_name optional --- patroni/multisite.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patroni/multisite.py b/patroni/multisite.py index 22352a80f..c669b2e7b 100644 --- a/patroni/multisite.py +++ b/patroni/multisite.py @@ -190,7 +190,7 @@ def _set_standby_config(self, other: Member): 'port': other.data['port'], 'create_replica_methods': ['basebackup'], 'leader_site': other.name, - 'primary_slot_name': other.data['primary_slot_name'], + 'primary_slot_name': other.data.get('primary_slot_name'), } except KeyError: old_conf = self._standby_config @@ -384,8 +384,10 @@ def touch_member(self): data = { 'host': self.config['host'], 'port': self.config['port'], - 'primary_slot_name': self.config['primary_slot_name'], } + if self.config['primary_slot_name']: + data['primary_slot_name'] = self.config['primary_slot_name'] + logger.info(f"Touching member {self.name} with {data!r}") self.dcs.touch_member(data)