Re: Does pg_ctl promote wait for pending WAL?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
Cc: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Does pg_ctl promote wait for pending WAL?
Date: 2021-01-29 07:24:51
Message-ID: YBO4Q3TMzSPm76k6@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ishii-san,

On Fri, Jan 29, 2021 at 07:59:26AM +0100, Paul Förster wrote:
> On 29. Jan, 2021, at 03:51, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:
>>
>> Does anybody know whether a standby server waits for pending WAL
>> records/files while promotion is requested? I assume that no data
>> update is performed on the primary server while promotion.
>>
>> I imagine that a standby server stops to replay WAL and promotes as
>> soon as SIGUSR1 signal is received.

To answer to your question based on the code, you can check for the
code paths calling CheckForStandbyTrigger() in xlog.c when it comes to
promotion detection in the WAL replay. In short,
WaitForWALToBecomeAvailable() tells that after the promotion is
detected in the startup process, then recovery would still try to
replay as much WAL as possible from the archives or pg_wal before a
failover.

Equally, from the docs:
"Before failover, any WAL immediately available in the archive or in
pg_wal will be restored, but no attempt is made to connect to the
primary."
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2021-01-29 07:47:41 Re: Does pg_ctl promote wait for pending WAL?
Previous Message Paul Förster 2021-01-29 06:59:26 Re: Does pg_ctl promote wait for pending WAL?