Re: Questions about the continuity of WAL archiving

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: px shi <spxlyy123(at)gmail(dot)com>, Justin <zzzzz(dot)graf(at)gmail(dot)com>
Cc: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Questions about the continuity of WAL archiving
Date: 2025-08-13 15:09:27
Message-ID: ce2b8db9-1d9f-4294-90d5-beef3f8a9e87@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/12/25 22:48, px shi wrote:
> Here’s a scenario: The latest WAL file on the primary node is
> 0000000100000000000000AF, and the standby node has also received up to
> 0000000100000000000000AF. However, the latest WAL file that has been
> successfully archived from the primary is only 0000000100000000000000A1
> (WAL files from A2 to AE have not yet been archived). If the primary
> crashes at this point, triggering a failover, the new primary will start
> generating and archiving WAL on a new timeline (2), beginning with
> 0000000200000000000000AF. It will not backfill the missing WAL files
> from timeline 1 (0000000100000000000000A2 to 0000000100000000000000AE).
> As a result, while the new primary does not have any local WAL gaps, the
> archive directory will contain a gap in that WAL range.
> I’m not sure if I explained it clearly.

Why does it matter?

1) Your standby is starting off up to date.

2) You can do a pg_basebackup from the new primary as a base for the
restart of the old primary. Assuming you have archiving set up on the
new primary then the restarted primary can catch up.

3) If you don't want to do 2) then you need an archive location that can
deal with the velocity of the WAL archiving.

>
>
> Justin <zzzzz(dot)graf(at)gmail(dot)com <mailto:zzzzz(dot)graf(at)gmail(dot)com>> 于2025年8月
> 13日周三 10:51写道:
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2025-08-14 07:07:36 Strange deadlock with object/target of lock : transaction
Previous Message Justin 2025-08-13 14:05:29 Re: Questions about the continuity of WAL archiving