Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Date: 2023-03-06 08:17:35
Message-ID: CALj2ACUWb3aheVKvVLCST7NKN=L7raa4YLupczbB=QE9rffjpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 6, 2023 at 1:26 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Sat, Mar 04, 2023 at 09:47:05AM +0530, Bharath Rupireddy wrote:
> > Okay, here's a patch attached.
>
> Thanks.
>
> + * When source == XLOG_FROM_ANY, this function first searches for the segment
> + * with a TLI in archive first, if not found, it searches in pg_wal. This way,
> + * if there is a WAL segment with same passed-in segno but different TLI
> + * present in both the archive and pg_wal, it prefers the one with higher TLI.
> + * The reason for this is that if for example we try to do archive recovery to
> + * timeline 2, which branched off timeline 1, but the WAL for timeline 2 is not
> + * archived yet, we would replay past the timeline switch point on timeline 1
> + * using the archived WAL segment, before even looking timeline 2's WAL
> + * segments in pg_wal.
>
> This is pretty much what the commit has mentioned. The first half
> provides enough details, IMO.

IMO, mentioning the example from the commit message in the function
comment makes things more clear - one doesn't have to go look for the
commit message for that.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-03-06 08:27:36 Re: Add support for unit "B" to pg_size_pretty()
Previous Message David Rowley 2023-03-06 08:16:41 Re: using memoize in in paralel query decreases performance