mirror of
https://github.com/postgres/postgres.git
synced 2025-12-09 00:03:13 -05:00
Rename column slotsync_skip_at to slotsync_last_skip.
Commit 76b78721ca introduced two new columns in pg_stat_replication_slots to improve monitoring of slot synchronization. One of these columns was named slotsync_skip_at, which is inconsistent with the naming convention used for similar columns in other system views. Columns that store timestamps of the most recent event typically use the 'last_' in the column name (e.g., last_autovacuum, checksum_last_failure). Renaming slotsync_skip_at to slotsync_last_skip aligns with this pattern, making the purpose of the column clearer and improving overall consistency across the views. Author: Shlok Kyal <shlok.kyal.oss@gmail.com> Reviewed-by: Michael Banck <mbanck@gmx.net> Discussion: https://postgr.es/m/20251128091552.GB13635@p46.dedyn.io;lightning.p46.dedyn.io Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com
This commit is contained in:
parent
7bc88c3d6f
commit
5db6a344ab
@ -78,17 +78,17 @@ SELECT slot_name, spill_txns = 0 AS spill_txns, spill_count = 0 AS spill_count,
|
|||||||
|
|
||||||
-- verify accessing/resetting stats for non-existent slot does something reasonable
|
-- verify accessing/resetting stats for non-existent slot does something reasonable
|
||||||
SELECT * FROM pg_stat_get_replication_slot('do-not-exist');
|
SELECT * FROM pg_stat_get_replication_slot('do-not-exist');
|
||||||
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
|
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_last_skip | stats_reset
|
||||||
--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+------------------+-------------
|
--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+--------------------+-------------
|
||||||
do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
|
do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_stat_reset_replication_slot('do-not-exist');
|
SELECT pg_stat_reset_replication_slot('do-not-exist');
|
||||||
ERROR: replication slot "do-not-exist" does not exist
|
ERROR: replication slot "do-not-exist" does not exist
|
||||||
SELECT * FROM pg_stat_get_replication_slot('do-not-exist');
|
SELECT * FROM pg_stat_get_replication_slot('do-not-exist');
|
||||||
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
|
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_last_skip | stats_reset
|
||||||
--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+------------------+-------------
|
--------------+------------+-------------+-------------+-------------+--------------+--------------+--------------------+------------+-------------+---------------------+--------------------+-------------
|
||||||
do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
|
do-not-exist | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- spilling the xact
|
-- spilling the xact
|
||||||
|
|||||||
@ -1671,7 +1671,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
|
|||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry role="catalog_table_entry"><para role="column_definition">
|
<entry role="catalog_table_entry"><para role="column_definition">
|
||||||
<structfield>slotsync_skip_at</structfield><type>timestamp with time zone</type>
|
<structfield>slotsync_last_skip</structfield><type>timestamp with time zone</type>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Time at which last slot synchronization was skipped. Slot
|
Time at which last slot synchronization was skipped. Slot
|
||||||
|
|||||||
@ -1078,7 +1078,7 @@ CREATE VIEW pg_stat_replication_slots AS
|
|||||||
s.total_txns,
|
s.total_txns,
|
||||||
s.total_bytes,
|
s.total_bytes,
|
||||||
s.slotsync_skip_count,
|
s.slotsync_skip_count,
|
||||||
s.slotsync_skip_at,
|
s.slotsync_last_skip,
|
||||||
s.stats_reset
|
s.stats_reset
|
||||||
FROM pg_replication_slots as r,
|
FROM pg_replication_slots as r,
|
||||||
LATERAL pg_stat_get_replication_slot(slot_name) as s
|
LATERAL pg_stat_get_replication_slot(slot_name) as s
|
||||||
|
|||||||
@ -127,7 +127,7 @@ pgstat_report_replslotsync(ReplicationSlot *slot)
|
|||||||
statent = &shstatent->stats;
|
statent = &shstatent->stats;
|
||||||
|
|
||||||
statent->slotsync_skip_count += 1;
|
statent->slotsync_skip_count += 1;
|
||||||
statent->slotsync_skip_at = GetCurrentTimestamp();
|
statent->slotsync_last_skip = GetCurrentTimestamp();
|
||||||
|
|
||||||
pgstat_unlock_entry(entry_ref);
|
pgstat_unlock_entry(entry_ref);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2162,7 +2162,7 @@ pg_stat_get_replication_slot(PG_FUNCTION_ARGS)
|
|||||||
INT8OID, -1, 0);
|
INT8OID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "slotsync_skip_count",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "slotsync_skip_count",
|
||||||
INT8OID, -1, 0);
|
INT8OID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 12, "slotsync_skip_at",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 12, "slotsync_last_skip",
|
||||||
TIMESTAMPTZOID, -1, 0);
|
TIMESTAMPTZOID, -1, 0);
|
||||||
TupleDescInitEntry(tupdesc, (AttrNumber) 13, "stats_reset",
|
TupleDescInitEntry(tupdesc, (AttrNumber) 13, "stats_reset",
|
||||||
TIMESTAMPTZOID, -1, 0);
|
TIMESTAMPTZOID, -1, 0);
|
||||||
@ -2192,10 +2192,10 @@ pg_stat_get_replication_slot(PG_FUNCTION_ARGS)
|
|||||||
values[9] = Int64GetDatum(slotent->total_bytes);
|
values[9] = Int64GetDatum(slotent->total_bytes);
|
||||||
values[10] = Int64GetDatum(slotent->slotsync_skip_count);
|
values[10] = Int64GetDatum(slotent->slotsync_skip_count);
|
||||||
|
|
||||||
if (slotent->slotsync_skip_at == 0)
|
if (slotent->slotsync_last_skip == 0)
|
||||||
nulls[11] = true;
|
nulls[11] = true;
|
||||||
else
|
else
|
||||||
values[11] = TimestampTzGetDatum(slotent->slotsync_skip_at);
|
values[11] = TimestampTzGetDatum(slotent->slotsync_last_skip);
|
||||||
|
|
||||||
if (slotent->stat_reset_timestamp == 0)
|
if (slotent->stat_reset_timestamp == 0)
|
||||||
nulls[12] = true;
|
nulls[12] = true;
|
||||||
|
|||||||
@ -57,6 +57,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 202511281
|
#define CATALOG_VERSION_NO 202512051
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -5693,7 +5693,7 @@
|
|||||||
proparallel => 'r', prorettype => 'record', proargtypes => 'text',
|
proparallel => 'r', prorettype => 'record', proargtypes => 'text',
|
||||||
proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz,timestamptz}',
|
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}',
|
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}',
|
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_last_skip,stats_reset}',
|
||||||
prosrc => 'pg_stat_get_replication_slot' },
|
prosrc => 'pg_stat_get_replication_slot' },
|
||||||
|
|
||||||
{ oid => '6230', descr => 'statistics: check if a stats object exists',
|
{ oid => '6230', descr => 'statistics: check if a stats object exists',
|
||||||
|
|||||||
@ -401,7 +401,7 @@ typedef struct PgStat_StatReplSlotEntry
|
|||||||
PgStat_Counter total_txns;
|
PgStat_Counter total_txns;
|
||||||
PgStat_Counter total_bytes;
|
PgStat_Counter total_bytes;
|
||||||
PgStat_Counter slotsync_skip_count;
|
PgStat_Counter slotsync_skip_count;
|
||||||
TimestampTz slotsync_skip_at;
|
TimestampTz slotsync_last_skip;
|
||||||
TimestampTz stat_reset_timestamp;
|
TimestampTz stat_reset_timestamp;
|
||||||
} PgStat_StatReplSlotEntry;
|
} PgStat_StatReplSlotEntry;
|
||||||
|
|
||||||
|
|||||||
@ -2153,10 +2153,10 @@ pg_stat_replication_slots| SELECT s.slot_name,
|
|||||||
s.total_txns,
|
s.total_txns,
|
||||||
s.total_bytes,
|
s.total_bytes,
|
||||||
s.slotsync_skip_count,
|
s.slotsync_skip_count,
|
||||||
s.slotsync_skip_at,
|
s.slotsync_last_skip,
|
||||||
s.stats_reset
|
s.stats_reset
|
||||||
FROM pg_replication_slots r,
|
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)
|
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_last_skip, stats_reset)
|
||||||
WHERE (r.datoid IS NOT NULL);
|
WHERE (r.datoid IS NOT NULL);
|
||||||
pg_stat_slru| SELECT name,
|
pg_stat_slru| SELECT name,
|
||||||
blks_zeroed,
|
blks_zeroed,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user