Re: Disable WAL logging to speed up data loading - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Disable WAL logging to speed up data loading
Date
Msg-id d7d00ef78c952c6a3ad1b49386c9359235b78297.camel@cybertec.at
Whole thread Raw
In response to Re: Disable WAL logging to speed up data loading  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
On Fri, 2020-10-30 at 05:00 +0900, Fujii Masao wrote:
> > But as I said in the other thread, changing wal_level emits a WAL
> > record, and I am sure that recovery will refuse to proceed if
> > wal_level < replica.
> 
> Yes. What I meant was such a safe guard needs to be implemented.

That should be easy; just modify this code:

static void
CheckRequiredParameterValues(void)
{
    /*
     * For archive recovery, the WAL must be generated with at least 'replica'
     * wal_level.
     */
    if (ArchiveRecoveryRequested &&
ControlFile->wal_level == WAL_LEVEL_MINIMAL)
    {
        ereport(WARNING,
                (errmsg("WAL was generated with wal_level=minimal, data may be missing"),
                 errhint("This happens
if you temporarily set wal_level=minimal without taking a new base backup.")));
    }

so that it tests

    if (ArchiveRecoveryRequested && ControlFile->wal_level <= WAL_LEVEL_MINIMAL)

and we should be safe.

Yours,
Laurenz Albe




pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Enumize logical replication message actions
Next
From: vignesh C
Date:
Subject: Re: Log message for GSS connection is missing once connection authorization is successful.