=== Applying patches on top of PostgreSQL commit ID 5668fff3c512a61b7f8a2b9bf04270578cf5665a === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Sep 29 08:21:20 UTC 2025 On branch cf/6052 nothing to commit, working tree clean === using 'git am' to apply patch ./v3-0001-Add-support-for-entry-counting-in-pgstats.patch === Applying: Add support for entry counting in pgstats Using index info to reconstruct a base tree... M src/backend/utils/activity/pgstat.c M src/backend/utils/activity/pgstat_shmem.c M src/include/utils/pgstat_internal.h Falling back to patching base and 3-way merge... Auto-merging src/include/utils/pgstat_internal.h CONFLICT (content): Merge conflict in src/include/utils/pgstat_internal.h Auto-merging src/backend/utils/activity/pgstat_shmem.c CONFLICT (content): Merge conflict in src/backend/utils/activity/pgstat_shmem.c Auto-merging src/backend/utils/activity/pgstat.c CONFLICT (content): Merge conflict in src/backend/utils/activity/pgstat.c 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 support for entry counting in pgstats 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". Unstaged changes after reset: M src/backend/utils/activity/pgstat.c M src/backend/utils/activity/pgstat_shmem.c M src/include/utils/pgstat_internal.h === using patch(1) to apply patch ./v3-0001-Add-support-for-entry-counting-in-pgstats.patch === patching file src/include/utils/pgstat_internal.h Hunk #1 succeeded at 231 with fuzz 2. Hunk #2 succeeded at 503 with fuzz 2 (offset -3 lines). Hunk #3 succeeded at 968 with fuzz 1 (offset 27 lines). patching file src/backend/utils/activity/pgstat.c Hunk #1 FAILED at 1487. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/utils/activity/pgstat.c.rej patching file src/backend/utils/activity/pgstat_shmem.c Hunk #1 FAILED at 210. Hunk #2 succeeded at 352 with fuzz 2 (offset 49 lines). Hunk #3 FAILED at 320. Hunk #4 FAILED at 331. Hunk #5 FAILED at 860. Hunk #6 FAILED at 873. Hunk #7 succeeded at 927 (offset 18 lines). 5 out of 7 hunks FAILED -- saving rejects to file src/backend/utils/activity/pgstat_shmem.c.rej Unstaged changes after reset: M src/backend/utils/activity/pgstat_shmem.c M src/include/utils/pgstat_internal.h Removing src/backend/utils/activity/pgstat.c.rej Removing src/backend/utils/activity/pgstat_shmem.c.rej === using 'git apply' to apply patch ./v3-0001-Add-support-for-entry-counting-in-pgstats.patch === Applied patch to 'src/include/utils/pgstat_internal.h' with conflicts. Applied patch to 'src/backend/utils/activity/pgstat.c' with conflicts. Applied patch to 'src/backend/utils/activity/pgstat_shmem.c' with conflicts. U src/backend/utils/activity/pgstat.c U src/backend/utils/activity/pgstat_shmem.c U src/include/utils/pgstat_internal.h diff --cc src/backend/utils/activity/pgstat.c index 44621653d8d,5aee8a4ce1c..00000000000 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@@ -1488,9 -1488,11 +1488,17 @@@ pgstat_register_kind(PgStat_Kind kind, (errmsg("custom cumulative statistics property is invalid"), errhint("Custom cumulative statistics require a shared memory size for fixed-numbered objects."))); if (kind_info->track_entry_count) ++<<<<<<< ours + ereport(ERROR, + (errmsg("custom cumulative statistics property is invalid"), + errhint("Custom cumulative statistics cannot use entry count tracking for fixed-numbered objects."))); ++======= + { + ereport(ERROR, + (errmsg("custom cumulative statistics property is invalid"), + errhint("Custom cumulative statistics cannot use counter tracking for fixed-numbered objects."))); + } ++>>>>>>> theirs } /* diff --cc src/backend/utils/activity/pgstat_shmem.c index 746e9541bf3,6c686d1615b..00000000000 --- a/src/backend/utils/activity/pgstat_shmem.c +++ b/src/backend/utils/activity/pgstat_shmem.c @@@ -219,7 -219,7 +219,11 @@@ StatsShmemInit(void if (!kind_info) continue; ++<<<<<<< ours + /* initialize entry count tracking */ ++======= + /* initialize counter tracking */ ++>>>>>>> theirs if (kind_info->track_entry_count) pg_atomic_init_u64(&ctl->entry_counts[kind - 1], 0); @@@ -887,7 -887,10 +891,14 @@@ pgstat_free_entry(PgStatShared_HashEntr dsa_free(pgStatLocal.dsa, pdsa); ++<<<<<<< ours + /* Decrement entry count, if required. */ ++======= + /* + * Entry has been dropped with refcount at 0, hence decrement the + * entry counter. + */ ++>>>>>>> theirs if (pgstat_get_kind_info(kind)->track_entry_count) pg_atomic_sub_fetch_u64(&pgStatLocal.shmem->entry_counts[kind - 1], 1); } diff --cc src/include/utils/pgstat_internal.h index 88d09ea20ba,c07efa1c8eb..00000000000 --- a/src/include/utils/pgstat_internal.h +++ b/src/include/utils/pgstat_internal.h @@@ -510,9 -510,9 +510,15 @@@ typedef struct PgStat_ShmemContro * Counters for the number of entries associated to a single stats kind * that uses variable-numbered objects stored in the shared hash table. * These counters can be enabled on a per-kind basis, when ++<<<<<<< ours + * track_entry_count is set. This counter is incremented each time a new + * entry is created (not reused) in the shared hash table, and is + * decremented each time an entry is freed from the shared hash table. ++======= + * track_entry_count is set. This counter is incremented each time a + * new entry is created (not reused) in the shared hash table, and is + * decremented each time an entry is dropped from the shared hash table. ++>>>>>>> theirs */ pg_atomic_uint64 entry_counts[PGSTAT_KIND_MAX];