]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix assertion failure with replication slot release in single-user mode REL_15_STABLE github/REL_15_STABLE
authorMichael Paquier <michael@paquier.xyz>
Wed, 20 Aug 2025 06:00:14 +0000 (15:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 20 Aug 2025 06:00:14 +0000 (15:00 +0900)
commit818be9b73c945e480805fff7e24101da161f71d1
treed6645a07d60fe8ba7bf468e2f7867cd7fc149b7c
parenteb9ee4d1818cd228d80049fd42efbfaabc187c20
Fix assertion failure with replication slot release in single-user mode

Some replication slot manipulations (logical decoding via SQL,
advancing) were failing an assertion when releasing a slot in
single-user mode, because active_pid was not set in a ReplicationSlot
when its slot is acquired.

ReplicationSlotAcquire() has some logic to be able to work with the
single-user mode.  This commit sets ReplicationSlot->active_pid to
MyProcPid, to let the slot-related logic fall-through, considering the
single process as the one holding the slot.

Some TAP tests are added for various replication slot functions with the
single-user mode, while on it, for slot creation, drop, advancing, copy
and logical decoding with multiple slot types (temporary, physical vs
logical).  These tests are skipped on Windows, as direct calls of
postgres --single would fail on permission failures.  There is no
platform-specific behavior that needs to be checked, so living with this
restriction should be fine.  The CI is OK with that, now let's see what
the buildfarm tells.

Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Mutaamba Maasha <maasha@gmail.com>
Discussion: https://postgr.es/m/OSCPR01MB14966ED588A0328DAEBE8CB25F5FA2@OSCPR01MB14966.jpnprd01.prod.outlook.com
Backpatch-through: 13
src/backend/replication/slot.c
src/test/modules/test_misc/Makefile
src/test/modules/test_misc/t/008_replslot_single_user.pl [new file with mode: 0644]