Re: tracking commit timestamps

From: Noah Misch <noah(at)leadboat(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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>, 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-12-19 06:53:44
Message-ID: 20141219065344.GA1831739@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

On Tue, Dec 16, 2014 at 01:05:31AM -0300, Alvaro Herrera wrote:
> Noah Misch wrote:
> > On Mon, Dec 15, 2014 at 12:12:10AM -0800, Michael Paquier wrote:
>
> > > FWIW, I just tried that with MinGW-32 and I can see the error on Win7.
> > > I also checked that changing "< now()" to "<= now()" fixed the
> > > problem, so your assumption was right, Petr.
> >
> > Committed, after fixing the alternate expected output.
>
> Thanks. I admit I don't understand what the issue is.

The test assumed that no two transactions of a given backend will get the same
timestamp value from now(). That holds so long as ticks of the system time
are small enough. Not so on at least some Windows configurations. Notice the
repeated timestamp values:

Windows Server 2003 x64, 32-bit build w/ VS2010

localhost template1=# select clock_timestamp(), pg_sleep(.1 * (n % 2)) from generate_series(0,7) t(n);
clock_timestamp | pg_sleep
-------------------------------+----------
2014-12-18 08:34:34.522126+00 |
2014-12-18 08:34:34.522126+00 |
2014-12-18 08:34:34.631508+00 |
2014-12-18 08:34:34.631508+00 |
2014-12-18 08:34:34.74089+00 |
2014-12-18 08:34:34.74089+00 |
2014-12-18 08:34:34.850272+00 |
2014-12-18 08:34:34.850272+00 |
(8 rows)

GNU/Linux

[local] test=# select clock_timestamp(), pg_sleep(.1 * (n % 2)) from generate_series(0,7) t(n);
clock_timestamp | pg_sleep
-------------------------------+----------
2014-12-19 06:49:47.590556+00 |
2014-12-19 06:49:47.590611+00 |
2014-12-19 06:49:47.691488+00 |
2014-12-19 06:49:47.691508+00 |
2014-12-19 06:49:47.801483+00 |
2014-12-19 06:49:47.801502+00 |
2014-12-19 06:49:47.921486+00 |
2014-12-19 06:49:47.921505+00 |
(8 rows)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-12-19 07:48:18 Re: Commitfest problems
Previous Message Tom Lane 2014-12-19 04:51:12 Re: NUMERIC private methods?

Browse pgsql-www by date

  From Date Subject
Next Message Fujii Masao 2015-01-05 06:28:34 Re: tracking commit timestamps
Previous Message Joshua D. Drake 2014-12-18 22:18:49 Re: Documentation missing bigint?