=== Applying patches on top of PostgreSQL commit ID 072d4c4240572980b9c101ff5d2b85e656e79275 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Sep 14 02:21:35 UTC 2026 On branch cf/7298 nothing to commit, working tree clean === using 'git am' to apply patch ./0001-Report-pruning-statistics-in-pg_stat_all_tables.patch === Applying: Report pruning statistics in pg_stat_all_tables Using index info to reconstruct a base tree... M doc/src/sgml/monitoring.sgml M src/backend/access/heap/pruneheap.c M src/backend/catalog/system_views.sql M src/backend/utils/activity/pgstat_relation.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/catversion.h M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/test/regress/expected/rules.out Falling back to patching base and 3-way merge... Auto-merging src/test/regress/expected/rules.out Auto-merging src/include/pgstat.h CONFLICT (content): Merge conflict in src/include/pgstat.h Auto-merging src/include/catalog/pg_proc.dat Auto-merging src/include/catalog/catversion.h CONFLICT (content): Merge conflict in src/include/catalog/catversion.h Auto-merging src/backend/utils/adt/pgstatfuncs.c Auto-merging src/backend/utils/activity/pgstat_relation.c CONFLICT (content): Merge conflict in src/backend/utils/activity/pgstat_relation.c Auto-merging src/backend/catalog/system_views.sql Auto-merging src/backend/access/heap/pruneheap.c CONFLICT (content): Merge conflict in src/backend/access/heap/pruneheap.c Auto-merging doc/src/sgml/monitoring.sgml error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Report pruning statistics in pg_stat_all_tables 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 ./0001-Report-pruning-statistics-in-pg_stat_all_tables.patch === patching file doc/src/sgml/monitoring.sgml patching file src/backend/access/heap/pruneheap.c Hunk #1 succeeded at 333 with fuzz 2 (offset 8 lines). Hunk #2 succeeded at 379 (offset 5 lines). patching file src/backend/access/heap/vacuumlazy.c patching file src/backend/catalog/system_views.sql patching file src/backend/utils/activity/pgstat_relation.c Hunk #4 FAILED at 972. 1 out of 4 hunks FAILED -- saving rejects to file src/backend/utils/activity/pgstat_relation.c.rej patching file src/backend/utils/adt/pgstatfuncs.c patching file src/include/catalog/catversion.h Hunk #1 FAILED at 57. 1 out of 1 hunk FAILED -- saving rejects to file src/include/catalog/catversion.h.rej patching file src/include/catalog/pg_proc.dat patching file src/include/pgstat.h Hunk #1 FAILED at 150. Hunk #2 succeeded at 275 (offset 24 lines). Hunk #3 succeeded at 519 (offset 24 lines). Hunk #4 succeeded at 787 (offset 24 lines). Hunk #5 succeeded at 872 (offset 24 lines). 1 out of 5 hunks FAILED -- saving rejects to file src/include/pgstat.h.rej patching file src/test/isolation/expected/prune-onaccess-pin.out patching file src/test/isolation/isolation_schedule patching file src/test/isolation/specs/prune-onaccess-pin.spec patching file src/test/regress/expected/rules.out Hunk #2 succeeded at 2361 (offset 1 line). Hunk #3 succeeded at 2420 (offset 1 line). Unstaged changes after reset: M doc/src/sgml/monitoring.sgml M src/backend/access/heap/pruneheap.c M src/backend/access/heap/vacuumlazy.c M src/backend/catalog/system_views.sql M src/backend/utils/activity/pgstat_relation.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/test/isolation/isolation_schedule M src/test/regress/expected/rules.out Removing src/backend/utils/activity/pgstat_relation.c.rej Removing src/include/catalog/catversion.h.rej Removing src/include/pgstat.h.rej Removing src/test/isolation/expected/prune-onaccess-pin.out Removing src/test/isolation/specs/prune-onaccess-pin.spec === using 'git apply' to apply patch ./0001-Report-pruning-statistics-in-pg_stat_all_tables.patch === Applied patch to 'doc/src/sgml/monitoring.sgml' cleanly. Applied patch to 'src/backend/access/heap/pruneheap.c' with conflicts. Applied patch to 'src/backend/access/heap/vacuumlazy.c' cleanly. Applied patch to 'src/backend/catalog/system_views.sql' cleanly. Applied patch to 'src/backend/utils/activity/pgstat_relation.c' with conflicts. Applied patch to 'src/backend/utils/adt/pgstatfuncs.c' cleanly. Applied patch to 'src/include/catalog/catversion.h' with conflicts. Applied patch to 'src/include/catalog/pg_proc.dat' cleanly. Applied patch to 'src/include/pgstat.h' with conflicts. Falling back to direct application... Applied patch to 'src/test/isolation/isolation_schedule' cleanly. Falling back to direct application... Applied patch to 'src/test/regress/expected/rules.out' cleanly. U src/backend/access/heap/pruneheap.c U src/backend/utils/activity/pgstat_relation.c U src/include/catalog/catversion.h U src/include/pgstat.h diff --cc src/backend/access/heap/pruneheap.c index 54c69b69346,dfe3406c39f..00000000000 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@@ -326,16 -326,19 +326,30 @@@ heap_page_prune_opt(Relation relation, Size freespace = 0; /* ++<<<<<<< ours + * Pin the VM page before taking the heap cleanup lock. This may + * occasionally lead to an unnecessary pin when the buffer is + * contended, but the same VM page covers many heap pages, so there is + * a good chance for the work to be reusable. + */ + visibilitymap_pin(relation, BufferGetBlockNumber(buffer), vmbuffer); + + /* OK, try to get exclusive buffer lock */ ++======= + * OK, try to get exclusive buffer lock. + * + * Failing to get the cleanup lock means somebody else holds a pin on + * the page, so we give up on pruning it. Count that: a workload that + * keeps buffers pinned for longer (deeper read stream lookahead, for + * example) can silently lose most of its opportunistic pruning this + * way, and the resulting bloat is otherwise hard to attribute. + */ ++>>>>>>> theirs if (!ConditionalLockBufferForCleanup(buffer)) + { + pgstat_count_prune_onaccess_missed(relation); return; + } /* * Now that we have buffer lock, get accurate information about the diff --cc src/backend/utils/activity/pgstat_relation.c index 5c70543ba88,6baf551e5be..00000000000 --- a/src/backend/utils/activity/pgstat_relation.c +++ b/src/backend/utils/activity/pgstat_relation.c @@@ -926,11 -967,15 +975,23 @@@ pgstat_relation_flush_cb(PgStat_EntryRe } tabentry->tuples_returned += lstats->tab.counts.tuples_returned; tabentry->tuples_fetched += lstats->tab.counts.tuples_fetched; ++<<<<<<< ours + tabentry->tuples_inserted += lstats->tab.counts_xact.tuples_inserted; + tabentry->tuples_updated += lstats->tab.counts_xact.tuples_updated; + tabentry->tuples_deleted += lstats->tab.counts_xact.tuples_deleted; + tabentry->tuples_hot_updated += lstats->tab.counts_xact.tuples_hot_updated; + tabentry->tuples_newpage_updated += lstats->tab.counts_xact.tuples_newpage_updated; ++======= + tabentry->tuples_inserted += lstats->tab.counts.tuples_inserted; + tabentry->tuples_updated += lstats->tab.counts.tuples_updated; + tabentry->tuples_deleted += lstats->tab.counts.tuples_deleted; + tabentry->tuples_hot_updated += lstats->tab.counts.tuples_hot_updated; + tabentry->tuples_newpage_updated += lstats->tab.counts.tuples_newpage_updated; + tabentry->prune_onaccess += lstats->tab.counts.prune_onaccess; + tabentry->prune_onaccess_missed += lstats->tab.counts.prune_onaccess_missed; + tabentry->pages_all_visible_onaccess += + lstats->tab.counts.pages_all_visible_onaccess; ++>>>>>>> theirs /* * If table was truncated/dropped, first reset the live/dead counters. diff --cc src/include/catalog/catversion.h index 97d367cdd42,f8aaf9aab02..00000000000 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@@ -57,6 -57,6 +57,10 @@@ */ /* yyyymmddN */ ++<<<<<<< ours +#define CATALOG_VERSION_NO 202609112 ++======= + #define CATALOG_VERSION_NO 202609102 ++>>>>>>> theirs #endif diff --cc src/include/pgstat.h index 187d82c96fe,2e146ec9195..00000000000 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@@ -173,6 -150,13 +173,16 @@@ typedef struct PgStat_TableCountsXac PgStat_Counter tuples_deleted; PgStat_Counter tuples_hot_updated; PgStat_Counter tuples_newpage_updated; ++<<<<<<< ours ++======= + + /* on-access (opportunistic) pruning */ + PgStat_Counter prune_onaccess; + PgStat_Counter prune_onaccess_missed; + PgStat_Counter pages_all_visible_onaccess; + + bool truncdropped; ++>>>>>>> theirs PgStat_Counter delta_live_tuples; PgStat_Counter delta_dead_tuples;