Re: Memory unit GUC range checks

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

On Wed, May 16, 2018 at 10:41 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> On 2018-05-16 15:49:29 +0300, Heikki Linnakangas wrote:
> > Here's a pretty straightforward fix for these two issues. Any objections
> or
> > better ideas?
>
> Generally ok, two minor points:
>
> > diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> > index 7cd2d2d80e..93402030f7 100644
> > {"TB", GUC_UNIT_BLOCKS, (1024 * 1024 * 1024) / (BLCKSZ / 1024)},
> > {"GB", GUC_UNIT_BLOCKS, (1024 * 1024) / (BLCKSZ / 1024)},
> > {"MB", GUC_UNIT_BLOCKS, 1024 / (BLCKSZ / 1024)},
> > {"kB", GUC_UNIT_BLOCKS, -(BLCKSZ / 1024)},
> > + {"B", GUC_UNIT_BLOCKS, -(BLCKSZ / (1024 * 1024))},
>
> Isn't this 0 in the common case of 8k pages?
>
>
> > {"TB", GUC_UNIT_XBLOCKS, (1024 * 1024 * 1024) / (XLOG_BLCKSZ /
> 1024)},
> > {"GB", GUC_UNIT_XBLOCKS, (1024 * 1024) / (XLOG_BLCKSZ / 1024)},
> > {"MB", GUC_UNIT_XBLOCKS, 1024 / (XLOG_BLCKSZ / 1024)},
> > {"kB", GUC_UNIT_XBLOCKS, -(XLOG_BLCKSZ / 1024)},
> > + {"B", GUC_UNIT_XBLOCKS, -(XLOG_BLCKSZ / (1024 * 1024))},
>
> Same?
>

As I understand, in these cases multiplier should be just -BLCKSZ and
-XLOG_BLCKSZ correspondingly.

------
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 Andres Freund 2018-05-16 22:02:22 Re: Removing unneeded self joins
Previous Message David Rowley 2018-05-16 21:49:18 Re: NaNs in numeric_power (was Re: Postgres 11 release notes)