Re: BUG #17744: Fail Assert while recoverying from pg_basebackup - Mailing list pgsql-bugs

From Bowen Shi
Subject Re: BUG #17744: Fail Assert while recoverying from pg_basebackup
Date
Msg-id CAM_vCufpoQrPyVe2qpLtdeBxXOYRTiBmakfA_Qraaiu0Tk4x=Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17744: Fail Assert while recoverying from pg_basebackup  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-bugs
Thanks for your advice!

I wonder that whether there are some potential risks if we just
compiling the PG code without `--enable-cassert.

regards.

Kyotaro Horiguchi <horikyota.ntt@gmail.com> 于2023年1月13日周五 17:36写道:
>
> At Tue, 10 Jan 2023 07:45:45 +0000, PG Bug reporting form <noreply@postgresql.org> wrote in
> > #2  0x0000000000b378e9 in ExceptionalCondition (
> >     conditionName=0xd13697 "TransactionIdIsValid(initial)",
> >     errorType=0xd12df4 "FailedAssertion", fileName=0xd12de8 "procarray.c",
> >
> >     lineNumber=1750) at assert.c:69
> > #3  0x0000000000962195 in ComputeXidHorizons (h=0x7ffe93de25e0)
> >     at procarray.c:1750
> > #4  0x00000000009628a3 in GetOldestTransactionIdConsideredRunning ()
> >     at procarray.c:2050
> > #5  0x00000000005972bf in CreateRestartPoint (flags=256) at xlog.c:7153
> > #6  0x00000000008cae37 in CheckpointerMain () at checkpointer.c:464
>
> The function requires a valid value in
> ShmemVariableCache->latestCompleteXid. But it is not initialized and
> maintained in this case.  The attached quick hack seems working, but
> of course more decent fix is needed.
>
>
> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
> index 0070d56b0b..667c990301 100644
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -5363,7 +5363,7 @@ StartupXLOG(void)
>                  * control file and we've established a recovery snapshot from a
>                  * running-xacts WAL record.
>                  */
> -               if (ArchiveRecoveryRequested && EnableHotStandby)
> +               if (1 || (ArchiveRecoveryRequested && EnableHotStandby))
>                 {
>                         TransactionId *xids;
>                         int                     nxids;
> diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
> index 94cc860f5f..c814c991f8 100644
> --- a/src/backend/storage/ipc/standby.c
> +++ b/src/backend/storage/ipc/standby.c
> @@ -1161,7 +1161,7 @@ standby_redo(XLogReaderState *record)
>         Assert(!XLogRecHasAnyBlockRefs(record));
>
>         /* Do nothing if we're not in hot standby mode */
> -       if (standbyState == STANDBY_DISABLED)
> +       if (standbyState == STANDBY_DISABLED && info != XLOG_RUNNING_XACTS)
>                 return;
>
>         if (info == XLOG_STANDBY_LOCK)
>
> regards.
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17765: SELECT CAST(true AS BIGINT);
Next
From:
Date:
Subject: Was there a bug fix in the COPY command in Version 15?