=== Applying patches on top of PostgreSQL commit ID 417ac9c1eeebc5dd8186a9089055b8af43b2450e === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Tue Nov 25 19:59:21 UTC 2025 On branch cf/5877 nothing to commit, working tree clean === using 'git am' to apply patch ./0001-Report-output-plugin-statistics-in-pg_stat_-20251103.patch === Applying: Report output plugin statistics in pg_stat_replication_slots Using index info to reconstruct a base tree... M contrib/test_decoding/expected/stats.out M doc/src/sgml/logicaldecoding.sgml M doc/src/sgml/monitoring.sgml M src/backend/catalog/system_views.sql M src/backend/replication/logical/logical.c M src/backend/replication/logical/logicalfuncs.c M src/backend/replication/logical/reorderbuffer.c M src/backend/replication/walsender.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/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 CONFLICT (content): Merge conflict in 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/replication/walsender.c Auto-merging src/backend/replication/logical/reorderbuffer.c Auto-merging src/backend/replication/logical/logicalfuncs.c Auto-merging src/backend/replication/logical/logical.c Auto-merging src/backend/catalog/system_views.sql CONFLICT (content): Merge conflict in src/backend/catalog/system_views.sql Auto-merging doc/src/sgml/monitoring.sgml CONFLICT (content): Merge conflict in doc/src/sgml/monitoring.sgml Auto-merging doc/src/sgml/logicaldecoding.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 Report output plugin statistics in pg_stat_replication_slots 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 contrib/test_decoding/sql/stats.sql M contrib/test_decoding/t/001_repl_stats.pl M contrib/test_decoding/test_decoding.c M doc/src/sgml/logicaldecoding.sgml M doc/src/sgml/monitoring.sgml M src/backend/catalog/system_views.sql M src/backend/replication/logical/logical.c M src/backend/replication/logical/logicalfuncs.c M src/backend/replication/logical/reorderbuffer.c M src/backend/replication/pgoutput/pgoutput.c M src/backend/replication/walsender.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/logical.h M src/include/replication/output_plugin.h M src/include/replication/reorderbuffer.h M src/test/recovery/t/006_logical_decoding.pl M src/test/recovery/t/035_standby_logical_decoding.pl M src/test/regress/expected/rules.out M src/test/subscription/t/001_rep_changes.pl M src/test/subscription/t/010_truncate.pl M src/test/subscription/t/028_row_filter.pl M src/tools/pgindent/typedefs.list === using patch(1) to apply patch ./0001-Report-output-plugin-statistics-in-pg_stat_-20251103.patch === patching file contrib/test_decoding/expected/stats.out Hunk #3 FAILED at 73. 1 out of 4 hunks FAILED -- saving rejects to file contrib/test_decoding/expected/stats.out.rej patching file contrib/test_decoding/sql/stats.sql patching file contrib/test_decoding/t/001_repl_stats.pl patching file contrib/test_decoding/test_decoding.c patching file doc/src/sgml/logicaldecoding.sgml patching file doc/src/sgml/monitoring.sgml Hunk #3 succeeded at 1694 (offset 24 lines). patching file src/backend/catalog/system_views.sql Hunk #2 FAILED at 1075. 1 out of 2 hunks FAILED -- saving rejects to file src/backend/catalog/system_views.sql.rej patching file src/backend/replication/logical/logical.c patching file src/backend/replication/logical/logicalfuncs.c patching file src/backend/replication/logical/reorderbuffer.c patching file src/backend/replication/pgoutput/pgoutput.c patching file src/backend/replication/walsender.c patching file src/backend/utils/activity/pgstat_replslot.c patching file src/backend/utils/adt/pgstatfuncs.c Hunk #1 FAILED at 2129. Hunk #2 FAILED at 2156. Hunk #3 FAILED at 2184. 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 5691. 1 out of 1 hunk FAILED -- saving rejects to file src/include/catalog/pg_proc.dat.rej patching file src/include/pgstat.h Hunk #1 FAILED at 396. 1 out of 1 hunk FAILED -- saving rejects to file src/include/pgstat.h.rej patching file src/include/replication/logical.h patching file src/include/replication/output_plugin.h patching file src/include/replication/reorderbuffer.h patching file src/test/recovery/t/006_logical_decoding.pl patching file src/test/recovery/t/035_standby_logical_decoding.pl patching file src/test/regress/expected/rules.out Hunk #2 FAILED at 2150. 1 out of 2 hunks FAILED -- saving rejects to file src/test/regress/expected/rules.out.rej patching file src/test/subscription/t/001_rep_changes.pl patching file src/test/subscription/t/010_truncate.pl patching file src/test/subscription/t/028_row_filter.pl patching file src/tools/pgindent/typedefs.list Hunk #1 succeeded at 1838 (offset 5 lines). Unstaged changes after reset: M contrib/test_decoding/expected/stats.out M contrib/test_decoding/sql/stats.sql M contrib/test_decoding/t/001_repl_stats.pl M contrib/test_decoding/test_decoding.c M doc/src/sgml/logicaldecoding.sgml M doc/src/sgml/monitoring.sgml M src/backend/catalog/system_views.sql M src/backend/replication/logical/logical.c M src/backend/replication/logical/logicalfuncs.c M src/backend/replication/logical/reorderbuffer.c M src/backend/replication/pgoutput/pgoutput.c M src/backend/replication/walsender.c M src/backend/utils/activity/pgstat_replslot.c M src/include/replication/logical.h M src/include/replication/output_plugin.h M src/include/replication/reorderbuffer.h M src/test/recovery/t/006_logical_decoding.pl M src/test/recovery/t/035_standby_logical_decoding.pl M src/test/regress/expected/rules.out M src/test/subscription/t/001_rep_changes.pl M src/test/subscription/t/010_truncate.pl M src/test/subscription/t/028_row_filter.pl M src/tools/pgindent/typedefs.list Removing contrib/test_decoding/expected/stats.out.rej Removing src/backend/catalog/system_views.sql.rej Removing src/backend/utils/adt/pgstatfuncs.c.rej Removing src/include/catalog/pg_proc.dat.rej Removing src/include/pgstat.h.rej Removing src/test/regress/expected/rules.out.rej === using 'git apply' to apply patch ./0001-Report-output-plugin-statistics-in-pg_stat_-20251103.patch === Applied patch to 'contrib/test_decoding/expected/stats.out' with conflicts. Applied patch to 'contrib/test_decoding/sql/stats.sql' cleanly. Applied patch to 'contrib/test_decoding/t/001_repl_stats.pl' cleanly. Applied patch to 'contrib/test_decoding/test_decoding.c' cleanly. Applied patch to 'doc/src/sgml/logicaldecoding.sgml' cleanly. Applied patch to 'doc/src/sgml/monitoring.sgml' with conflicts. Applied patch to 'src/backend/catalog/system_views.sql' with conflicts. Applied patch to 'src/backend/replication/logical/logical.c' cleanly. Applied patch to 'src/backend/replication/logical/logicalfuncs.c' cleanly. Applied patch to 'src/backend/replication/logical/reorderbuffer.c' cleanly. Applied patch to 'src/backend/replication/pgoutput/pgoutput.c' cleanly. Applied patch to 'src/backend/replication/walsender.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' with conflicts. Applied patch to 'src/include/replication/logical.h' cleanly. Applied patch to 'src/include/replication/output_plugin.h' cleanly. Applied patch to 'src/include/replication/reorderbuffer.h' cleanly. Applied patch to 'src/test/recovery/t/006_logical_decoding.pl' cleanly. Applied patch to 'src/test/recovery/t/035_standby_logical_decoding.pl' cleanly. Applied patch to 'src/test/regress/expected/rules.out' with conflicts. Applied patch to 'src/test/subscription/t/001_rep_changes.pl' cleanly. Applied patch to 'src/test/subscription/t/010_truncate.pl' cleanly. Applied patch to 'src/test/subscription/t/028_row_filter.pl' cleanly. Applied patch to 'src/tools/pgindent/typedefs.list' cleanly. U contrib/test_decoding/expected/stats.out U doc/src/sgml/monitoring.sgml U src/backend/catalog/system_views.sql U src/backend/utils/adt/pgstatfuncs.c U src/include/catalog/pg_proc.dat U src/include/pgstat.h U src/test/regress/expected/rules.out diff --cc contrib/test_decoding/expected/stats.out index e5117f88a14,0e5c5fa5b18..00000000000 --- a/contrib/test_decoding/expected/stats.out +++ b/contrib/test_decoding/expected/stats.out @@@ -78,17 -83,17 +83,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 | slotsync_skip_count | slotsync_skip_at | stats_reset +--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+------------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ++======= + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | mem_exceeded_count | total_wal_txns | total_wal_bytes | plugin_filtered_bytes | plugin_sent_txns | plugin_sent_bytes | 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 | slotsync_skip_count | slotsync_skip_at | stats_reset +--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+------------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ++======= + slot_name | spill_txns | spill_count | spill_bytes | stream_txns | stream_count | stream_bytes | mem_exceeded_count | total_wal_txns | total_wal_bytes | plugin_filtered_bytes | plugin_sent_txns | plugin_sent_bytes | stats_reset + --------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+----------------+-----------------+-----------------------+------------------+-------------------+------------- + do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | | | ++>>>>>>> theirs (1 row) -- spilling the xact diff --cc doc/src/sgml/monitoring.sgml index dcc8474a7f7,7f30094b228..00000000000 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@@ -1661,24 -1672,47 +1672,67 @@@ description | Waiting for a newly initi ++<<<<<<< ours + slotsync_skip_countbigint + + + Number of times the slot synchronization is skipped. Slot + synchronization occur only on standby servers and thus this column has + no meaning on the primary server. + + ++======= + plugin_filtered_bytes bigint + + + Amount of changes, from total_wal_bytes, filtered + out by the output plugin and not sent downstream. Please note that it + does not include the changes filtered before a change is sent to + the output plugin, e.g. the changes filtered by origin. The counter is + maintained by the output plugin mentioned in + plugin. It is NULL when statistics is not + initialized or immediately after a reset or when not maintained by the + output plugin. + + plugin_sent_txns bigint + + + Number of decoded transactions sent downstream for this slot. This + counts top-level transactions only, and is not incremented for + subtransactions. These transactions are subset of transactions sent to + the decoding plugin. Hence this count is expected to be less than or + equal to total_wal_txns. The counter is maintained + by the output plugin mentioned in plugin. It + is NULL when statistics is not initialized or immediately after a reset or + when not maintained by the output plugin. + ++>>>>>>> theirs + + + + ++<<<<<<< ours + slotsync_skip_attimestamp with time zone + + + Time at which last slot synchronization was skipped. Slot + synchronization occur only on standby servers and thus this column has + no meaning on the primary server. ++======= + plugin_sent_bytesbigint + + + Amount of transaction changes sent downstream for this slot by the + output plugin after applying filtering and converting into its output + format. The counter is maintained by the output plugin mentioned in + plugin. It is NULL when statistics is not + initialized or immediately after a reset or when not maintained by the + output plugin. ++>>>>>>> theirs diff --cc src/backend/catalog/system_views.sql index 6fffdb9398e,defca1cf9ac..00000000000 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@@ -1074,10 -1075,11 +1075,18 @@@ CREATE VIEW pg_stat_replication_slots A s.stream_count, s.stream_bytes, s.mem_exceeded_count, ++<<<<<<< ours + s.total_txns, + s.total_bytes, + s.slotsync_skip_count, + s.slotsync_skip_at, ++======= + s.total_wal_txns, + s.total_wal_bytes, + s.plugin_filtered_bytes, + s.plugin_sent_txns, + s.plugin_sent_bytes, ++>>>>>>> theirs s.stats_reset FROM pg_replication_slots as r, LATERAL pg_stat_get_replication_slot(slot_name) as s diff --cc src/backend/utils/adt/pgstatfuncs.c index 7e2ed69138a,672b01a246d..00000000000 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@@ -2129,7 -2129,7 +2129,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 13 ++======= + #define PG_STAT_GET_REPLICATION_SLOT_COLS 14 ++>>>>>>> theirs text *slotname_text = PG_GETARG_TEXT_P(0); NameData slotname; TupleDesc tupdesc; @@@ -2156,15 -2156,17 +2160,25 @@@ INT8OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 8, "mem_exceeded_count", INT8OID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 9, "total_txns", + TupleDescInitEntry(tupdesc, (AttrNumber) 9, "total_wal_txns", INT8OID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 10, "total_bytes", + TupleDescInitEntry(tupdesc, (AttrNumber) 10, "total_wal_bytes", INT8OID, -1, 0); ++<<<<<<< ours + TupleDescInitEntry(tupdesc, (AttrNumber) 11, "slotsync_skip_count", + INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 12, "slotsync_skip_at", + TIMESTAMPTZOID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 13, "stats_reset", ++======= + TupleDescInitEntry(tupdesc, (AttrNumber) 11, "plugin_filtered_bytes", + INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 12, "plugin_sent_txns", + INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 13, "plugin_sent_bytes", + INT8OID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 14, "stats_reset", ++>>>>>>> theirs TIMESTAMPTZOID, -1, 0); BlessTupleDesc(tupdesc); @@@ -2188,19 -2190,25 +2202,41 @@@ values[5] = Int64GetDatum(slotent->stream_count); values[6] = Int64GetDatum(slotent->stream_bytes); values[7] = Int64GetDatum(slotent->mem_exceeded_count); ++<<<<<<< ours + values[8] = Int64GetDatum(slotent->total_txns); + values[9] = Int64GetDatum(slotent->total_bytes); + values[10] = Int64GetDatum(slotent->slotsync_skip_count); + + if (slotent->slotsync_skip_at == 0) + nulls[11] = true; + else + values[11] = TimestampTzGetDatum(slotent->slotsync_skip_at); + + if (slotent->stat_reset_timestamp == 0) + nulls[12] = true; + else + values[12] = TimestampTzGetDatum(slotent->stat_reset_timestamp); ++======= + values[8] = Int64GetDatum(slotent->total_wal_txns); + values[9] = Int64GetDatum(slotent->total_wal_bytes); + if (slotent->plugin_has_stats) + { + values[10] = Int64GetDatum(slotent->plugin_filtered_bytes); + values[11] = Int64GetDatum(slotent->plugin_sent_txns); + values[12] = Int64GetDatum(slotent->plugin_sent_bytes); + } + else + { + nulls[10] = true; + nulls[11] = true; + nulls[12] = true; + } + + if (slotent->stat_reset_timestamp == 0) + nulls[13] = true; + else + values[13] = 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 66431940700,e78d4f0ab1e..00000000000 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@@ -5691,9 -5691,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,int8,timestamptz,timestamptz}', + proargmodes => '{i,o,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,mem_exceeded_count,total_txns,total_bytes,slotsync_skip_count,slotsync_skip_at,stats_reset}', ++======= + proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}', + proargmodes => '{i,o,o,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,mem_exceeded_count,total_wal_txns,total_wal_bytes,plugin_filtered_bytes,plugin_sent_txns,plugin_sent_bytes,stats_reset}', ++>>>>>>> theirs prosrc => 'pg_stat_get_replication_slot' }, { oid => '6230', descr => 'statistics: check if a stats object exists', diff --cc src/include/pgstat.h index ad85134f27a,427cf55d4b6..00000000000 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@@ -398,10 -396,12 +398,19 @@@ typedef struct PgStat_StatReplSlotEntr PgStat_Counter stream_count; PgStat_Counter stream_bytes; PgStat_Counter mem_exceeded_count; ++<<<<<<< ours + PgStat_Counter total_txns; + PgStat_Counter total_bytes; + PgStat_Counter slotsync_skip_count; + TimestampTz slotsync_skip_at; ++======= + PgStat_Counter total_wal_txns; + PgStat_Counter total_wal_bytes; + bool plugin_has_stats; + PgStat_Counter plugin_sent_txns; + PgStat_Counter plugin_sent_bytes; + PgStat_Counter plugin_filtered_bytes; ++>>>>>>> theirs TimestampTz stat_reset_timestamp; } PgStat_StatReplSlotEntry; diff --cc src/test/regress/expected/rules.out index c337f0bc30d,4bc5668f0fd..00000000000 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@@ -2149,13 -2150,14 +2150,24 @@@ pg_stat_replication_slots| SELECT s.slo s.stream_count, s.stream_bytes, s.mem_exceeded_count, ++<<<<<<< ours + s.total_txns, + s.total_bytes, + s.slotsync_skip_count, + s.slotsync_skip_at, + s.stats_reset + FROM pg_replication_slots r, + 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, slotsync_skip_count, slotsync_skip_at, stats_reset) ++======= + s.total_wal_txns, + s.total_wal_bytes, + s.plugin_filtered_bytes, + s.plugin_sent_txns, + s.plugin_sent_bytes, + s.stats_reset + FROM pg_replication_slots r, + 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_wal_txns, total_wal_bytes, plugin_filtered_bytes, plugin_sent_txns, plugin_sent_bytes, stats_reset) ++>>>>>>> theirs WHERE (r.datoid IS NOT NULL); pg_stat_slru| SELECT name, blks_zeroed,