=== Applying patches on top of PostgreSQL commit ID 9ea3b6f751abd7701f3f32d9df26d66410754c94 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Wed Aug 6 22:50:21 UTC 2025 On branch cf/5865 nothing to commit, working tree clean === using 'git am' to apply patch ./0001-Make-injection-point-facilities-consistent-with-HEAD.patch === Applying: Make injection point facilities consistent with HEAD Using index info to reconstruct a base tree... M doc/src/sgml/xfunc.sgml M src/backend/access/gin/ginbtree.c M src/backend/access/heap/heapam.c M src/backend/access/index/genam.c M src/backend/access/transam/xlog.c M src/backend/commands/indexcmds.c M src/backend/commands/vacuum.c M src/backend/replication/logical/logical.c M src/backend/tcop/postgres.c M src/backend/utils/cache/catcache.c M src/backend/utils/cache/inval.c M src/backend/utils/misc/injection_point.c M src/include/utils/injection_point.h M src/test/modules/injection_points/expected/injection_points.out M src/test/modules/injection_points/injection_points--1.0.sql M src/test/modules/injection_points/injection_points.c M src/test/modules/injection_points/sql/injection_points.sql Falling back to patching base and 3-way merge... Auto-merging src/test/modules/injection_points/sql/injection_points.sql Auto-merging src/test/modules/injection_points/injection_points.c CONFLICT (content): Merge conflict in src/test/modules/injection_points/injection_points.c Auto-merging src/test/modules/injection_points/injection_points--1.0.sql Auto-merging src/test/modules/injection_points/expected/injection_points.out Auto-merging src/include/utils/injection_point.h CONFLICT (content): Merge conflict in src/include/utils/injection_point.h Auto-merging src/backend/utils/misc/injection_point.c CONFLICT (content): Merge conflict in src/backend/utils/misc/injection_point.c Auto-merging src/backend/utils/cache/inval.c Auto-merging src/backend/utils/cache/catcache.c Auto-merging src/backend/tcop/postgres.c Auto-merging src/backend/replication/logical/logical.c Auto-merging src/backend/commands/vacuum.c CONFLICT (content): Merge conflict in src/backend/commands/vacuum.c Auto-merging src/backend/commands/indexcmds.c Auto-merging src/backend/access/transam/xlog.c Auto-merging src/backend/access/index/genam.c CONFLICT (content): Merge conflict in src/backend/access/index/genam.c Auto-merging src/backend/access/heap/heapam.c Auto-merging src/backend/access/gin/ginbtree.c Auto-merging doc/src/sgml/xfunc.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 Make injection point facilities consistent with HEAD 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/access/index/genam.c M src/backend/commands/vacuum.c M src/backend/utils/misc/injection_point.c M src/include/utils/injection_point.h M src/test/modules/injection_points/injection_points.c === using patch(1) to apply patch ./0001-Make-injection-point-facilities-consistent-with-HEAD.patch === patching file src/include/utils/injection_point.h Hunk #1 FAILED at 12. Hunk #2 FAILED at 34. 2 out of 2 hunks FAILED -- saving rejects to file src/include/utils/injection_point.h.rej patching file src/backend/access/gin/ginbtree.c Hunk #1 FAILED at 685. Hunk #2 FAILED at 778. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/access/gin/ginbtree.c.rej patching file src/backend/access/heap/heapam.c Hunk #1 FAILED at 3294. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/access/heap/heapam.c.rej patching file src/backend/access/index/genam.c Hunk #1 FAILED at 841. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/access/index/genam.c.rej patching file src/backend/access/transam/xlog.c Hunk #1 FAILED at 7314. Hunk #2 FAILED at 7717. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/access/transam/xlog.c.rej patching file src/backend/commands/indexcmds.c Hunk #1 FAILED at 3795. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/commands/indexcmds.c.rej patching file src/backend/commands/vacuum.c Hunk #1 FAILED at 2173. Hunk #2 FAILED at 2195. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/commands/vacuum.c.rej patching file src/backend/replication/logical/logical.c Hunk #1 FAILED at 1923. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/replication/logical/logical.c.rej patching file src/backend/tcop/postgres.c Hunk #1 FAILED at 3442. Hunk #2 FAILED at 3455. Hunk #3 FAILED at 3468. 3 out of 3 hunks FAILED -- saving rejects to file src/backend/tcop/postgres.c.rej patching file src/backend/utils/cache/catcache.c Hunk #1 FAILED at 1906. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/utils/cache/catcache.c.rej patching file src/backend/utils/cache/inval.c Hunk #1 FAILED at 1032. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/utils/cache/inval.c.rej patching file src/backend/utils/misc/injection_point.c Hunk #1 succeeded at 21 with fuzz 2 (offset 4 lines). Hunk #2 FAILED at 29. Hunk #3 FAILED at 523. 2 out of 3 hunks FAILED -- saving rejects to file src/backend/utils/misc/injection_point.c.rej patching file src/test/modules/injection_points/expected/injection_points.out Hunk #1 FAILED at 6. Hunk #2 succeeded at 75 (offset 36 lines). Hunk #3 FAILED at 62. Hunk #4 succeeded at 241 (offset 99 lines). 2 out of 4 hunks FAILED -- saving rejects to file src/test/modules/injection_points/expected/injection_points.out.rej patching file src/test/modules/injection_points/injection_points--1.0.sql Hunk #1 FAILED at 14. 1 out of 1 hunk FAILED -- saving rejects to file src/test/modules/injection_points/injection_points--1.0.sql.rej patching file src/test/modules/injection_points/injection_points.c Hunk #1 FAILED at 87. Hunk #2 FAILED at 175. Hunk #3 FAILED at 299. Hunk #4 FAILED at 309. 4 out of 4 hunks FAILED -- saving rejects to file src/test/modules/injection_points/injection_points.c.rej patching file src/test/modules/injection_points/sql/injection_points.sql Hunk #1 succeeded at 13 with fuzz 2 (offset 4 lines). Hunk #2 succeeded at 37 with fuzz 2 (offset 17 lines). Hunk #3 succeeded at 71 with fuzz 2 (offset 22 lines). patching file doc/src/sgml/xfunc.sgml Hunk #1 FAILED at 3608. Hunk #2 FAILED at 3642. Hunk #3 succeeded at 3923 with fuzz 1 (offset 267 lines). 2 out of 3 hunks FAILED -- saving rejects to file doc/src/sgml/xfunc.sgml.rej Unstaged changes after reset: M doc/src/sgml/xfunc.sgml M src/backend/utils/misc/injection_point.c M src/test/modules/injection_points/expected/injection_points.out M src/test/modules/injection_points/sql/injection_points.sql Removing doc/src/sgml/xfunc.sgml.rej Removing src/backend/access/gin/ginbtree.c.rej Removing src/backend/access/heap/heapam.c.rej Removing src/backend/access/index/genam.c.rej Removing src/backend/access/transam/xlog.c.rej Removing src/backend/commands/indexcmds.c.rej Removing src/backend/commands/vacuum.c.rej Removing src/backend/replication/logical/logical.c.rej Removing src/backend/tcop/postgres.c.rej Removing src/backend/utils/cache/catcache.c.rej Removing src/backend/utils/cache/inval.c.rej Removing src/backend/utils/misc/injection_point.c.rej Removing src/include/utils/injection_point.h.rej Removing src/test/modules/injection_points/expected/injection_points.out.rej Removing src/test/modules/injection_points/injection_points--1.0.sql.rej Removing src/test/modules/injection_points/injection_points.c.rej === using 'git apply' to apply patch ./0001-Make-injection-point-facilities-consistent-with-HEAD.patch === Applied patch to 'src/include/utils/injection_point.h' with conflicts. Applied patch to 'src/backend/access/gin/ginbtree.c' cleanly. Applied patch to 'src/backend/access/heap/heapam.c' cleanly. Applied patch to 'src/backend/access/index/genam.c' with conflicts. Applied patch to 'src/backend/access/transam/xlog.c' cleanly. Applied patch to 'src/backend/commands/indexcmds.c' cleanly. Applied patch to 'src/backend/commands/vacuum.c' with conflicts. Applied patch to 'src/backend/replication/logical/logical.c' cleanly. Applied patch to 'src/backend/tcop/postgres.c' cleanly. Applied patch to 'src/backend/utils/cache/catcache.c' cleanly. Applied patch to 'src/backend/utils/cache/inval.c' cleanly. Applied patch to 'src/backend/utils/misc/injection_point.c' with conflicts. Applied patch to 'src/test/modules/injection_points/expected/injection_points.out' cleanly. Applied patch to 'src/test/modules/injection_points/injection_points--1.0.sql' cleanly. Applied patch to 'src/test/modules/injection_points/injection_points.c' with conflicts. Applied patch to 'src/test/modules/injection_points/sql/injection_points.sql' cleanly. Applied patch to 'doc/src/sgml/xfunc.sgml' cleanly. U src/backend/access/index/genam.c U src/backend/commands/vacuum.c U src/backend/utils/misc/injection_point.c U src/include/utils/injection_point.h U src/test/modules/injection_points/injection_points.c diff --cc src/backend/access/index/genam.c index 0cb27af1310,6c75ab7b304..00000000000 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@@ -851,9 -840,10 +851,13 @@@ systable_inplace_update_begin(Relation if (retries++ > 10000) elog(ERROR, "giving up after too many tries to overwrite row"); ++<<<<<<< ours ++======= + memcpy(mutable_key, key, sizeof(ScanKeyData) * nkeys); ++>>>>>>> theirs INJECTION_POINT("inplace-before-pin", NULL); scan = systable_beginscan(relation, indexId, indexOK, snapshot, - nkeys, mutable_key); + nkeys, unconstify(ScanKeyData *, key)); oldtup = systable_getnext(scan); if (!HeapTupleIsValid(oldtup)) { diff --cc src/backend/commands/vacuum.c index 733ef40ae7c,132cad6c7a0..00000000000 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@@ -2196,11 -2172,11 +2196,19 @@@ vacuum_rel(Oid relid, RangeVar *relatio } #ifdef USE_INJECTION_POINTS ++<<<<<<< ours + if (params.index_cleanup == VACOPTVALUE_AUTO) + INJECTION_POINT("vacuum-index-cleanup-auto", NULL); + else if (params.index_cleanup == VACOPTVALUE_DISABLED) + INJECTION_POINT("vacuum-index-cleanup-disabled", NULL); + else if (params.index_cleanup == VACOPTVALUE_ENABLED) ++======= + if (params->index_cleanup == VACOPTVALUE_AUTO) + INJECTION_POINT("vacuum-index-cleanup-auto", NULL); + else if (params->index_cleanup == VACOPTVALUE_DISABLED) + INJECTION_POINT("vacuum-index-cleanup-disabled", NULL); + else if (params->index_cleanup == VACOPTVALUE_ENABLED) ++>>>>>>> theirs INJECTION_POINT("vacuum-index-cleanup-enabled", NULL); #endif @@@ -2235,11 -2194,11 +2243,19 @@@ } #ifdef USE_INJECTION_POINTS ++<<<<<<< ours + if (params.truncate == VACOPTVALUE_AUTO) + INJECTION_POINT("vacuum-truncate-auto", NULL); + else if (params.truncate == VACOPTVALUE_DISABLED) + INJECTION_POINT("vacuum-truncate-disabled", NULL); + else if (params.truncate == VACOPTVALUE_ENABLED) ++======= + if (params->truncate == VACOPTVALUE_AUTO) + INJECTION_POINT("vacuum-truncate-auto", NULL); + else if (params->truncate == VACOPTVALUE_DISABLED) + INJECTION_POINT("vacuum-truncate-disabled", NULL); + else if (params->truncate == VACOPTVALUE_ENABLED) ++>>>>>>> theirs INJECTION_POINT("vacuum-truncate-enabled", NULL); #endif diff --cc src/backend/utils/misc/injection_point.c index 83b887b6978,c80653a7458..00000000000 --- a/src/backend/utils/misc/injection_point.c +++ b/src/backend/utils/misc/injection_point.c @@@ -579,54 -579,8 +579,60 @@@ IsInjectionPointAttached(const char *na { #ifdef USE_INJECTION_POINTS return InjectionPointCacheRefresh(name) != NULL; ++<<<<<<< ours #else elog(ERROR, "Injection points are not supported by this build"); return false; /* silence compiler */ #endif } + +/* + * Retrieve a list of all the injection points currently attached. + * + * This list is palloc'd in the current memory context. + */ +List * +InjectionPointList(void) +{ +#ifdef USE_INJECTION_POINTS + List *inj_points = NIL; + uint32 max_inuse; + + LWLockAcquire(InjectionPointLock, LW_SHARED); + + max_inuse = pg_atomic_read_u32(&ActiveInjectionPoints->max_inuse); + + for (uint32 idx = 0; idx < max_inuse; idx++) + { + InjectionPointEntry *entry; + InjectionPointData *inj_point; + uint64 generation; + + entry = &ActiveInjectionPoints->entries[idx]; + generation = pg_atomic_read_u64(&entry->generation); + + /* skip free slots */ + if (generation % 2 == 0) + continue; + + inj_point = (InjectionPointData *) palloc0(sizeof(InjectionPointData)); + inj_point->name = pstrdup(entry->name); + inj_point->library = pstrdup(entry->library); + inj_point->function = pstrdup(entry->function); + inj_points = lappend(inj_points, inj_point); + } + + LWLockRelease(InjectionPointLock); + + return inj_points; + +#else + elog(ERROR, "Injection points are not supported by this build"); + return NIL; /* keep compiler quiet */ ++======= ++#else ++ elog(ERROR, "Injection points are not supported by this build"); ++ return false; /* silence compiler */ ++>>>>>>> theirs +#endif +} diff --cc src/include/utils/injection_point.h index fd5bc061b7b,1a7c3067705..00000000000 --- a/src/include/utils/injection_point.h +++ b/src/include/utils/injection_point.h @@@ -11,20 -11,7 +11,23 @@@ #ifndef INJECTION_POINT_H #define INJECTION_POINT_H +#include "nodes/pg_list.h" + /* ++<<<<<<< ours + * Injection point data, used when retrieving a list of all the attached + * injection points. + */ +typedef struct InjectionPointData +{ + const char *name; + const char *library; + const char *function; +} InjectionPointData; + +/* ++======= ++>>>>>>> theirs * Injection points require --enable-injection-points. */ #ifdef USE_INJECTION_POINTS diff --cc src/test/modules/injection_points/injection_points.c index 31138301117,b2048e310e2..00000000000 --- a/src/test/modules/injection_points/injection_points.c +++ b/src/test/modules/injection_points/injection_points.c @@@ -251,8 -186,6 +251,11 @@@ injection_error(const char *name, cons if (!injection_point_allowed(condition)) return; ++<<<<<<< ours + pgstat_report_inj(name); + ++======= ++>>>>>>> theirs if (argstr) elog(ERROR, "error triggered for injection point %s (%s)", name, argstr); @@@ -269,8 -202,6 +272,11 @@@ injection_notice(const char *name, cons if (!injection_point_allowed(condition)) return; ++<<<<<<< ours + pgstat_report_inj(name); + ++======= ++>>>>>>> theirs if (argstr) elog(NOTICE, "notice triggered for injection point %s (%s)", name, argstr); @@@ -385,9 -313,6 +391,12 @@@ injection_points_attach(PG_FUNCTION_ARG MemoryContextSwitchTo(oldctx); } ++<<<<<<< ours + /* Add entry for stats */ + pgstat_create_inj(name); + ++======= ++>>>>>>> theirs PG_RETURN_VOID(); } @@@ -403,7 -328,6 +412,10 @@@ injection_points_load(PG_FUNCTION_ARGS if (inj_state == NULL) injection_init_shmem(); ++<<<<<<< ours + pgstat_report_inj_fixed(0, 0, 0, 0, 1); ++======= ++>>>>>>> theirs INJECTION_POINT_LOAD(name); PG_RETURN_VOID(); @@@ -422,6 -346,6 +434,7 @@@ injection_points_run(PG_FUNCTION_ARGS if (PG_ARGISNULL(0)) PG_RETURN_VOID(); name = text_to_cstring(PG_GETARG_TEXT_PP(0)); ++<<<<<<< ours if (!PG_ARGISNULL(1)) arg = text_to_cstring(PG_GETARG_TEXT_PP(1)); @@@ -449,7 -372,6 +462,35 @@@ injection_points_cached(PG_FUNCTION_ARG if (!PG_ARGISNULL(1)) arg = text_to_cstring(PG_GETARG_TEXT_PP(1)); + pgstat_report_inj_fixed(0, 0, 0, 1, 0); ++======= ++ ++ if (!PG_ARGISNULL(1)) ++ arg = text_to_cstring(PG_GETARG_TEXT_PP(1)); ++ ++ INJECTION_POINT(name, arg); ++ ++ PG_RETURN_VOID(); ++} ++ ++/* ++ * SQL function for triggering an injection point from cache. ++ */ ++PG_FUNCTION_INFO_V1(injection_points_cached); ++Datum ++injection_points_cached(PG_FUNCTION_ARGS) ++{ ++ char *name; ++ char *arg = NULL; ++ ++ if (PG_ARGISNULL(0)) ++ PG_RETURN_VOID(); ++ name = text_to_cstring(PG_GETARG_TEXT_PP(0)); ++ ++ if (!PG_ARGISNULL(1)) ++ arg = text_to_cstring(PG_GETARG_TEXT_PP(1)); ++ ++>>>>>>> theirs INJECTION_POINT_CACHED(name, arg); PG_RETURN_VOID();