Re: Newly created replication slot may be invalidated by checkpoint - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Newly created replication slot may be invalidated by checkpoint
Date
Msg-id CAA4eK1+T8a7JysOcM6PL1ycfQ6yXvJdDkzrkGOBZGj=fo7S7Lw@mail.gmail.com
Whole thread Raw
In response to RE: Newly created replication slot may be invalidated by checkpoint  ("Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>)
Responses RE: Newly created replication slot may be invalidated by checkpoint
List pgsql-hackers
On Fri, Jan 23, 2026 at 7:33 AM Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.com> wrote:
>
> This patch cannot be applied cleanly on backbranches, I can prepare patches for
> those once the main patch is stable.
>

Some comments:
1.
+ /*
+ * Determine the minimum non-removable LSN by comparing the redo pointer
+ * with the minimum slot LSN.
+ */
+ min_safe_lsn = GetRedoRecPtr();
+ slot_min_lsn = XLogGetReplicationSlotMinimumLSN();

Can we expand these comments a bit to state why we need both
RedoRecPtr and slot's minimum LSN?

2.
+# Verify that while syncing a slot to the standby server, if the WAL before the
+# remote restart_lsn is at risk of being removed by a checkpoint, the slot
+# cannot be synced. Otherwise, even if the slot syncing succeeds, it may be
+# immediately invalidated by the checkpoint.
+my $primary = $node;

This comment atop the testcase is not very clear. Because, it is
testing that the slot is synced and is not invalidated. How about:
"Verify that the synchronized slots won't be invalidated immediately
after synchronization in the presence of a concurrent checkpoint."?

3.
+# Increase the log_min_messages setting to DEBUG2 on both the standby and
+# primary to debug test failures, if any.
+my $connstr_1 = $primary->connstr;

Do we need this DEBUG2? I don't think we should add too many DEBUG2
tests as it increases Log volume.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Xuneng Zhou
Date:
Subject: Re: Add WALRCV_CONNECTING state to walreceiver
Next
From: Eugeny Goryachev
Date:
Subject: [PATCH] Avoid potential NULL dereference in LIKE/ILIKE with C locale