Re: Memory unit GUC range checks

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>
Cc: 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-23 07:25:36
Message-ID: 80a3a348-6144-e3a8-1d45-0062011db3f4@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17/05/18 00:56, Alexander Korotkov wrote:
> On Wed, May 16, 2018 at 10:41 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
>> 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.

Yep, quite right. Fixed and committed, thanks!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kato, Sho 2018-05-23 07:37:03 RE: [doc fix] Add operation of freeing output SQLDA
Previous Message Magnus Hagander 2018-05-23 06:59:43 Re: SCRAM with channel binding downgrade attack