pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feed[PATCH] Renumber confusing value for GUC_UNIT_BYTE
6+ messages / 4 participants
[nested] [flat]
Commits from this thread:
2022-09-07 3fe76ab972 Renumber confusing value for GUC_UNIT_BYTE
* [PATCH] Renumber confusing value for GUC_UNIT_BYTE
@ 2022-07-20 14:52 Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 6+ messages in thread
From: Justin Pryzby @ 2022-07-20 14:52 UTC (permalink / raw)
To: Beena Emerson <memissemerson@gmail.com>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-hackers@postgresql.org
The GUC units are currently defined like:
#define GUC_UNIT_KB 0x1000 /* value is in kilobytes */
#define GUC_UNIT_BLOCKS 0x2000 /* value is in blocks */
#define GUC_UNIT_XBLOCKS 0x3000 /* value is in xlog blocks */
#define GUC_UNIT_MB 0x4000 /* value is in megabytes */
#define GUC_UNIT_BYTE 0x8000 /* value is in bytes */
#define GUC_UNIT_MEMORY 0xF000 /* mask for size-related units */
#define GUC_UNIT_MS 0x10000 /* value is in milliseconds */
#define GUC_UNIT_S 0x20000 /* value is in seconds */
#define GUC_UNIT_MIN 0x30000 /* value is in minutes */
#define GUC_UNIT_TIME 0xF0000 /* mask for time-related units */
0x3000 and 0x30000 seemed wrong, since they're a combination of other flags
rather than being an independant power of two.
But actually, these aren't flags: they're tested in a "case" statement for
equality, not in a bitwise & test.
So the outlier is actually 0x8000, added at:
|commit 6e7baa322773ff8c79d4d8883c99fdeff5bfa679
|Author: Andres Freund <andres@anarazel.de>
|Date: Tue Sep 12 12:13:12 2017 -0700
|
| Introduce BYTES unit for GUCs.
It looks like that originated here:
https://www.postgresql.org/message-id/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ%40mail.gma...
commit 162e4838103e7957cccfe7868fc28397b55ca1d7
Author: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Wed Jul 20 09:27:24 2022 -0500
Renumber confusing value for GUC_UNIT_BYTE
It had a power-of-two value, which looks right, and causes the other values
which aren't powers-of-two to look wrong. But this is tested for equality and
not a bitwise test.
See also:
6e7baa322773ff8c79d4d8883c99fdeff5bfa679
https://www.postgresql.org/message-id/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ%40mail.gma...
inline patch 1: src/include/utils/guc.h (+2/-1 lines) download inline-1.patch
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 4d0920c42e2..be928fac881 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -219,11 +219,12 @@ typedef enum
#define GUC_DISALLOW_IN_AUTO_FILE 0x0800 /* can't set in
* PG_AUTOCONF_FILENAME */
+/* GUC_UNIT_* are not flags - they're tested for equality */
#define GUC_UNIT_KB 0x1000 /* value is in kilobytes */
#define GUC_UNIT_BLOCKS 0x2000 /* value is in blocks */
#define GUC_UNIT_XBLOCKS 0x3000 /* value is in xlog blocks */
#define GUC_UNIT_MB 0x4000 /* value is in megabytes */
-#define GUC_UNIT_BYTE 0x8000 /* value is in bytes */
+#define GUC_UNIT_BYTE 0x5000 /* value is in bytes */
#define GUC_UNIT_MEMORY 0xF000 /* mask for size-related units */
#define GUC_UNIT_MS 0x10000 /* value is in milliseconds */
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
@ 2022-09-06 05:44 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-06 05:57 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2022-09-06 05:44 UTC (permalink / raw)
To: Justin Pryzby <pryzby@telsasoft.com>; Beena Emerson <memissemerson@gmail.com>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-hackers@postgresql.org
On 20.07.22 16:52, Justin Pryzby wrote:
> +/* GUC_UNIT_* are not flags - they're tested for equality */
Well, there is GUC_UNIT_MEMORY, etc. so there is an additional
constraint beyond just "pick any number". I'm not sure that "flag" and
"tested for equality" are really antonyms anyway.
I think renumbering this makes sense. We could just leave the comment
as is if we don't come up with a better wording.
> #define GUC_UNIT_KB 0x1000 /* value is in kilobytes */
> #define GUC_UNIT_BLOCKS 0x2000 /* value is in blocks */
> #define GUC_UNIT_XBLOCKS 0x3000 /* value is in xlog blocks */
> #define GUC_UNIT_MB 0x4000 /* value is in megabytes */
> -#define GUC_UNIT_BYTE 0x8000 /* value is in bytes */
> +#define GUC_UNIT_BYTE 0x5000 /* value is in bytes */
> #define GUC_UNIT_MEMORY 0xF000 /* mask for size-related units */
>
> #define GUC_UNIT_MS 0x10000 /* value is in milliseconds */
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
@ 2022-09-06 05:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-06 06:27 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2022-09-06 05:57 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Justin Pryzby <pryzby@telsasoft.com>; Beena Emerson <memissemerson@gmail.com>; Andres Freund <andres@anarazel.de>; pgsql-hackers@postgresql.org
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> I think renumbering this makes sense. We could just leave the comment
> as is if we don't come up with a better wording.
+1, I see no need to change the comment. We just need to establish
the precedent that values within the GUC_UNIT_MEMORY field can be
chosen sequentially.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-06 05:57 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Tom Lane <tgl@sss.pgh.pa.us>
@ 2022-09-06 06:27 ` Michael Paquier <michael@paquier.xyz>
2022-09-07 09:11 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 6+ messages in thread
From: Michael Paquier @ 2022-09-06 06:27 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Justin Pryzby <pryzby@telsasoft.com>; Beena Emerson <memissemerson@gmail.com>; Andres Freund <andres@anarazel.de>; pgsql-hackers@postgresql.org
On Tue, Sep 06, 2022 at 01:57:53AM -0400, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
>> I think renumbering this makes sense. We could just leave the comment
>> as is if we don't come up with a better wording.
>
> +1, I see no need to change the comment. We just need to establish
> the precedent that values within the GUC_UNIT_MEMORY field can be
> chosen sequentially.
+1.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-06 05:57 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Tom Lane <tgl@sss.pgh.pa.us>
2022-09-06 06:27 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Michael Paquier <michael@paquier.xyz>
@ 2022-09-07 09:11 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-07 09:17 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2022-09-07 09:11 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Justin Pryzby <pryzby@telsasoft.com>; Beena Emerson <memissemerson@gmail.com>; Andres Freund <andres@anarazel.de>; pgsql-hackers@postgresql.org
On 06.09.22 08:27, Michael Paquier wrote:
> On Tue, Sep 06, 2022 at 01:57:53AM -0400, Tom Lane wrote:
>> Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
>>> I think renumbering this makes sense. We could just leave the comment
>>> as is if we don't come up with a better wording.
>>
>> +1, I see no need to change the comment. We just need to establish
>> the precedent that values within the GUC_UNIT_MEMORY field can be
>> chosen sequentially.
>
> +1.
committed without the comment change
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-06 05:57 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Tom Lane <tgl@sss.pgh.pa.us>
2022-09-06 06:27 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Michael Paquier <michael@paquier.xyz>
2022-09-07 09:11 ` Re: [PATCH] Renumber confusing value for GUC_UNIT_BYTE Peter Eisentraut <peter.eisentraut@enterprisedb.com>
@ 2022-09-07 09:17 ` Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 0 replies; 6+ messages in thread
From: Justin Pryzby @ 2022-09-07 09:17 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: pgsql-committers@lists.postgresql.org
On Wed, Sep 07, 2022 at 11:11:37AM +0200, Peter Eisentraut wrote:
> On 06.09.22 08:27, Michael Paquier wrote:
> > On Tue, Sep 06, 2022 at 01:57:53AM -0400, Tom Lane wrote:
> > > Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> > > > I think renumbering this makes sense. We could just leave the comment
> > > > as is if we don't come up with a better wording.
> > >
> > > +1, I see no need to change the comment. We just need to establish
> > > the precedent that values within the GUC_UNIT_MEMORY field can be
> > > chosen sequentially.
> >
> > +1.
>
> committed without the comment change
Thank you
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-09-07 09:17 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 14:52 [PATCH] Renumber confusing value for GUC_UNIT_BYTE Justin Pryzby <pryzby@telsasoft.com>
2022-09-06 05:44 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-06 05:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-06 06:27 ` Michael Paquier <michael@paquier.xyz>
2022-09-07 09:11 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-07 09:17 ` Justin Pryzby <pryzby@telsasoft.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox