From: Michael Banck <mbanck@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Subject: Re: GNU/Hurd portability patches
Date: Wed, 24 Sep 2025 17:52:02 +0200
Message-ID: <68d413a3.a70a0220.24c74c.8be9@mx.google.com> (raw)
In-Reply-To: <3314741.1758724126@sss.pgh.pa.us>
References: <68643ea2.050a0220.128f53.3f77@mx.google.com>
<aGR04gPotq3SOaVo@paquier.xyz>
<2874644f-6431-41f4-abe2-99e5ab052606@gmail.com>
<aNB18ZFIXXv-FR6B@paquier.xyz>
<68d0f931.050a0220.3185e0.19ae@mx.google.com>
<283c3d69-ef32-4391-9ea3-68e47c9dea31@gmail.com>
<aNMtzyqgin8I4r5H@paquier.xyz>
<68d3a0a0.050a0220.167290.bcf3@mx.google.com>
<68d3cbe8.5d0a0220.65f10.da5f@mx.google.com>
<3314741.1758724126@sss.pgh.pa.us>
Hi,
On Wed, Sep 24, 2025 at 10:28:46AM -0400, Tom Lane wrote:
> It seems plausible that the execution time of the stats
> test's function-under-test is so short that it sometimes
> doesn't register as more than zero on a machine with poor
> clock resolution. It looks like that test only calls the
> test function once or twice before checking that it's
> accumulated some runtime, and the test function is nothing
> more than
>
> CREATE FUNCTION test_stat_func() RETURNS VOID LANGUAGE plpgsql AS $$BEGIN END;$$;
>
> I'd call this a bug in that test TBH. It'd be saner to
> make the function do something like pg_sleep for 1ms.
I did that in the attached, so far my Hurd VM ran the stats test more
than 1000 times without a failure with it. I have the loop running till
10000, I'll report back tomorrow.
Michael
Attachments:0001-Add-minimal-sleep-to-stats-isolation-test-functions.patch (text/x-diff, 1.7K) download
From d6a6995ea53695319dde1488e8f7f4b1bf8c21a8 Mon Sep 17 00:00:00 2001
From: Michael Banck <michael.banck@credativ.de>
Date: Wed, 24 Sep 2025 17:43:20 +0200
Subject: [PATCH] Add minimal sleep to stats isolation test functions.
The functions test_stat_func() and test_stat_func2() had no function bodies.
This made it possible that on machines with relatively low timer resolution
the function would return before the clock advanced, making the test fail.
To avoid that, pg_sleep for 1ms during the function.
Per buildfarm members fruitcrow and hamerkop.
---
src/test/isolation/specs/stats.spec | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/isolation/specs/stats.spec b/src/test/isolation/specs/stats.specindex 1d98ac785b8..5b765da7eff 100644--- a/src/test/isolation/specs/stats.spec+++ b/src/test/isolation/specs/stats.spec@@ -6,10 +6,10 @@ setup
INSERT INTO test_stat_tab(key, value) VALUES('k0', 1);
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_tab', 'test_stat_tab'::regclass);
- CREATE FUNCTION test_stat_func() RETURNS VOID LANGUAGE plpgsql AS $$BEGIN END;$$;+ CREATE FUNCTION test_stat_func() RETURNS VOID LANGUAGE plpgsql AS $$BEGIN PERFORM pg_sleep(0.001); END;$$;
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_func', 'test_stat_func'::regproc);
- CREATE FUNCTION test_stat_func2() RETURNS VOID LANGUAGE plpgsql AS $$BEGIN END;$$;+ CREATE FUNCTION test_stat_func2() RETURNS VOID LANGUAGE plpgsql AS $$BEGIN PERFORM pg_sleep(0.001); END;$$;
INSERT INTO test_stat_oid(name, oid) VALUES('test_stat_func2', 'test_stat_func2'::regproc);
CREATE TABLE test_slru_stats(slru TEXT, stat TEXT, value INT);
--
2.39.5
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-hackers@postgresql.org
Cc: mbanck@gmx.net, tgl@sss.pgh.pa.us, michael@paquier.xyz, exclusion@gmail.com, thomas.munro@gmail.com
Subject: Re: GNU/Hurd portability patches
In-Reply-To: <68d413a3.a70a0220.24c74c.8be9@mx.google.com>
* 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