Re: tracking commit timestamps

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Steve Singer <steve(at)ssinger(dot)info>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Subject: Re: tracking commit timestamps
Date: 2014-11-25 15:26:09
Message-ID: 54749F91.5050707@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

On 25/11/14 16:23, Alvaro Herrera wrote:
> Robert Haas wrote:
>> On Tue, Nov 25, 2014 at 9:19 AM, Alvaro Herrera
>> <alvherre(at)2ndquadrant(dot)com> wrote:
>>> Fujii Masao wrote:
>>>> On Tue, Nov 25, 2014 at 7:58 AM, Alvaro Herrera
>>>> <alvherre(at)2ndquadrant(dot)com> wrote:
>>>>>> And here is v10 which fixes conflicts with Heikki's WAL API changes (no
>>>>>> changes otherwise).
>>>>>
>>>>> After some slight additional changes, here's v11, which I intend to
>>>>> commit early tomorrow. The main change is moving the test module from
>>>>> contrib to src/test/modules.
>>>>
>>>> When I specify the XID of the aborted transaction in pg_xact_commit_timestamp(),
>>>> it always returns 2000-01-01 09:00:00+09. Is this intentional?
>>>
>>> Well, when a transaction has not committed, nothing is written so on
>>> reading we get all zeroes which corresponds to the timestamp you give.
>>> So yeah, it is intentional. We could alternatively check pg_clog and
>>> raise an error if the transaction is not marked either COMMITTED or
>>> SUBCOMMITTED, but I'm not real sure there's much point.
>>
>> Maybe 0 should get translated to a NULL return, instead of a bogus timestamp.
>
> That's one idea --- surely no transaction is going to commit at 00:00:00
> on 2000-01-01 anymore. Yet this is somewhat discomforting.
>

I solved it for xids that are out of range by returning -infinity and
then changing that to NULL in sql interface, but no idea how to do that
for aborted transactions.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-11-25 15:30:33 Re: tracking commit timestamps
Previous Message Alvaro Herrera 2014-11-25 15:23:22 Re: tracking commit timestamps

Browse pgsql-www by date

  From Date Subject
Next Message Alvaro Herrera 2014-11-25 15:30:33 Re: tracking commit timestamps
Previous Message Alvaro Herrera 2014-11-25 15:23:22 Re: tracking commit timestamps