Re: Memory unit GUC range checks

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Beena Emerson <memissemerson(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Memory unit GUC range checks
Date: 2018-05-16 13:35:14
Message-ID: CAPpHfdsNuWq62xEmBN8jBy53jUthr0_EFt-pFH7EVfKnt-76kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

On Wed, May 16, 2018 at 3:19 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:

> I played around with the GUC memory units, specifically to test the new
> GUC_UNIT_BYTES flag (commit 6e7baa32):
>
> $ postmaster -c track_activity_query_size=1024kB
> FATAL: 1048576 is outside the valid range for parameter
> "track_activity_query_size" (100 .. 102400)
>
> $ postmaster -c track_activity_query_size=1024MB
> FATAL: 1073741824 is outside the valid range for parameter
> "track_activity_query_size" (100 .. 102400)
>
> $ postmaster -c track_activity_query_size=1024GB
> FATAL: invalid value for parameter "track_activity_query_size": "1024GB"
> HINT: Value exceeds integer range.
>
> $ postmaster -c track_activity_query_size=1024TB
> FATAL: invalid value for parameter "track_activity_query_size": "1024TB"
> HINT: Valid units for this parameter are "kB", "MB", "GB", and "TB".
>
> The first two look OK, but the last two cases seem a bit weird. With 1024
> GB, it would be nice to print the valid range, like in the first two cases.
>

+1,
I also think it would be nice to show units in the valid range. I image
that if I would see such message at the first time, then I would try to
reverse-engineer units from input value representation in the error
message. Displaying units in the valid range would be clarifying for me.

The HINT in the last message seems wrong: the hint claims that "TB" is
> accepted, yet "1024 TB" was not accepted.

Yes, this seems like a bug. I think it should be fixed.

> And shouldn't the hint also mention "B", since we accept that now?
>

Yes, I think "B" should be mentioned in hint.

Testing a setting with GUC_UNIT_KB:
>
> $ postmaster -c work_mem=102400B
> FATAL: invalid value for parameter "work_mem": "100000B"
> HINT: Valid units for this parameter are "kB", "MB", "GB", and "TB".
>
> This time the hint is accurate, but why is "B" not accepted here? Seems
> inconsistent.

+1

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2018-05-16 13:39:36 Re: Memory unit GUC range checks
Previous Message Robert Haas 2018-05-16 13:33:46 Re: [PROPOSAL] Shared Ispell dictionaries