avoid false dropped replication slot log messages

Lakshmi N <lakshmin.jhs@gmail.com>

From: Lakshmi N <lakshmin.jhs@gmail.com>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-05-09T02:47:58Z
Lists: pgsql-hackers

Attachments

Hi hackers,

If the shared-memory entry for a synced slot is concurrently reused by
a user-created slot in the small window between rm collecting the candidate
list and locking the database, drop_local_obsolete_slots() correctly
skips the drop but still emitted a LOG message claiming the slot had
been dropped, naming the unrelated user slot.

Gate the LOG message on the same synced_slot check that gates the drop,
and snapshot the slot name and database OID before calling
ReplicationSlotDropAcquired() so the message reflects what was actually
dropped

Regards,
Lakshmi