From af03c619ec98d17b163aaed74619b96a3bb56838 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 14 Jun 2024 09:16:57 +0200 Subject: [PATCH 1/2] Standby cluster can't have synchronous nodes (#3079) `synchronous_standby_names` and synchronous replication only work on a real primary node and in case of cascading replication simply ignored by Postgres. This fact was already addressed by `global_config.is_synchronous_mode`, but in case if in a standby cluster the `/sync` key in DCS is not empty, `patronictl list` and `GET /cluster` were falsely reporting some nodes as synchronous because this check was missing. Close https://github.com/zalando/patroni/issues/3078 --- patroni/utils.py | 2 +- tests/test_ctl.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/patroni/utils.py b/patroni/utils.py index c40e1248e..560d25701 100644 --- a/patroni/utils.py +++ b/patroni/utils.py @@ -952,7 +952,7 @@ def cluster_as_json(cluster: 'Cluster') -> Dict[str, Any]: for m in cluster.members: if m.name == leader_name: role = 'standby_leader' if config.is_standby_cluster else 'leader' - elif cluster.sync.matches(m.name): + elif config.is_synchronous_mode and cluster.sync.matches(m.name): role = 'sync_standby' else: role = 'replica' diff --git a/tests/test_ctl.py b/tests/test_ctl.py index 5b56c93ab..d5d83740e 100644 --- a/tests/test_ctl.py +++ b/tests/test_ctl.py @@ -503,6 +503,14 @@ def test_list_extended(self): assert '2100' in result.output assert 'Scheduled restart' in result.output + def test_list_standby_cluster(self): + cluster = get_cluster_initialized_without_leader(leader=True, sync=('leader', 'other')) + cluster.config.data.update(synchronous_mode=True, standby_cluster={'port': 5433}) + with patch('patroni.dcs.AbstractDCS.get_cluster', Mock(return_value=cluster)): + result = self.runner.invoke(ctl, ['list']) + self.assertEqual(result.exit_code, 0) + self.assertNotIn('Sync Standby', result.output) + def test_topology(self): cluster = get_cluster_initialized_with_leader() cluster.members.append(Member(0, 'cascade', 28, From 2a003a36bbcb245d4e1ba059396e59c3add5127f Mon Sep 17 00:00:00 2001 From: Polina Bungina <27892524+hughcapet@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:47:57 +0200 Subject: [PATCH 2/2] Adjust allow_in_place_tablespaces availability (#3081) --- patroni/postgresql/available_parameters/0_postgres.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/postgresql/available_parameters/0_postgres.yml b/patroni/postgresql/available_parameters/0_postgres.yml index a633b44ec..a745084cb 100644 --- a/patroni/postgresql/available_parameters/0_postgres.yml +++ b/patroni/postgresql/available_parameters/0_postgres.yml @@ -4,7 +4,7 @@ parameters: version_from: 170000 allow_in_place_tablespaces: - type: Bool - version_from: 150000 + version_from: 100000 allow_system_table_mods: - type: Bool version_from: 90300