Relax regression test for fsync check of backend-level stats
authorMichael Paquier <michael@paquier.xyz>
Fri, 20 Dec 2024 10:00:18 +0000 (19:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 20 Dec 2024 10:00:18 +0000 (19:00 +0900)
One test added in 9aea73fc61d4 did not take into account that the
backend may have some fsync even after a checkpoint.  Let's relax it to
be more flexible.

Per report from buildfarm member grassquit, via Alexander Lakhin.

Author: Bertrand Drouvot
Discussion: https://postgr.es/m/6143ab0a-9e88-4790-8d9d-50ba45657761@gmail.com

src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql

index 150b6dcf7406e9994553733acffdb50723a4652f..a0317b7208e3e3cda48c4134132383503e24d392 100644 (file)
@@ -1299,7 +1299,7 @@ SELECT :my_io_sum_shared_after_extends > :my_io_sum_shared_before_extends;
 (1 row)
 
 -- After a checkpoint, there should be some additional IOCONTEXT_NORMAL writes
--- and fsyncs in the global stats (not for the backend).
+-- and fsyncs in the global stats (usually not for the backend).
 -- See comment above for rationale for two explicit CHECKPOINTs.
 CHECKPOINT;
 CHECKPOINT;
@@ -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
index 1e7d0ff665330257682f4a9f6fe04df890f458bd..399c72bbcf71038cb70f112fd593b7ece5080cf9 100644 (file)
@@ -633,7 +633,7 @@ SELECT sum(extends) AS my_io_sum_shared_after_extends
 SELECT :my_io_sum_shared_after_extends > :my_io_sum_shared_before_extends;
 
 -- After a checkpoint, there should be some additional IOCONTEXT_NORMAL writes
--- and fsyncs in the global stats (not for the backend).
+-- and fsyncs in the global stats (usually not for the backend).
 -- See comment above for rationale for two explicit CHECKPOINTs.
 CHECKPOINT;
 CHECKPOINT;
@@ -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.