v2-0002-Add-a-debug-message-and-enable-DEBUG-log-in-slots.patch
application/octet-stream
Filename: v2-0002-Add-a-debug-message-and-enable-DEBUG-log-in-slots.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch v2-0002
Subject: Add a debug message and enable DEBUG log in slotsync test
| File | + | − |
|---|---|---|
| src/backend/replication/logical/slotsync.c | 2 | 0 |
| src/test/recovery/t/040_standby_failover_slots_sync.pl | 14 | 0 |
From 1bb871656f90e3fe3c8b8c55e9262298811a0ae1 Mon Sep 17 00:00:00 2001
From: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Date: Thu, 15 Feb 2024 18:38:08 +0800
Subject: [PATCH v2 2/2] Add a debug message and enable DEBUG log in slotsync
test
---
src/backend/replication/logical/slotsync.c | 2 ++
.../recovery/t/040_standby_failover_slots_sync.pl | 14 ++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index f130d2d579..b597781d2f 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -321,6 +321,8 @@ reserve_wal_for_local_slot(XLogRecPtr restart_lsn)
oldest_segno = XLogGetOldestSegno(cur_timeline);
}
+ elog(DEBUG1, "segno: %ld oldest_segno: %ld", oldest_segno, segno);
+
/*
* If all required WAL is still there, great, otherwise retry. The
* slot should prevent further removal of WAL, unless there's a
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 7ad5f2eb11..d4e0ac941b 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -130,14 +130,21 @@ $standby1->init_from_backup(
has_streaming => 1,
has_restoring => 1);
+# Increase the log_min_messages setting to DEBUG1 on both the standby and
+# primary. This will allow for more detailed information collection, which can
+# be valuable for analysis purposes.
my $connstr_1 = $primary->connstr;
$standby1->append_conf(
'postgresql.conf', qq(
hot_standby_feedback = on
primary_slot_name = 'sb1_slot'
primary_conninfo = '$connstr_1 dbname=postgres'
+log_min_messages = 'debug1'
));
+$primary->append_conf('postgresql.conf', "log_min_messages = 'debug1'");
+$primary->reload;
+
$primary->psql('postgres',
q{SELECT pg_create_logical_replication_slot('lsub2_slot', 'test_decoding', false, false, true);}
);
@@ -265,6 +272,13 @@ is( $standby1->safe_psql(
"t",
'logical slot is re-synced');
+# Reset the log_min_messages to the default value.
+$primary->append_conf('postgresql.conf', "log_min_messages = 'warning'");
+$primary->reload;
+
+$standby1->append_conf('postgresql.conf', "log_min_messages = 'warning'");
+$standby1->reload;
+
##################################################
# Test that a synchronized slot can not be decoded, altered or dropped by the
# user
--
2.30.0.windows.2