Re: pg_rewarm status

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Jim Nasby <jim(at)nasby(dot)net>, Jeff Amiel <becauseimjeff(at)yahoo(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_rewarm status
Date: 2013-12-19 14:16:59
Message-ID: CA+TgmoZZPhyA_-W85uSi08PSpd_J2BSNB1f-sGei68Puu_XegQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 19, 2013 at 8:37 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> Few observations:
> 1.
> pg_prewarm.control
> +# pg_buffercache extension
> Wrong name.

Oops.

> 2.
> +pg_prewarm(regclass, mode text default 'buffer', fork text default 'main',
> + first_block int8 default null,
> + last_block int8 default null) RETURNS int8
> {
> ..
> int64 first_block;
> int64 last_block;
> int64 nblocks;
> int64 blocks_done = 0;
> ..
> }
> is there specific reason to keep parameters type as int8, shouldn't it
> be uint32 (BlockNumber)?

There's no uint32 type at the SQL level, and int32 is no good because
it can't represent sufficiently large positive values to cover the
largest possible block number. So we have to use int64 at the SQL
level; there is precedent elsewhere. So first_block and last_block
have to be int64, because those are the raw values we got from the
user; they haven't initially been bounds-checked yet. And blocks_done
is the value we're going to return to the user, so it should match the
SQL return type of the function, which again has to be int64 because
int32 doesn't have enough range. nblocks could possibly be changed to
be BlockNumber, but I think the code is easier to understand using one
type predominantly throughout rather than worry about exactly which
type is going to be used for comparisons after promoting.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-12-19 14:19:14 Re: preserving forensic information when we freeze
Previous Message Amit Kapila 2013-12-19 13:37:00 Re: pg_rewarm status