stats.sql fails during installcheck on mac

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: stats.sql fails during installcheck on mac
Date: 2025-04-10 21:39:45
Message-ID: CAA5RZ0uxwg3xAi4nvdBMJ-zJQEeyg+RotuU+ebM2F6CKmnvaYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When running "make installcheck" on my mac, I ran into a failure:

"""
@@ -1459,7 +1459,7 @@
OR :io_sum_wal_normal_after_fsyncs > :io_sum_wal_normal_before_fsyncs;
?column?
----------
- t
+ f
(1 row)

-- Change the tablespace so that the table is rewritten directly, then SELECT
"""

which occurs when regress/sql/stats.sql is checking for # of fsync
calls for wal writesto disk.
This test was added in a051e71e28a1

"""
SELECT current_setting('fsync') = 'off'
OR :io_sum_wal_normal_after_fsyncs > :io_sum_wal_normal_before_fsyncs;
"""

However, because on mac, the default wal_sync_method is open_datasync,
there is no fsync() or similar call being issued when wal is synced to disk.

I think we should modify the test to only check for the failing stat only if
wal_sync_method = fdatasync|fsync|fsync_writethrough
and the io object is 'wal'.
See attached patch with a simple fix to this test.

"make check" does not fail because it runs with fsync = off [1]

Also, The documentation for pg_stat_wal already makes this point clear
in [0] that "wal_sync is only
incremented when the wal_sync_method is either fdatasync, fsync or
fsync_writethrough".

Perhaps, the same clarification will be beneficial for the
pg_stat_io.fsyncs* fields?

[0] https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-WAL-VIEW
[1] https://github.com/postgres/postgres/blob/master/src/test/regress/pg_regress.c#L2485

--
Sami Imseih
Amazon Web Services (AWS)

Attachment Content-Type Size
v1-0001-Fix-stats.sql-test-for-systems-that-don-t-sync-wa.patch application/octet-stream 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2025-04-10 21:45:42 Re: Non-text mode for pg_dumpall
Previous Message Tom Lane 2025-04-10 20:33:57 Re: Reduce "Var IS [NOT] NULL" quals during constant folding