Re: vacuum_truncate configuration parameter and isset_offset
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Nikolay Shaplov <dhyan@nataraj.su>
Cc: Robert Haas <robertmhaas@gmail.com>, Álvaro Herrera <alvherre@alvh.no-ip.org>, "David G. Johnston" <david.g.johnston@gmail.com>, pgsql-hackers@lists.postgresql.org, Robert Treat <rob@xzilla.net>, Fujii Masao <masao.fujii@oss.nttdata.com>, Albe <laurenz.albe@cybertec.at>, Gurjeet Singh <gurjeet@singh.im>, Will Storey <will@summercat.com>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2025-03-24T20:04:39Z
Lists: pgsql-hackers
On Mon, Mar 24, 2025 at 10:35:41PM +0300, Nikolay Shaplov wrote: > 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; The former requires you to know that the reloption defaults to -2 if not set, which does not seem particularly obvious to me. At least, I did not find this out-of-range reloption default technique obvious when I was working on autovacuum_vacuum_max_threshold. But again, I don't see any strong reason why we must change all such reloptions. -- nathan