=== Applying patches on top of PostgreSQL commit ID 7a662a46ebf74e9fa15cb62b592b4bf00c96fc94 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sun Oct 12 21:11:20 UTC 2025 On branch cf/6082 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-0001-Add-stats-related-to-slot-sync-skip.patch === Applying: Add stats related to slot sync skip Using index info to reconstruct a base tree... M contrib/test_decoding/expected/stats.out M doc/src/sgml/monitoring.sgml M doc/src/sgml/system-views.sgml M src/backend/catalog/system_views.sql M src/backend/utils/activity/pgstat_replslot.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/test/regress/expected/rules.out M src/tools/pgindent/typedefs.list Falling back to patching base and 3-way merge... Auto-merging src/tools/pgindent/typedefs.list Auto-merging src/test/regress/expected/rules.out CONFLICT (content): Merge conflict in src/test/regress/expected/rules.out Auto-merging src/include/pgstat.h Auto-merging src/include/catalog/pg_proc.dat CONFLICT (content): Merge conflict in 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/utils/activity/pgstat_replslot.c Auto-merging src/backend/catalog/system_views.sql Auto-merging doc/src/sgml/system-views.sgml Auto-merging doc/src/sgml/monitoring.sgml Auto-merging contrib/test_decoding/expected/stats.out CONFLICT (content): Merge conflict in contrib/test_decoding/expected/stats.out 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 stats related to slot sync skip 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 contrib/test_decoding/expected/stats.out M doc/src/sgml/monitoring.sgml M doc/src/sgml/system-views.sgml M src/backend/catalog/system_views.sql M src/backend/replication/logical/slotsync.c M src/backend/replication/slotfuncs.c M src/backend/utils/activity/pgstat_replslot.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/include/replication/slot.h M src/test/regress/expected/rules.out M src/tools/pgindent/typedefs.list === using patch(1) to apply patch ./v4-0001-Add-stats-related-to-slot-sync-skip.patch === patching file contrib/test_decoding/expected/stats.out Hunk #1 FAILED at 78. 1 out of 1 hunk FAILED -- saving rejects to file contrib/test_decoding/expected/stats.out.rej patching file doc/src/sgml/monitoring.sgml Hunk #1 succeeded at 1655 (offset 11 lines). patching file doc/src/sgml/system-views.sgml Hunk #1 succeeded at 3102 (offset 66 lines). patching file src/backend/catalog/system_views.sql Hunk #1 succeeded at 1060 (offset 14 lines). Hunk #2 succeeded at 1077 with fuzz 1 (offset 15 lines). patching file src/backend/replication/logical/slotsync.c patching file src/backend/replication/slotfuncs.c patching file src/backend/utils/activity/pgstat_replslot.c Hunk #1 succeeded at 102 (offset 1 line). patching file src/backend/utils/adt/pgstatfuncs.c Hunk #1 FAILED at 2100. Hunk #2 FAILED at 2129. Hunk #3 FAILED at 2154. 3 out of 3 hunks FAILED -- saving rejects to file src/backend/utils/adt/pgstatfuncs.c.rej patching file src/include/catalog/pg_proc.dat Hunk #1 FAILED at 5687. Hunk #2 succeeded at 11511 (offset 8 lines). 1 out of 2 hunks FAILED -- saving rejects to file src/include/catalog/pg_proc.dat.rej patching file src/include/pgstat.h Hunk #1 succeeded at 398 with fuzz 1 (offset 2 lines). Hunk #2 succeeded at 743 (offset 4 lines). patching file src/include/replication/slot.h patching file src/test/regress/expected/rules.out Hunk #1 succeeded at 1507 (offset 8 lines). Hunk #2 FAILED at 2141. 1 out of 2 hunks FAILED -- saving rejects to file src/test/regress/expected/rules.out.rej patching file src/tools/pgindent/typedefs.list Hunk #1 succeeded at 2795 (offset 7 lines). Unstaged changes after reset: M doc/src/sgml/monitoring.sgml M doc/src/sgml/system-views.sgml M src/backend/catalog/system_views.sql M src/backend/replication/logical/slotsync.c M src/backend/replication/slotfuncs.c M src/backend/utils/activity/pgstat_replslot.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/include/replication/slot.h M src/test/regress/expected/rules.out M src/tools/pgindent/typedefs.list Removing contrib/test_decoding/expected/stats.out.rej Removing src/backend/utils/adt/pgstatfuncs.c.rej Removing src/include/catalog/pg_proc.dat.rej Removing src/test/regress/expected/rules.out.rej === using 'git apply' to apply patch ./v4-0001-Add-stats-related-to-slot-sync-skip.patch === Applied patch to 'contrib/test_decoding/expected/stats.out' with conflicts. Applied patch to 'doc/src/sgml/monitoring.sgml' cleanly. Applied patch to 'doc/src/sgml/system-views.sgml' cleanly. Applied patch to 'src/backend/catalog/system_views.sql' cleanly. Applied patch to 'src/backend/replication/logical/slotsync.c' cleanly. Applied patch to 'src/backend/replication/slotfuncs.c' cleanly. Applied patch to 'src/backend/utils/activity/pgstat_replslot.c' cleanly. Applied patch to 'src/backend/utils/adt/pgstatfuncs.c' with conflicts. Applied patch to 'src/include/catalog/pg_proc.dat' with conflicts. Applied patch to 'src/include/pgstat.h' cleanly. Applied patch to 'src/include/replication/slot.h' cleanly. Applied patch to 'src/test/regress/expected/rules.out' with conflicts. Applied patch to 'src/tools/pgindent/typedefs.list' cleanly. U contrib/test_decoding/expected/stats.out U src/backend/utils/adt/pgstatfuncs.c U src/include/catalog/pg_proc.dat U src/test/regress/expected/rules.out diff --cc contrib/test_decoding/expected/stats.out index 28da9123cc8,c1ff872c08c..00000000000 --- a/contrib/test_decoding/expected/stats.out +++ b/contrib/test_decoding/expected/stats.out @@@ -78,17 -78,17 +78,29 @@@ SELECT slot_name, spill_txns = 0 AS spi -- verify accessing/resetting stats for non-existent slot does something reasonable SELECT * FROM pg_stat_get_replication_slot('do-not-exist'); ++<<<<<<< ours + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | mem_exceeded_count | total_txns | total_bytes | stats_reset +--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ++======= + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | total_txns | total_bytes | slot_sync_skip_count | last_slot_sync_skip | stats_reset + --------------+------------+-------------+-------------+-------------+--------------+--------------+------------+-------------+----------------------+---------------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ++>>>>>>> theirs (1 row) SELECT pg_stat_reset_replication_slot('do-not-exist'); ERROR: replication slot "do-not-exist" does not exist SELECT * FROM pg_stat_get_replication_slot('do-not-exist'); ++<<<<<<< ours + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | mem_exceeded_count | total_txns | total_bytes | stats_reset +--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ++======= + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | total_txns | total_bytes | slot_sync_skip_count | last_slot_sync_skip | stats_reset + --------------+------------+-------------+-------------+-------------+--------------+--------------+------------+-------------+----------------------+---------------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ++>>>>>>> theirs (1 row) -- spilling the xact diff --cc src/backend/utils/adt/pgstatfuncs.c index 1fe33df2756,15500a77701..00000000000 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@@ -2121,7 -2100,7 +2121,11 @@@ pg_stat_get_archiver(PG_FUNCTION_ARGS Datum pg_stat_get_replication_slot(PG_FUNCTION_ARGS) { ++<<<<<<< ours +#define PG_STAT_GET_REPLICATION_SLOT_COLS 11 ++======= + #define PG_STAT_GET_REPLICATION_SLOT_COLS 12 ++>>>>>>> theirs text *slotname_text = PG_GETARG_TEXT_P(0); NameData slotname; TupleDesc tupdesc; @@@ -2146,13 -2125,15 +2150,21 @@@ INT8OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 7, "stream_bytes", INT8OID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 8, "total_txns", + TupleDescInitEntry(tupdesc, (AttrNumber) 8, "mem_exceeded_count", INT8OID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 9, "total_bytes", + TupleDescInitEntry(tupdesc, (AttrNumber) 9, "total_txns", INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 10, "total_bytes", + INT8OID, -1, 0); ++<<<<<<< ours + TupleDescInitEntry(tupdesc, (AttrNumber) 11, "stats_reset", ++======= + TupleDescInitEntry(tupdesc, (AttrNumber) 10, "slot_sync_skip_count", + INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 11, "last_slot_sync_skip", + TIMESTAMPTZOID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 12, "stats_reset", ++>>>>>>> theirs TIMESTAMPTZOID, -1, 0); BlessTupleDesc(tupdesc); @@@ -2175,14 -2156,19 +2187,30 @@@ values[4] = Int64GetDatum(slotent->stream_txns); values[5] = Int64GetDatum(slotent->stream_count); values[6] = Int64GetDatum(slotent->stream_bytes); ++<<<<<<< ours + values[7] = Int64GetDatum(slotent->mem_exceeded_count); + values[8] = Int64GetDatum(slotent->total_txns); + values[9] = Int64GetDatum(slotent->total_bytes); + + if (slotent->stat_reset_timestamp == 0) + nulls[10] = true; + else + values[10] = TimestampTzGetDatum(slotent->stat_reset_timestamp); ++======= + values[7] = Int64GetDatum(slotent->total_txns); + values[8] = Int64GetDatum(slotent->total_bytes); + values[9] = Int64GetDatum(slotent->slot_sync_skip_count); + + if (slotent->last_slot_sync_skip == 0) + nulls[10] = true; + else + values[10] = TimestampTzGetDatum(slotent->last_slot_sync_skip); + + if (slotent->stat_reset_timestamp == 0) + nulls[11] = true; + else + values[11] = TimestampTzGetDatum(slotent->stat_reset_timestamp); ++>>>>>>> theirs /* Returns the record as Datum */ PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(tupdesc, values, nulls))); diff --cc src/include/catalog/pg_proc.dat index b51d2b17379,649a6c0f78c..00000000000 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@@ -5691,9 -5687,9 +5691,15 @@@ { oid => '6169', descr => 'statistics: information about replication slot', proname => 'pg_stat_get_replication_slot', provolatile => 's', proparallel => 'r', prorettype => 'record', proargtypes => 'text', ++<<<<<<< ours + proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}', + proargmodes => '{i,o,o,o,o,o,o,o,o,o,o,o}', + proargnames => '{slot_name,slot_name,spill_txns,spill_count,spill_bytes,stream_txns,stream_count,stream_bytes,mem_exceeded_count,total_txns,total_bytes,stats_reset}', ++======= + proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz,timestamptz}', + proargmodes => '{i,o,o,o,o,o,o,o,o,o,o,o,o}', + proargnames => '{slot_name,slot_name,spill_txns,spill_count,spill_bytes,stream_txns,stream_count,stream_bytes,total_txns,total_bytes,slot_sync_skip_count,last_slot_sync_skip,stats_reset}', ++>>>>>>> theirs prosrc => 'pg_stat_get_replication_slot' }, { oid => '6230', descr => 'statistics: check if a stats object exists', diff --cc src/test/regress/expected/rules.out index 16753b2e4c0,041d3328328..00000000000 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@@ -2148,12 -2139,13 +2149,18 @@@ pg_stat_replication_slots| SELECT s.slo s.stream_txns, s.stream_count, s.stream_bytes, + s.mem_exceeded_count, s.total_txns, s.total_bytes, + s.slot_sync_skip_count, + s.last_slot_sync_skip, s.stats_reset FROM pg_replication_slots r, ++<<<<<<< ours + LATERAL pg_stat_get_replication_slot((r.slot_name)::text) s(slot_name, spill_txns, spill_count, spill_bytes, stream_txns, stream_count, stream_bytes, mem_exceeded_count, total_txns, total_bytes, stats_reset) ++======= + LATERAL pg_stat_get_replication_slot((r.slot_name)::text) s(slot_name, spill_txns, spill_count, spill_bytes, stream_txns, stream_count, stream_bytes, total_txns, total_bytes, slot_sync_skip_count, last_slot_sync_skip, stats_reset) ++>>>>>>> theirs WHERE (r.datoid IS NOT NULL); pg_stat_slru| SELECT name, blks_zeroed,