=== Applying patches on top of PostgreSQL commit ID a78cf591a3f5288aa5ae96902a36e342a3178b79 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sun Apr 12 21:41:27 UTC 2026 On branch cf/5007 nothing to commit, working tree clean === using 'git am' to apply patch ./v15-0001-Key-PGSTAT_KIND_RELATION-by-relfile-locator.patch === Applying: Key PGSTAT_KIND_RELATION by relfile locator Using index info to reconstruct a base tree... M src/backend/postmaster/autovacuum.c M src/backend/utils/activity/pgstat_relation.c M src/backend/utils/adt/pgstatfuncs.c M src/include/pgstat.h M src/include/utils/pgstat_internal.h Falling back to patching base and 3-way merge... Auto-merging src/include/utils/pgstat_internal.h Auto-merging src/include/pgstat.h CONFLICT (content): Merge conflict in src/include/pgstat.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/postmaster/autovacuum.c CONFLICT (content): Merge conflict in src/backend/postmaster/autovacuum.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 Key PGSTAT_KIND_RELATION by relfile locator 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 ./v15-0001-Key-PGSTAT_KIND_RELATION-by-relfile-locator.patch === patching file src/backend/postmaster/autovacuum.c Hunk #1 succeeded at 2041 (offset 6 lines). Hunk #2 succeeded at 2049 (offset 6 lines). Hunk #3 FAILED at 2074. Hunk #4 succeeded at 2150 (offset 2 lines). Hunk #5 succeeded at 2159 (offset 2 lines). Hunk #6 FAILED at 2179. Hunk #7 FAILED at 2997. 3 out of 7 hunks FAILED -- saving rejects to file src/backend/postmaster/autovacuum.c.rej patching file src/backend/utils/activity/pgstat_relation.c Hunk #3 FAILED at 64. Hunk #4 succeeded at 99 (offset 1 line). Hunk #5 succeeded at 137 (offset 1 line). Hunk #6 succeeded at 199 (offset 1 line). Hunk #7 succeeded at 217 (offset 1 line). Hunk #8 succeeded at 253 (offset 1 line). Hunk #9 succeeded at 328 (offset 1 line). Hunk #10 succeeded at 368 (offset 1 line). Hunk #11 FAILED at 526. Hunk #12 FAILED at 534. Hunk #13 succeeded at 563 (offset 2 lines). Hunk #14 succeeded at 769 (offset 2 lines). Hunk #15 succeeded at 817 (offset 2 lines). Hunk #16 succeeded at 852 (offset 2 lines). Hunk #17 succeeded at 987 (offset 2 lines). Hunk #18 succeeded at 1080 (offset 2 lines). 3 out of 18 hunks FAILED -- saving rejects to file src/backend/utils/activity/pgstat_relation.c.rej patching file src/backend/utils/adt/pgstatfuncs.c Hunk #2 succeeded at 2001 (offset -4 lines). Hunk #3 succeeded at 2365 (offset -4 lines). patching file src/include/catalog/pg_tablespace.dat patching file src/include/catalog/pg_tablespace.h patching file src/include/pgstat.h Hunk #4 FAILED at 773. 1 out of 4 hunks FAILED -- saving rejects to file src/include/pgstat.h.rej patching file src/include/utils/pgstat_internal.h Hunk #1 succeeded at 784 (offset -2 lines). patching file src/test/recovery/t/029_stats_restart.pl Unstaged changes after reset: M src/backend/postmaster/autovacuum.c M src/backend/utils/activity/pgstat_relation.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_tablespace.dat M src/include/catalog/pg_tablespace.h M src/include/pgstat.h M src/include/utils/pgstat_internal.h M src/test/recovery/t/029_stats_restart.pl Removing src/backend/postmaster/autovacuum.c.rej Removing src/backend/utils/activity/pgstat_relation.c.rej Removing src/include/pgstat.h.rej === using 'git apply' to apply patch ./v15-0001-Key-PGSTAT_KIND_RELATION-by-relfile-locator.patch === Applied patch to 'src/backend/postmaster/autovacuum.c' with conflicts. 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/pg_tablespace.dat' cleanly. Applied patch to 'src/include/catalog/pg_tablespace.h' cleanly. Applied patch to 'src/include/pgstat.h' with conflicts. Applied patch to 'src/include/utils/pgstat_internal.h' cleanly. Applied patch to 'src/test/recovery/t/029_stats_restart.pl' cleanly. U src/backend/postmaster/autovacuum.c U src/backend/utils/activity/pgstat_relation.c U src/include/pgstat.h diff --cc src/backend/postmaster/autovacuum.c index 82061247988,0a028b18d66..00000000000 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@@ -2075,11 -2074,11 +2080,15 @@@ do_autovacuum(void /* Fetch reloptions and the pgstat entry for this table */ relopts = extract_autovac_opts(tuple, pg_class_desc); ++<<<<<<< ours ++======= + tabentry = pgstat_fetch_stat_tabentry_by_locator(locator); ++>>>>>>> theirs /* Check if it needs vacuum or analyze */ - relation_needs_vacanalyze(relid, relopts, classForm, tabentry, + relation_needs_vacanalyze(relid, relopts, classForm, effective_multixact_freeze_max_age, + DEBUG3, &dovacuum, &doanalyze, &wraparound, &scores); @@@ -2171,9 -2177,11 +2184,16 @@@ relopts = &hentry->ar_reloptions; } ++<<<<<<< ours + relation_needs_vacanalyze(relid, relopts, classForm, ++======= + /* Fetch the pgstat entry for this table */ + tabentry = pgstat_fetch_stat_tabentry_by_locator(locator); + + relation_needs_vacanalyze(relid, relopts, classForm, tabentry, ++>>>>>>> theirs effective_multixact_freeze_max_age, + DEBUG3, &dovacuum, &doanalyze, &wraparound, &scores); @@@ -2987,6 -2975,39 +3007,42 @@@ table_recheck_autovac(Oid relid, HTAB * } /* ++<<<<<<< ours ++======= + * recheck_relation_needs_vacanalyze + * + * Subroutine for table_recheck_autovac. + * + * Fetch the pgstat of a relation and recheck whether a relation + * needs to be vacuumed or analyzed. + */ + static void + recheck_relation_needs_vacanalyze(Oid relid, + AutoVacOpts *avopts, + Form_pg_class classForm, + int effective_multixact_freeze_max_age, + bool *dovacuum, + bool *doanalyze, + bool *wraparound) + { + PgStat_StatTabEntry *tabentry; + AutoVacuumScores scores; + + /* fetch the pgstat table entry */ + tabentry = pgstat_fetch_stat_tabentry_ext(relid); + + relation_needs_vacanalyze(relid, avopts, classForm, tabentry, + effective_multixact_freeze_max_age, + dovacuum, doanalyze, wraparound, + &scores); + + /* Release tabentry to avoid leakage */ + if (tabentry) + pfree(tabentry); + } + + /* ++>>>>>>> theirs * relation_needs_vacanalyze * * Check whether a relation needs to be vacuumed or analyzed; return each into diff --cc src/backend/utils/activity/pgstat_relation.c index b2ca28f83ba,89bf0cbed56..00000000000 --- a/src/backend/utils/activity/pgstat_relation.c +++ b/src/backend/utils/activity/pgstat_relation.c @@@ -60,9 -64,7 +64,13 @@@ pgstat_copy_relation_stats(Relation dst PgStatShared_Relation *dstshstats; PgStat_EntryRef *dst_ref; ++<<<<<<< ours + srcstats = pgstat_fetch_stat_tabentry_ext(src->rd_rel->relisshared, + RelationGetRelid(src), + NULL); ++======= + srcstats = pgstat_fetch_stat_tabentry_ext(RelationGetRelid(src)); ++>>>>>>> theirs if (!srcstats) return; @@@ -469,21 -525,31 +531,45 @@@ pgstat_update_heap_dead_tuples(Relatio PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid) { ++<<<<<<< ours + return pgstat_fetch_stat_tabentry_ext(IsSharedRelation(relid), relid, NULL); ++======= + return pgstat_fetch_stat_tabentry_ext(relid); + } + + PgStat_StatTabEntry * + pgstat_fetch_stat_tabentry_by_locator(RelFileLocator locator) + { + return (PgStat_StatTabEntry *) pgstat_fetch_entry( + PGSTAT_KIND_RELATION, + locator.dbOid, + RelFileLocatorToPgStatObjid(locator)); ++>>>>>>> theirs } /* * More efficient version of pgstat_fetch_stat_tabentry(), allowing to specify - * whether the to-be-accessed table is a shared relation or not. + * whether the to-be-accessed table is a shared relation or not. This version + * also returns whether the caller can pfree() the result if desired. */ PgStat_StatTabEntry * ++<<<<<<< ours +pgstat_fetch_stat_tabentry_ext(bool shared, Oid reloid, bool *may_free) ++======= + pgstat_fetch_stat_tabentry_ext(Oid reloid) ++>>>>>>> theirs { - Oid dboid = (shared ? InvalidOid : MyDatabaseId); + RelFileLocator locator; ++<<<<<<< ours + return (PgStat_StatTabEntry *) + pgstat_fetch_entry(PGSTAT_KIND_RELATION, dboid, reloid, may_free); ++======= + if (!pgstat_reloid_to_relfilelocator(reloid, &locator)) + return NULL; + + return pgstat_fetch_stat_tabentry_by_locator(locator); ++>>>>>>> theirs } /* diff --cc src/include/pgstat.h index dfa2e837638,ef740aff26e..00000000000 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@@ -762,9 -773,8 +769,14 @@@ extern void pgstat_twophase_postabort(F void *recdata, uint32 len); extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid); ++<<<<<<< ours +extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(bool shared, + Oid reloid, + bool *may_free); ++======= + extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_by_locator(RelFileLocator locator); + extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(Oid reloid); ++>>>>>>> theirs extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);