From a2b02293bc65dbb2401cb19c724f52c6ee0f2faf Mon Sep 17 00:00:00 2001 From: Álvaro Herrera Date: Thu, 6 Nov 2025 20:33:57 +0100 Subject: Use XLogRecPtrIsValid() in various places Now that commit 06edbed47862 has introduced XLogRecPtrIsValid(), we can use that instead of: - XLogRecPtrIsInvalid() - direct comparisons with InvalidXLogRecPtr - direct comparisons with literal 0 This makes the code more consistent. Author: Bertrand Drouvot Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal --- src/backend/replication/logical/slotsync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/replication/logical/slotsync.c') diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index b122d99b009..8b4afd87dc9 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -493,7 +493,7 @@ reserve_wal_for_local_slot(XLogRecPtr restart_lsn) ReplicationSlot *slot = MyReplicationSlot; Assert(slot != NULL); - Assert(XLogRecPtrIsInvalid(slot->data.restart_lsn)); + Assert(!XLogRecPtrIsValid(slot->data.restart_lsn)); while (true) { @@ -899,8 +899,8 @@ synchronize_slots(WalReceiverConn *wrconn) * pg_replication_slots view, then we can avoid fetching RS_EPHEMERAL * slots in the first place. */ - if ((XLogRecPtrIsInvalid(remote_slot->restart_lsn) || - XLogRecPtrIsInvalid(remote_slot->confirmed_lsn) || + if ((!XLogRecPtrIsValid(remote_slot->restart_lsn) || + !XLogRecPtrIsValid(remote_slot->confirmed_lsn) || !TransactionIdIsValid(remote_slot->catalog_xmin)) && remote_slot->invalidated == RS_INVAL_NONE) pfree(remote_slot); -- cgit v1.2.3