Re: pg_stat_replication docs incomplete for logical replication

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stat_replication docs incomplete for logical replication
Date: 2026-06-16 05:16:08
Message-ID: CAHut+PtyE=7QWhi15Dau8Apy1m0vNojJJoubyfYi5SNFXvHNGg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ashutosh.

+1 to clarify documentation.

Some minor review comments.

======

doc/src/sgml/monitoring.sgml

(27.2.4. pg_stat_replication)

1.
+ <para>
+ For physical replication, the LSN columns in this view describe the
+ positions up to which WAL has been sent, written, flushed, and replayed
+ on the connected standby server. For logical replication,
+ <structfield>sent_lsn</structfield> reflects the LSN up to which the
+ walsender has processed WAL records. Such records may already have been
+ streamed to the subscriber, queued for streaming at transaction commit, or
+ skipped because they were not eligible for logical decoding.
+
+ <structfield>write_lsn</structfield>, <structfield>flush_lsn</structfield>,
+ and <structfield>replay_lsn</structfield> reflect progress reported by the
+ subscriber through replication status messages, and do not necessarily
+ mean that logical changes up to those LSNs have already been
+ received, durably stored, or made visible on the subscriber.
</para>

1a.
I'm not sure of the purpose of that blank line; it doesn't affect the
rendering in HTML.

~

1b.
Consider splitting the text differently so there is 1 paragraph for
"Physical Replication" and 1 paragraph for "Logical Replication". So,
the same content just with different <para> markup.

SUGGESTION
<para>
For physical replication, ...
</para>
<para>
For logical replication, ...
</para>

~~~

2.
<structfield>write_lsn</structfield> <type>pg_lsn</type>
</para>
<para>
- Last write-ahead log location written to disk by this standby
- server
+ For physical replication, the last write-ahead log location written
+ to disk by this standby server. For logical replication, progress
+ reported by the subscriber through replication status messages.
</para></entry>
</row

For that 2nd sentence, do you mean /progress reported/progress is reported/

Or, here is some alternate wording:
For logical replication, progress is reported by replication status
messages received from the subscriber.

~~~

3.
<structfield>flush_lsn</structfield> <type>pg_lsn</type>
</para>
<para>
- Last write-ahead log location flushed to disk by this standby
- server
+ For physical replication, the last write-ahead log location flushed
+ to disk by this standby server. For logical replication, progress
+ reported by the subscriber through replication status messages.
</para></entry>
</row>

Ditto review comment #2

~~~

4.
<structfield>replay_lsn</structfield> <type>pg_lsn</type>
</para>
<para>
- Last write-ahead log location replayed into the database on this
- standby server
+ For physical replication, the last write-ahead log location replayed
+ into the database on this standby server. For logical replication,
+ progress reported by the subscriber through replication status
+ messages.
</para></entry>

Ditto review comment #2

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-06-16 05:29:35 Re: Fix race in ReplicationSlotRelease for ephemeral slots
Previous Message Michael Paquier 2026-06-16 05:02:24 Re: [PATCH] pg_restore_extended_stats() can store an MCV list that cannot be read back