On Thu, Nov 9, 2023 at 4:09 PM Alvaro Herrera <alvhe...@alvh.no-ip.org> wrote:
>
> On 2023-Nov-02, Kyotaro Horiguchi wrote:
>
> > diff --git a/src/backend/access/transam/xlog.c 
> > b/src/backend/access/transam/xlog.c
> > index b541be8eec..46833f6ecd 100644
> > --- a/src/backend/access/transam/xlog.c
> > +++ b/src/backend/access/transam/xlog.c
> > @@ -2063,6 +2063,29 @@ check_wal_segment_size(int *newval, void **extra, 
> > GucSource source)
> >       return true;
> >  }
> >
> > +/*
> > + * GUC check_hook for max_slot_wal_keep_size
> > + *
> > + * If WALs needed by logical replication slots are deleted, these slots 
> > become
> > + * inoperable. During a binary upgrade, pg_upgrade sets this variable to 
> > -1 via
> > + * the command line in an attempt to prevent such deletions, but users have
> > + * ways to override it. To ensure the successful completion of the upgrade,
> > + * it's essential to keep this variable unaltered.  See
> > + * InvalidatePossiblyObsoleteSlot() and start_postmaster() in pg_upgrade 
> > for
> > + * more details.
> > + */
> > +bool
> > +check_max_slot_wal_keep_size(int *newval, void **extra, GucSource source)
> > +{
> > +     if (IsBinaryUpgrade && *newval != -1)
> > +     {
> > +             GUC_check_errdetail("\"%s\" must be set to -1 during binary 
> > upgrade mode.",
> > +                     "max_slot_wal_keep_size");
> > +             return false;
> > +     }
> > +     return true;
> > +}
>
> One sentence in that comment reads weird.  I'd do this:
>
> s/To ensure the ... unaltered/This check callback ensures the value is
> not overridden by the user/
>

These comments appear mostly repetitive to what is already mentioned
in start_postmaster(). So, I have changed those referred to already
written comments, and slightly adjusted the comments at another place.
See attached. Personally, I don't see the need for a test for this, so
removed the same but can add it back if you or others think so.

-- 
With Regards,
Amit Kapila.

Attachment: inhibit_m_s_w_k_s_during_upgrade_6.patch
Description: Binary data

Reply via email to