Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: rajesh singarapu <rajesh(dot)rs0541(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs
Date: 2022-05-23 04:50:06
Message-ID: CALj2ACUGKVVCHRpio--KxYsv1ME6+Y_ZwjrQw3S9fBPVzMFv9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 21, 2022 at 11:26 PM rajesh singarapu
<rajesh(dot)rs0541(at)gmail(dot)com> wrote:
>
> On Sat, May 21, 2022 at 7:08 PM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >
> > Hi,
> >
> > Currently postgres allows setting any value for max_wal_size or
> > min_wal_size, not enforcing "at least twice as wal_segment_size" limit
> > [1]. This isn't a problem if the server continues to run, however, the
> > server can't come up after a crash or restart or maintenance or
> > upgrade (goes to a continuous restart loop with FATAL errors [1]).
> >
> > How about we add GUC check hooks for both max_wal_size and
> > min_wal_size where we can either emit ERROR or WARNING if values are
> > not "at least twice as wal_segment_size"?
> >
> > Thoughts?
> >
> > [1]
> > FATAL: "max_wal_size" must be at least twice "wal_segment_size"
> > FATAL: "min_wal_size" must be at least twice "wal_segment_size"
> Hi Bharath,
>
> Could you explain why min wal size must be at least twice but not
> equal to wal_segment_size ?

It is because postgres always needs/keeps at least one WAL file and
the usage of max_wal_size/min_wal_size is in terms of number of WAL
segments/WAL files. It doesn't make sense to set
max_wal_size/min_wal_size to, say, 20MB (where wal_segment_size =
16MB) and expect the server to honor it and do something. Hence the
'at least twice' requirement.

Regards,
Bharath Rupireddy.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2022-05-23 05:13:03 Re: Skipping schema changes in publication
Previous Message Kyotaro Horiguchi 2022-05-23 04:33:23 Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns