]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add minimal sleep to stats isolation test functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Sep 2025 17:29:02 +0000 (13:29 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Sep 2025 17:29:02 +0000 (13:29 -0400)
commit21ada43a6105bee3093d636d2ba2afc71bebe5a1
treef69204fc099d7d4834143aef7a6a724b2183683e
parenta54c7a1133a4338c09b435f7870152f305bbf3ad
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
src/test/isolation/specs/stats.spec