Hi, On Fri, Dec 20, 2024 at 08:00:00AM +0200, Alexander Lakhin wrote: > Hello Michael, > > 19.12.2024 06:21, Michael Paquier wrote: > > Fixed that, bumped the two version counters, and done. > > Could you, please, look at recent failures produced by grassquit (which > has fsync = on in it's config), on an added test case? For instance, [1]: > --- > /home/bf/bf-build/grassquit/HEAD/pgsql/src/test/regress/expected/stats.out > 2024-12-19 04:44:08.779311933 +0000 > +++ > /home/bf/bf-build/grassquit/HEAD/pgsql.build/testrun/recovery/027_stream_regress/data/results/stats.out > 2024-12-19 16:37:41.351784840 +0000 > @@ -1333,7 +1333,7 @@ > AND :my_io_sum_shared_after_fsyncs= 0); > ?column? > ---------- > - t > + f > (1 row) > > The complete query is: > SELECT current_setting('fsync') = 'off' > OR (:my_io_sum_shared_after_fsyncs = :my_io_sum_shared_before_fsyncs > AND :my_io_sum_shared_after_fsyncs= 0); > > And the corresponding query in 027_stream_regress_primary.log is: > 2024-12-19 16:37:39.907 UTC [4027467][client backend][15/1980:0] LOG: > statement: SELECT current_setting('fsync') = 'off' > OR (1 = 1 > AND 1= 0); > > (I can reproduce this locally with an asan-enabled build too.) > > [1] > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=grassquit&dt=2024-12-19%2016%3A28%3A58
Thanks for the report! I was not able able to reproduce (even with asan-enabled) but I think the test is wrong. Indeed the backend could fsync too during the test (see register_dirty_segment() and the case where the request queue is full). I think the test should look like the attached instead, thoughts? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
>From a83def4ca95c154e824378452cb15f100887a56c Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot <bertranddrouvot...@gmail.com> Date: Fri, 20 Dec 2024 08:59:53 +0000 Subject: [PATCH v1] Fix per-backend IO stats regression test The tests added in 9aea73fc61 did not take into account that the backend can fsync in some circumstances. --- src/test/regress/expected/stats.out | 3 +-- src/test/regress/sql/stats.sql | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 50.0% src/test/regress/expected/ 50.0% src/test/regress/sql/ diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out index 150b6dcf74..d18fc7c081 100644 --- a/src/test/regress/expected/stats.out +++ b/src/test/regress/expected/stats.out @@ -1329,8 +1329,7 @@ SELECT :my_io_sum_shared_after_writes >= :my_io_sum_shared_before_writes; (1 row) SELECT current_setting('fsync') = 'off' - OR (:my_io_sum_shared_after_fsyncs = :my_io_sum_shared_before_fsyncs - AND :my_io_sum_shared_after_fsyncs= 0); + OR :my_io_sum_shared_after_fsyncs >= :my_io_sum_shared_before_fsyncs; ?column? ---------- t diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql index 1e7d0ff665..fc0d2fde31 100644 --- a/src/test/regress/sql/stats.sql +++ b/src/test/regress/sql/stats.sql @@ -648,8 +648,7 @@ SELECT sum(writes) AS writes, sum(fsyncs) AS fsyncs WHERE object = 'relation' \gset my_io_sum_shared_after_ SELECT :my_io_sum_shared_after_writes >= :my_io_sum_shared_before_writes; SELECT current_setting('fsync') = 'off' - OR (:my_io_sum_shared_after_fsyncs = :my_io_sum_shared_before_fsyncs - AND :my_io_sum_shared_after_fsyncs= 0); + OR :my_io_sum_shared_after_fsyncs >= :my_io_sum_shared_before_fsyncs; -- Change the tablespace so that the table is rewritten directly, then SELECT -- from it to cause it to be read back into shared buffers. -- 2.34.1