Re: Split xlog.c - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Split xlog.c
Date
Msg-id ff82d82b-8905-8f94-740d-da8d52baa6e0@iki.fi
Whole thread Raw
In response to Re: Split xlog.c  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
On 17/09/2021 06:10, Kyotaro Horiguchi wrote:
>    recoveryStopReason is always acquired but it is used only after
>    archive recovery.  I'm not sure about reason for the variable to
>    live in that wide context.  Couldn't we remove the variable then
>    call getRecoveryStopReason() directly at the required place?

Robert commented on the same thing, see my reply there.

> 0002:
> 
>    heapam.c, clog.c, twophase.c, dbcommands.c doesn't need  xlogrecvoer.h.

Cleaned that up in v7, thanks!

>> XLogRecCtl
> 
>    "Rec" looks like Record. Couldn't we use "Rcv", "Recov" or just
>    "Recovery" instead?

I never made that association before, but now I cannot unsee it :-). I 
changed it to XLogRecoveryCtl.

>> TimeLineID    PrevTimeLineID;
>> TransactionId oldestActiveXID;
>> bool        promoted = false;
>> EndOfWalRecoveryInfo *endofwal;
>> bool        haveTblspcMap;
> 
>    This is just a matter of taste but the "endofwal" looks somewhat
>    alien in the variables.

Changed to "endOfRecoveryInfo".

> 
> xlog.c:
> +void
> +SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr)
> 
>    Isn't this a function of xlogrecovery.c?  Or rather isn't
>    minRecoveryPoint-related stuff of xlogrecovery.c?

Updating the control file is xlog.c's responsibility. There are two 
different minRecoveryPoints:

1. xlogrecovery.c has a copy of the minRecoveryPoint from the control 
file, so that it knows when we have reached consistency.

2. xlog.c is responsible for updating the minRecoveryPoint in the 
control file, after consistency has been reached.

SwitchIntoArchiveRecovery() is called on the transition.

- Heikki



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Split xlog.c
Next
From: Andres Freund
Date:
Subject: Re: Reduce function call costs on ELF platforms