Re: HotStandbyActive() issue in postgres

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Hao Wu <hawu(at)vmware(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Paul Guo <guopa(at)vmware(dot)com>
Subject: Re: HotStandbyActive() issue in postgres
Date: 2021-03-12 08:58:32
Message-ID: 29b3ce0f-4cab-e7ea-e492-abe7139ee860@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/03/12 11:14, Hao Wu wrote:
> Hi hackers,
>
> When we enable hot standby, HotStandbyActive() returns true on hot standby.
> Then, we promote the hot standby, the SHM variable `XLogCtl->SharedHotStandbyActive`
> remains true. So, HotStandbyActive() still returns true until the next call of
> `XLOGShmemInit()` even if the data node was promoted.
> `XLogWalRcvSendHSFeedback()` is the only caller of HotStandbyActive,
> it's probably not covered by the test cases.
>
> Is it the expected behavior or a bug in postgres? Probably a bug.
> I haven't much knowledge of hot-standby, a simple fix might be
> to set XLogCtl->SharedHotStandbyActive to false when
> the recovery process almost finishes. See the attachment.

So if walreceiver is only user of HotStandbyActive(), which means that there is no user of it after recovery finishes because walreceiver exits at the end of recovery? If this understanding is right, ISTM that HotStandbyActive() doesn't need to return false after recovery finishes because there is no user of it. No?

Or you're implementing something that uses HotStandbyActive(), so want it to return false after the recovery?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2021-03-12 08:59:20 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Dilip Kumar 2021-03-12 08:42:49 Re: [HACKERS] Custom compression methods