pgsql: Add minimal sleep to stats isolation test functions. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Add minimal sleep to stats isolation test functions.
Date
Msg-id E1v1pn0-0002iy-32@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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
------
master

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

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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Add minimal sleep to stats isolation test functions.
Next
From: Tom Lane
Date:
Subject: pgsql: Try to avoid floating-point roundoff error in pg_sleep().