pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add minimal sleep to stats isolation test functions.
Date: Thu, 25 Sep 2025 17:29:33 +0000
Message-ID: <E1v1pmf-0002hs-0y@gemulon.postgresql.org> (raw)

Add minimal sleep to stats isolation test functions.

The functions test_stat_func() and test_stat_func2() had empty
function bodies, so that they took very little time to run.  This made
it possible that on machines with relatively low timer resolution the
functions could return before the clock advanced, making the test fail
(as seen on buildfarm members fruitcrow and hamerkop).

To avoid that, pg_sleep for 10us during the functions.  As far as we
can tell, all current hardware has clock resolution much less than
that.  (The current implementation of pg_sleep will round it up to
1ms anyway, but someday that might get improved.)

Author: Michael Banck <mbanck@gmx.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/68d413a3.a70a0220.24c74c.8be9@mx.google.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b4ef835f5e7d66c9a72f8e6c011cf68ed4907f0b

Modified Files
--------------
src/test/isolation/specs/stats.spec | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1v1pmf-0002hs-0y@gemulon.postgresql.org>
Permalink:  ../E1v1pmf-0002hs-0y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v1pmf-0002hs-0y@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add minimal sleep to stats isolation test functions.
  In-Reply-To: <E1v1pmf-0002hs-0y@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox