Re: xlog location arithmetic - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: xlog location arithmetic
Date
Msg-id CAHGQGwFW3drMELnwytG5P1Vqk2HBcQbH4M1_jeHLN6L5E2GyNg@mail.gmail.com
Whole thread Raw
In response to Re: xlog location arithmetic  (Euler Taveira de Oliveira <euler@timbira.com>)
Responses Re: xlog location arithmetic  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
On Fri, Feb 10, 2012 at 7:00 AM, Euler Taveira de Oliveira
<euler@timbira.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
comments:

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.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql tab completion for SELECT
Next
From: Shigeru Hanada
Date:
Subject: Re: pgsql_fdw, FDW for PostgreSQL server