Skip site navigation (1) Skip section navigation (2)

Re: xlog location arithmetic

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: xlog location arithmetic
Date: 2012-02-10 08:32:46
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
On Fri, Feb 10, 2012 at 7:00 AM, Euler Taveira de Oliveira
<euler(at)timbira(dot)com> wrote:
> On 08-02-2012 09:35, Fujii Masao wrote:
> Fujii, new patch attached. Thanks for your tests.

Thanks for the new patch!

>> But another problem happened. When I changed pg_proc.h so that the unused
>> OID was assigned to pg_xlog_location_diff(), and executed the above again,
>> I encountered the segmentation fault:
> I reproduced the problems in my old 32-bit laptop. I fixed it casting to
> int64. I also updated the duplicated OID.

Yep, in the updated patch, I could confirm that the function works fine without
any error in my machine. The patch looks fine to me except the following minor

In the document, it's better to explain clearly that the function subtracts the
second argument from the first.

-    These functions cannot be executed during recovery.
+	These functions cannot be executed during recovery (except
+	<function>pg_xlog_location_diff</function>).

+	<function>pg_xlog_location_diff</> calculates the difference in bytes
+	between two transaction log locations. It can be used with
+	<structname>pg_stat_replication</structname> or some functions shown in
+	<xref linkend="functions-admin-backup-table"> to get the replication lag.

Very minor comment: you should use spaces rather than a tab to indent each line.

>> Why OID needs to be reassigned?
> There isn't a compelling reason. It is just a way to say: "hey, it is another
> function with the same old name".
> I'll not attach another version for pg_size_pretty because it is a matter of
> updating a duplicated OID.

Okay, I reviewed the previous patch again. That looks fine to me.


Fujii Masao
NTT Open Source Software Center

In response to


pgsql-hackers by date

Next:From: Shigeru HanadaDate: 2012-02-10 11:39:55
Subject: Re: pgsql_fdw, FDW for PostgreSQL server
Previous:From: Tom LaneDate: 2012-02-10 06:24:29
Subject: Re: psql tab completion for SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group