Re: xlog location arithmetic - Mailing list pgsql-hackers

From Robert Haas
Subject Re: xlog location arithmetic
Date
Msg-id CA+TgmoacKyNb-omk=csGESfZDEqL+=5am9JsPh7+G568NpZNbA@mail.gmail.com
Whole thread Raw
In response to Re: xlog location arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: xlog location arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Mar 9, 2012 at 9:55 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> Fujii Masao <masao.fujii@gmail.com> writes:
>>> Euler proposed one more patch upthread, which replaces pg_size_pretty(bigint)
>>> with pg_size_pretty(numeric) so that pg_size_pretty(pg_xlog_location_diff())
>>> succeeds. It's also worth committing this patch?
>
>> Why would it be useful to use pg_size_pretty on xlog locations?
>> -1 because of the large expense of bigint->numeric->whatever conversion
>> that would be added to existing uses.
>
> Actually ... now that I look at it, isn't it completely bogus to be
> using numeric for the result of pg_xlog_location_diff?  There's no way
> for the difference of two xlog locations to be anywhere near as wide as
> 64 bits.  That'd only be possible if XLogFileSize exceeded 1GB, which we
> don't let it get anywhere near.

rhaas=# select pg_xlog_location_diff('ffffffff/0', '0/0');pg_xlog_location_diff
----------------------- 18374686475393433600
(1 row)

rhaas=# select pg_xlog_location_diff('ffffffff/0', '0/0')::int8;
ERROR:  bigint out of range
STATEMENT:  select pg_xlog_location_diff('ffffffff/0', '0/0')::int8;

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Command Triggers, patch v11
Next
From: Dimitri Fontaine
Date:
Subject: Re: pg_prewarm