[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#990723: unblock: barman/2.12-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package barman

[ Reason ]
The existing package does not support PG13 and users will have a hard
time actually restoring backups from archive.

[ Tests ]
The upstream git repository does contain tests, but the shipped
tarball does not. I have no idea why they thought this is a good idea,
and I'm only fixing this since Marco seems unavailable.

The fix has been confirmed to work upstream and the diff looks sane.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

unblock barman/2.12-2

Thanks,
Christoph
No differences were encountered between the control files

diff -Nru barman-2.12/debian/changelog barman-2.12/debian/changelog
--- barman-2.12/debian/changelog	2020-11-04 10:39:52.000000000 +0100
+++ barman-2.12/debian/changelog	2021-07-05 17:59:18.000000000 +0200
@@ -1,3 +1,10 @@
+barman (2.12-2) unstable; urgency=medium
+
+  * Team upload.
+  * PG 13 expects wal_keep_size, not wal_keep_segments. (Closes: #990304)
+
+ -- Christoph Berg <myon@debian.org>  Mon, 05 Jul 2021 17:59:18 +0200
+
 barman (2.12-1) unstable; urgency=medium
 
   * New upstream version 2.12
diff -Nru barman-2.12/debian/patches/pg13 barman-2.12/debian/patches/pg13
--- barman-2.12/debian/patches/pg13	1970-01-01 01:00:00.000000000 +0100
+++ barman-2.12/debian/patches/pg13	2021-07-05 17:59:14.000000000 +0200
@@ -0,0 +1,125 @@
+commit 45ccd9d2f315ec208eee778eba1333c0aa4a4460
+Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
+Date:   Wed Jan 20 19:47:37 2021 +0530
+
+    Fetch wal_keep_size, not wal_keep_segments, from Postgres 13
+    
+    The `wal_keep_segments` parameter introduced in v9.0 was replaced with
+    `wal_keep_size` in v13. Running Barman against Postgres 13 resulted in
+    errors like the following being logged:
+    
+        barman ERROR:  unrecognized configuration parameter "wal_keep_segments"
+        barman STATEMENT:  SHOW "wal_keep_segments"
+    
+    Here we change fetch_remote_status() to ask for wal_keep_size if the
+    server version is >= 13. We didn't use this value anywhere, so we don't
+    need any further changes to adapt to the different return value.
+    
+    Signed-off-by: Abhijit Menon-Sen <ams@2ndQuadrant.com>
+
+diff --git a/barman/postgres.py b/barman/postgres.py
+index 2414f77..6664620 100644
+--- a/barman/postgres.py
++++ b/barman/postgres.py
+@@ -827,7 +827,12 @@ class PostgreSQLConnection(PostgreSQL):
+                 pg_settings.append('wal_level')
+                 pg_settings.append('hot_standby')
+                 pg_settings.append('max_wal_senders')
+-                pg_settings.append('wal_keep_segments')
++                # Retrieve wal_keep_segments from version 9.0 onwards, until
++                # version 13.0, where it was renamed to wal_keep_size
++                if self.server_version < 130000:
++                    pg_settings.append('wal_keep_segments')
++                else:
++                    pg_settings.append('wal_keep_size')
+ 
+             if self.server_version >= 90300:
+                 pg_settings.append('data_checksums')
+diff --git a/doc/manual/42-server-commands.en.md b/doc/manual/42-server-commands.en.md
+index 90caea7..20e91d9 100644
+--- a/doc/manual/42-server-commands.en.md
++++ b/doc/manual/42-server-commands.en.md
+@@ -198,7 +198,8 @@ record of the transaction log. When the status file needs to be
+ cleaned, the `--reset` option can be used.
+ 
+ > **IMPORTANT:** If you are not using replication slots, you rely
+-> on the value of `wal_keep_segments`. Be aware that under high peeks
++> on the value of `wal_keep_segments` (or `wal_keep_size` from
++> PostgreSQL version 13.0 onwards). Be aware that under high peaks
+ > of workload on the database, the `receive-wal` process
+ > might fall behind and go out of sync. As a precautionary measure,
+ > Barman currently requires that users manually execute the command with the
+#diff --git a/tests/test_postgres.py b/tests/test_postgres.py
+#index 83c9f14..67636bb 100644
+#--- a/tests/test_postgres.py
+#+++ b/tests/test_postgres.py
+#@@ -822,6 +822,8 @@ class TestPostgres(object):
+#            new_callable=PropertyMock)
+#     @patch('barman.postgres.PostgreSQLConnection.is_in_recovery',
+#            new_callable=PropertyMock)
+#+    @patch('barman.postgres.PostgreSQLConnection.has_backup_privileges',
+#+           new_callable=PropertyMock)
+#     @patch('barman.postgres.PostgreSQLConnection.is_superuser',
+#            new_callable=PropertyMock)
+#     @patch('barman.postgres.PostgreSQLConnection.server_txt_version',
+#@@ -847,6 +849,7 @@ class TestPostgres(object):
+#                                has_pgespresso_mock,
+#                                server_txt_version_mock,
+#                                is_superuser_mock,
+#+                               has_backup_privileges_mock,
+#                                is_in_recovery_mock,
+#                                archive_timeout_mock,
+#                                checkpoint_timeout_mock,
+#@@ -867,6 +870,7 @@ class TestPostgres(object):
+#         has_pgespresso_mock.return_value = True
+#         server_txt_version_mock.return_value = '9.5.0'
+#         is_in_recovery_mock.return_value = False
+#+        has_backup_privileges_mock.return_value = True
+#         is_superuser_mock.return_value = True
+#         get_configuration_files_mock.return_value = {'a': 'b'}
+#         get_synchronous_standby_names_mock.return_value = []
+#@@ -885,6 +889,7 @@ class TestPostgres(object):
+#             'max_replication_slots': 'a max_replication_slots value',
+#             'wal_compression': 'a wal_compression value',
+#             'wal_keep_segments': 'a wal_keep_segments value',
+#+            'wal_keep_size': 'a wal_keep_size value',
+#         }
+# 
+#         get_setting_mock.side_effect = lambda x: settings.get(x, 'unknown')
+#@@ -948,6 +953,36 @@ class TestPostgres(object):
+#             'postgres_systemid': 6721602258895701769,
+#         }
+# 
+#+        # Test PostgreSQL 13
+#+        conn_mock.return_value.server_version = 130000
+#+        result = server.postgres.fetch_remote_status()
+#+        assert result == {
+#+            'a': 'b',
+#+            'is_superuser': True,
+#+            'has_backup_privileges': True,
+#+            'is_in_recovery': False,
+#+            'current_lsn': 'DE/ADBEEF',
+#+            'current_xlog': '00000001000000DE00000000',
+#+            'data_directory': 'a directory',
+#+            'pgespresso_installed': True,
+#+            'server_txt_version': '9.5.0',
+#+            'wal_level': 'a wal_level value',
+#+            'current_size': 497354072,
+#+            'replication_slot_support': True,
+#+            'replication_slot': None,
+#+            'synchronous_standby_names': [],
+#+            'archive_timeout': 300,
+#+            'checkpoint_timeout': 600,
+#+            'wal_keep_size': 'a wal_keep_size value',
+#+            'hot_standby': 'a hot_standby value',
+#+            'max_wal_senders': 'a max_wal_senderse value',
+#+            'data_checksums': 'a data_checksums',
+#+            'max_replication_slots': 'a max_replication_slots value',
+#+            'wal_compression': 'a wal_compression value',
+#+            'xlog_segment_size': 8388608,
+#+            'postgres_systemid': 6721602258895701769,
+#+        }
+#+
+#         # Test error management
+#         server.postgres.close()
+#         conn_mock.side_effect = psycopg2.DatabaseError
diff -Nru barman-2.12/debian/patches/series barman-2.12/debian/patches/series
--- barman-2.12/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ barman-2.12/debian/patches/series	2021-07-05 17:57:35.000000000 +0200
@@ -0,0 +1 @@
+pg13

Reply to: