pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix temporary WAL receiver slot handling on timeline switches
Date: Thu, 27 Aug 2026 16:18:42 +0000
Message-ID: <E1wzcoK-00000002MgY-40FX@gemulon.postgresql.org> (raw)
Fix temporary WAL receiver slot handling on timeline switches
Previously, when wal_receiver_create_temp_slot was enabled, a timeline
switch could cause the walreceiver to try to create the same temporary
replication slot again on the same connection. The slot had already been
created before the first streaming attempt and still existed, so the
second creation attempt failed with a FATAL error such as
"could not create replication slot ...".
The walreceiver would later be restarted and streaming replication could
continue, so this did not permanently break replication. Nevertheless,
the unexpected failure is a bug and should be fixed.
Fix this by tracking whether the temporary replication slot has already
been created for the lifetime of the walreceiver and skipping subsequent
creation attempts. Also copy the retained slot name to shared memory on
each streaming attempt, since RequestXLogStreaming() clears it when
streaming is restarted without a configured primary slot. This also
keeps pg_stat_wal_receiver.slot_name populated after timeline switches.
Backpatch to all supported versions.
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Quan Zongliang <quanzongliang@yeah.net>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/tencent_628FDAF814231923BC8E8357BBBC50F94207@qq.com
Backpatch-through: 14
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2bf6144b4e8f806f9a6934a5af3999c65b3504ff
Modified Files
--------------
src/backend/replication/walreceiver.c | 23 +++++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 43 ++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 7 deletions(-)
view thread (7+ messages) latest in thread
Message-ID: <E1wzcoK-00000002MgY-40FX@gemulon.postgresql.org>
Permalink: ../E1wzcoK-00000002MgY-40FX@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wzcoK-00000002MgY-40FX@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix temporary WAL receiver slot handling on timeline switches
In-Reply-To: <E1wzcoK-00000002MgY-40FX@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox