1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-01 12:18:01 +03:00

Add slotsync_skip_reason column to pg_replication_slots view.

Introduce a new column, slotsync_skip_reason, in the pg_replication_slots
view. This column records the reason why the last slot synchronization was
skipped. It is primarily relevant for logical replication slots on standby
servers where the 'synced' field is true. The value is NULL when
synchronization succeeds.

Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com
This commit is contained in:
Amit Kapila
2025-11-28 05:21:35 +00:00
parent 9ccc049dfe
commit e68b6adad9
13 changed files with 149 additions and 17 deletions

View File

@@ -1665,7 +1665,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
</para>
<para>
Number of times the slot synchronization is skipped. Slot
synchronization occur only on standby servers and thus this column has
synchronization occurs only on standby servers and thus this column has
no meaning on the primary server.
</para>
</entry>
@@ -1677,7 +1677,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
</para>
<para>
Time at which last slot synchronization was skipped. Slot
synchronization occur only on standby servers and thus this column has
synchronization occurs only on standby servers and thus this column has
no meaning on the primary server.
</para>
</entry>

View File

@@ -3102,6 +3102,49 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>slotsync_skip_reason</structfield><type>text</type>
</para>
<para>
The reason for the last slot synchronization skip. Slot
synchronization occurs only on standby servers and thus this column has
no meaning on the primary server. It is relevant mainly for logical slots
on standby servers whose <structfield>synced</structfield> field is
<literal>true</literal>. It is <literal>NULL</literal> if slot
synchronization is successful.
Possible values are:
<itemizedlist spacing="compact">
<listitem>
<para>
<literal>wal_or_rows_removed</literal> means that the required WALs or
catalog rows have already been removed or are at the risk of removal
from the standby.
</para>
</listitem>
<listitem>
<para>
<literal>wal_not_flushed</literal> means that the standby had not
flushed the WAL corresponding to the position reserved on the failover
slot.
</para>
</listitem>
<listitem>
<para>
<literal>no_consistent_snapshot</literal> means that the standby could
not build a consistent snapshot to decode WALs from
<structfield>restart_lsn</structfield>.
</para>
</listitem>
<listitem>
<para>
<literal>slot_invalidated</literal> means that the synced slot is
invalidated.
</para>
</listitem>
</itemizedlist>
</para></entry>
</row>
</tbody>
</tgroup>
</table>