=== Applying patches on top of PostgreSQL commit ID e18b0cb7344cb4bd28468f6c0aeeb9b9241d30aa === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Wed Jun 10 10:45:27 UTC 2026 On branch cf/6604 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-0001-Add-pg_stat_vfdcache-view-for-VFD-cache-statistics.patch === Applying: Add pg_stat_vfdcache view for VFD cache statistics Using index info to reconstruct a base tree... M src/backend/catalog/system_views.sql M src/backend/storage/file/fd.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/test/regress/expected/stats.out Falling back to patching base and 3-way merge... Auto-merging src/test/regress/expected/stats.out CONFLICT (content): Merge conflict in src/test/regress/expected/stats.out Auto-merging src/include/catalog/pg_proc.dat Auto-merging src/backend/utils/adt/pgstatfuncs.c CONFLICT (content): Merge conflict in src/backend/utils/adt/pgstatfuncs.c Auto-merging src/backend/storage/file/fd.c Auto-merging src/backend/catalog/system_views.sql error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add pg_stat_vfdcache view for VFD cache statistics When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v4-0001-Add-pg_stat_vfdcache-view-for-VFD-cache-statistics.patch === patching file doc/src/sgml/monitoring.sgml patching file src/backend/catalog/system_views.sql Hunk #1 succeeded at 1557 (offset 1 line). patching file src/backend/storage/file/fd.c patching file src/backend/utils/activity/Makefile patching file src/backend/utils/activity/meson.build patching file src/backend/utils/activity/pgstat.c patching file src/backend/utils/activity/pgstat_vfdcache.c patching file src/backend/utils/adt/pgstatfuncs.c Hunk #2 succeeded at 1337 with fuzz 2. Hunk #4 FAILED at 2024. 1 out of 4 hunks FAILED -- saving rejects to file src/backend/utils/adt/pgstatfuncs.c.rej patching file src/include/catalog/pg_proc.dat Hunk #1 succeeded at 12692 with fuzz 1 (offset -76 lines). patching file src/include/pgstat.h patching file src/include/utils/pgstat_internal.h patching file src/include/utils/pgstat_kind.h patching file src/test/regress/expected/rules.out patching file src/test/regress/expected/stats.out Hunk #1 FAILED at 1161. 1 out of 1 hunk FAILED -- saving rejects to file src/test/regress/expected/stats.out.rej patching file src/test/regress/sql/stats.sql Unstaged changes after reset: M doc/src/sgml/monitoring.sgml M src/backend/catalog/system_views.sql M src/backend/storage/file/fd.c M src/backend/utils/activity/Makefile M src/backend/utils/activity/meson.build M src/backend/utils/activity/pgstat.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/include/utils/pgstat_internal.h M src/include/utils/pgstat_kind.h M src/test/regress/expected/rules.out M src/test/regress/sql/stats.sql Removing src/backend/utils/activity/pgstat_vfdcache.c Removing src/backend/utils/adt/pgstatfuncs.c.rej Removing src/test/regress/expected/stats.out.rej === using 'git apply' to apply patch ./v4-0001-Add-pg_stat_vfdcache-view-for-VFD-cache-statistics.patch === Applied patch to 'doc/src/sgml/monitoring.sgml' cleanly. Applied patch to 'src/backend/catalog/system_views.sql' cleanly. Applied patch to 'src/backend/storage/file/fd.c' cleanly. Applied patch to 'src/backend/utils/activity/Makefile' cleanly. Applied patch to 'src/backend/utils/activity/meson.build' cleanly. Applied patch to 'src/backend/utils/activity/pgstat.c' cleanly. Falling back to direct application... Applied patch to 'src/backend/utils/adt/pgstatfuncs.c' with conflicts. Applied patch to 'src/include/catalog/pg_proc.dat' cleanly. Applied patch to 'src/include/pgstat.h' cleanly. Applied patch to 'src/include/utils/pgstat_internal.h' cleanly. Applied patch to 'src/include/utils/pgstat_kind.h' cleanly. Applied patch to 'src/test/regress/expected/rules.out' cleanly. Applied patch to 'src/test/regress/expected/stats.out' with conflicts. Applied patch to 'src/test/regress/sql/stats.sql' cleanly. U src/backend/utils/adt/pgstatfuncs.c U src/test/regress/expected/stats.out diff --cc src/backend/utils/adt/pgstatfuncs.c index 6f9c9c72de5,f35513d7081..00000000000 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@@ -1336,11 -1337,52 +1337,52 @@@ pg_stat_get_buf_alloc(PG_FUNCTION_ARGS PG_RETURN_INT64(pgstat_fetch_stat_bgwriter()->buf_alloc); } + Datum + pg_stat_get_vfd_hits(PG_FUNCTION_ARGS) + { + PG_RETURN_INT64(pgstat_fetch_stat_vfdcache()->vfd_hits); + } + + Datum + pg_stat_get_vfd_misses(PG_FUNCTION_ARGS) + { + PG_RETURN_INT64(pgstat_fetch_stat_vfdcache()->vfd_misses); + } + + Datum + pg_stat_get_vfd_max_open_fds(PG_FUNCTION_ARGS) + { + PG_RETURN_INT32(max_safe_fds); + } + + Datum + pg_stat_get_vfd_stat_reset_time(PG_FUNCTION_ARGS) + { + TimestampTz ts = pgstat_fetch_stat_vfdcache()->stat_reset_timestamp; + + if (ts == 0) + PG_RETURN_NULL(); + + PG_RETURN_TIMESTAMPTZ(ts); + } + + /* + * pg_stat_reset_vfdcache + * Reset shared VFD cache counters. + */ + Datum + pg_stat_reset_vfdcache(PG_FUNCTION_ARGS) + { + pgstat_reset_vfdcache(); + PG_RETURN_VOID(); + } + + /* -* When adding a new column to the pg_stat_io view and the -* pg_stat_get_backend_io() function, add a new enum value here above -* IO_NUM_COLUMNS. -*/ + * When adding a new column to the pg_stat_io view and the + * pg_stat_get_backend_io() function, add a new enum value here above + * IO_NUM_COLUMNS. + */ typedef enum io_stat_col { IO_COL_INVALID = -1, @@@ -1987,7 -2032,7 +2032,11 @@@ pg_stat_reset_shared(PG_FUNCTION_ARGS ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized reset target: \"%s\"", target), ++<<<<<<< ours + errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"lock\", \"recovery_prefetch\", \"slru\", or \"wal\"."))); ++======= + errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"recovery_prefetch\", \"slru\", \"vfdcache\", or \"wal\"."))); ++>>>>>>> theirs PG_RETURN_VOID(); } diff --cc src/test/regress/expected/stats.out index bbb1db3c433,04daadca909..00000000000 --- a/src/test/regress/expected/stats.out +++ b/src/test/regress/expected/stats.out @@@ -1164,7 -1178,7 +1178,11 @@@ SELECT stats_reset > :'vfdcache_reset_t -- Test error case for reset_shared with unknown stats type SELECT pg_stat_reset_shared('unknown'); ERROR: unrecognized reset target: "unknown" ++<<<<<<< ours +HINT: Target must be "archiver", "bgwriter", "checkpointer", "io", "lock", "recovery_prefetch", "slru", or "wal". ++======= + HINT: Target must be "archiver", "bgwriter", "checkpointer", "io", "recovery_prefetch", "slru", "vfdcache", or "wal". ++>>>>>>> theirs -- Test that reset works for pg_stat_database and pg_stat_database_conflicts -- Since pg_stat_database stats_reset starts out as NULL, reset it once first so that we -- have a baseline for comparison. The same for pg_stat_database_conflicts as it shares