pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Quan Zongliang <quanzongliang@yeah.net>
To: cca5507 <cca5507@qq.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Walreceiver create temp slot more than once when timeline switch
Date: Wed, 26 Aug 2026 11:10:02 +0800
Message-ID: <38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net> (raw)
In-Reply-To: <tencent_EC70BBBC5097C2E55AC0140C19063CA10307@qq.com>
References: <tencent_628FDAF814231923BC8E8357BBBC50F94207@qq.com>
	<fd040b35-7fa4-4d9a-9210-d79ccd75d2e8@yeah.net>
	<CAHGQGwGvMKj_6iLVWUVsFPJrtYOhkKxR7fwrYLrtPjLkhKh4uA@mail.gmail.com>
	<tencent_EC70BBBC5097C2E55AC0140C19063CA10307@qq.com>



On 8/25/26 9:43 PM, cca5507 wrote:
>> I also confirmed that the patch fixes the reported issue. But,
>> during that test, I found that pg_stat_wal_receiver.slot_name became
>> NULL after a timeline switch.
>>
>> I think this can happen because RequestXLogStreaming() clears
>> walrcv->slotname when primary_slot_name is not configured.
>> The walreceiver then does not write the existing temporary slot name
>> back to shared memory because create_temp_slot is already false.
>> Then, streaming continues to use the temporary slot, but
>> pg_stat_wal_receiver.slot_name can show NULL.
> 
> Good catch, fixed.
> 

v2 can show the correct slot_name.

Perform TAP tests using the original and v1 versions of walreceiver.c 
along with 004_timeline_switch.pl. Both issues (creation error and NULL 
slot_name) were reported correctly.

--
Quan Zongliang







view thread (9+ messages)  latest in thread

Message-ID: <38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net>
Permalink:  ../38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net/
Also on:    postgresql.org/message-id/38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: quanzongliang@yeah.net, cca5507@qq.com, masao.fujii@gmail.com
  Subject: Re: Walreceiver create temp slot more than once when timeline switch
  In-Reply-To: <38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net>
  References: <tencent_628FDAF814231923BC8E8357BBBC50F94207@qq.com> <fd040b35-7fa4-4d9a-9210-d79ccd75d2e8@yeah.net> <CAHGQGwGvMKj_6iLVWUVsFPJrtYOhkKxR7fwrYLrtPjLkhKh4uA@mail.gmail.com> <tencent_EC70BBBC5097C2E55AC0140C19063CA10307@qq.com> <38dbe816-9bdd-4199-bb6e-d189a7155dc6@yeah.net>

* 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