From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing.
Date: Tue, 18 May 2021 17:13:36 +0900
Message-ID: <28e612b8-4335-6498-55c2-dc9b03a0f56f@oss.nttdata.com> (raw)
In-Reply-To: <CAFiTN-sOs-LnHkCaGsKMoc0CKhztJwzP4wGfn8_O21fFVspakg@mail.gmail.com>
References: <f706876c-4894-0ba5-6f4d-79803eeea21b@oss.nttdata.com>
<CAFiTN-sOs-LnHkCaGsKMoc0CKhztJwzP4wGfn8_O21fFVspakg@mail.gmail.com>
On 2021/05/18 14:53, Dilip Kumar wrote:
> On Mon, May 17, 2021 at 7:59 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>>
>> If a promotion is triggered while recovery is paused, the paused state ends
>> and promotion continues. But currently pg_get_wal_replay_pause_state()
>> returns 'paused' in that case. Isn't this a bug?
>>
>> Attached patch fixes this issue by resetting the recovery pause state to
>> 'not paused' when standby promotion is triggered.
>>
>> Thought?
>>
>
> I think, prior to commit 496ee647ecd2917369ffcf1eaa0b2cdca07c8730
> (Prefer standby promotion over recovery pause.) this behavior was fine
> because the pause was continued but after this commit now we are
> giving preference to pause so this is a bug so need to be fixed.
>
> The fix looks fine but I think along with this we should also return
> immediately from the pause loop if promotion is requested. Because if
> we recheck the recovery pause then someone can pause again and we will
> be in loop so better to exit as soon as promotion is requested, see
> attached patch. Should be applied along with your patch.
But this change can cause the recovery to continue with insufficient parameter
settings if a promotion is requested while the server is in the paused state
because of such invalid settings. This behavior seems not safe.
If this my understanding is right, the recovery should abort immediately
(i.e., FATAL error ""recovery aborted because of insufficient parameter settings"
should be thrown) if a promotion is requested in that case, like when
pg_wal_replay_resume() is executed in that case. Thought?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
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-hackers@postgresql.org
Cc: masao.fujii@oss.nttdata.com, dilipbalaut@gmail.com
Subject: Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing.
In-Reply-To: <28e612b8-4335-6498-55c2-dc9b03a0f56f@oss.nttdata.com>
* 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