Re: vacuum_truncate configuration parameter and isset_offset

From: Nikolay Shaplov <dhyan(at)nataraj(dot)su>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Treat <rob(at)xzilla(dot)net>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Albe <laurenz(dot)albe(at)cybertec(dot)at>, Gurjeet Singh <gurjeet(at)singh(dot)im>, Will Storey <will(at)summercat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: vacuum_truncate configuration parameter and isset_offset
Date: 2025-03-24 20:27:15
Message-ID: 3073811.eGJsNajkDb@thinkpad-pgpro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

В письме от понедельник, 24 марта 2025 г. 23:04:39 MSK пользователь Nathan
Bossart написал:
> > We can have isset_offset, but then we have redesign all options with
> > custom unset behavior to use it, instead of unreachable default value.
> > This will make it consistent then.
>
> I don't see any reason why we are compelled to redesign all such options,
> but in any case, I would think that would be preferable to magic special
> values. For example,
>
> /* -1 is used to disable max threshold */
> vac_max_thresh = (relopts && relopts->vacuum_max_threshold >= -1)
> ? relopts->vacuum_max_threshold
>
> : autovacuum_vac_max_thresh;
>
> would become something like
>
> if (relopts && relopts->vacuum_max_threshold_set)
> vac_max_thresh = relopts->vacuum_max_threshold;
> else
> vac_max_thresh = autovacuum_vac_max_thresh;

I totally agree. This looks much nicer. But see how the code would change for
fillfactor, where default value is in valid range and to be actually used?

What would happen to default_val attribute in relopt_* structures? Should we
keep it? Should we remove it? If we keep it, what should we set for
vacuum_max_threshold? If we remove it how we should treat default value for
fillfactor?

Then you see, you will have extra int field for at least for every option with
unreachable defaults. Do we really need this?

default_val and isset_* flags are two completely different ways to do similar
thing. You will never find a nice way to use them both. So I am up to keeping
it the way it is: there exist only default_val and it is used to detect unset
option when needed.

> But again, I don't see any strong reason why we must change all such
> reloptions.

Because code of the engine should be consistent. We can't have two different
ways to do same thing. If we have isset flag, we should go for it everywhere,
where isset logic exists. Or do not use it at all. Other ways will lead us to
a much bigger mess, then we have today.

--
Nikolay Shaplov aka Nataraj
Fuzzing Engineer at Postgres Professional
Matrix IM: @dhyan:nataraj.su

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matheus Alcantara 2025-03-24 20:33:26 Re: dblink: Add SCRAM pass-through authentication
Previous Message Nathan Bossart 2025-03-24 20:04:39 Re: vacuum_truncate configuration parameter and isset_offset