Memory unit GUC range checks

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Beena Emerson <memissemerson(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Memory unit GUC range checks
Date: 2018-05-16 12:19:45
Message-ID: 1bfe7f4a-7e22-aa6e-7b37-f4d222ed2d67@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

The HINT in the last message seems wrong: the hint claims that "TB" is
accepted, yet "1024 TB" was not accepted. And shouldn't the hint also
mention "B", since we accept that now?

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.

- Heikki

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-05-16 12:49:29 Re: Memory unit GUC range checks
Previous Message Stas Kelvich 2018-05-16 12:02:02 Re: Global snapshots