[PATCH] Reuse slot helpers in pg_get_replication_slots and slot copy

From: Tristan Su <sooqing(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Reuse slot helpers in pg_get_replication_slots and slot copy
Date: 2026-12-02 01:55:24
Message-ID: CA+sbV4ggbjOQDjREuy1kH4nzGR+qBcNoSe+iS4cyFz5Ny1bu2Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I noticed two places in slotfuncs.c that reimplement helpers we already
have.

copy_replication_slot() scans ReplicationSlotCtl->replication_slots[]
itself to find the source slot. SearchNamedReplicationSlot() performs
exactly that lookup, and the caller already holds
ReplicationSlotControlLock, so it can be called with
need_lock = false.

pg_get_replication_slots() compares slot_contents.data.database with
InvalidOid three times to distinguish physical from logical slots.
SlotIsPhysical() expresses the same condition, and the same function
already uses this macro elsewhere.

No functional change. make check passes, and the patch applies to
master at cb94cb41. pgindent is clean. No backpatch is intended.

Comments welcome.

Regards,
Tristan Su

Attachment Content-Type Size
0001-Reuse-slot-helpers-in-pg_get_replication_slots-and-s.patch text/plain 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-12-02 01:55:39 RE: logical decoding: removing change_useless_for_repack()
Previous Message Chao Li 2026-12-02 01:44:17 Re: pg_upgrade: backslash escaping in check_for_unicode_update()