Re: Logical Replication of sequences

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, Dilip Kumar <dilipbalaut@gmail.com>, Peter Smith <smithpb2250@gmail.com>, shveta malik <shveta.malik@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Nisha Moond <nisha.moond412@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Euler Taveira <euler@eulerto.com>, Michael Paquier <michael@paquier.xyz>, "Jonathan S. Katz" <jkatz@postgresql.org>
Date: 2025-10-28T12:51:04Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Doc: Add documentation for sequence synchronization.

  2. Remove unused assignment in CREATE PUBLICATION grammar.

  3. Add seq_sync_error_count to subscription statistics.

  4. Fix few issues in commit 5509055d69.

  5. Add sequence synchronization for logical replication.

  6. Add worker type argument to logical replication worker functions.

  7. Introduce "REFRESH SEQUENCES" for subscriptions.

  8. Refactor logical worker synchronization code into a separate file.

  9. Standardize use of REFRESH PUBLICATION in code and messages.

  10. Add "ALL SEQUENCES" support to publications.

  11. Expose sequence page LSN via pg_get_sequence_data.

  12. Resume conflict-relevant data retention automatically.

  13. Post-commit review fixes for 228c370868.

  14. Generate GUC tables from .dat file

On Tue, 28 Oct 2025 at 07:17, Chao Li <li.evan.chao@gmail.com> wrote:
>
>
>
> > On Oct 27, 2025, at 17:11, Chao Li <li.evan.chao@gmail.com> wrote:
> >
> > The changes in 0001 are straightforward, looks good. I haven’t reviewed 0004 yet.
>
> Comments for 0004:
>
> 1 - config.sgml
> ```
> -        In logical replication, this parameter also limits how often a failing
> -        replication apply worker or table synchronization worker will be
> -        respawned.
> +        In logical replication, this parameter also limits how quickly a
> +        failing replication apply worker, table synchronization worker, or
> +        sequence synchronization worker will be respawned.
> ```
>
> * “a failing replication apply worker” sounds a bit redundant, maybe change to “a failed apply worker”
> * “will be respawned” works, but in formal documentation, I think “is respawned” is better

I felt this was documented that way in the HEAD too, I prefer the one in HEAD.

> 2 - logic-replication.sgml
> ```
> -   or <literal>FOR ALL SEQUENCES</literal>.
> +   or <literal>FOR ALL SEQUENCES</literal>. Unlike tables, the current state of
> +   sequences may be synchronized at any time. For more information, refer to
> +   <xref linkend="logical-replication-sequences"/>.
> ```
>
> * “may be” better to be “can be”
> * I think the first sentence can be slightly enhanced as "Unlike tables, the state of a sequence can be synchronized at any time.”
> * “refer to” should be “see” in PG docs. You can see right the next paragraph just uses “see”:
> ```
> <command>TRUNCATE</command>. See <xref linkend="logical-replication-row-filter"/>).
> ```

Modified

> 3 - logic-replication.sgml
> ```
> +   To synchronize sequences from a publisher to a subscriber, first publish
> +   them using <link linkend="sql-createpublication-params-for-all-sequences">
> +   <command>CREATE PUBLICATION ... FOR ALL SEQUENCES</command></link> and then
> +   at the subscriber side:
> ```
>
> “At the subscriber side” is better to be “on the subscriber”. Actually, you also use “on the subscriber” in the following paragraphs.

Modified

> 4 - logic-replication.sgml
> ```
>     During sequence synchronization, the sequence definitions of the publisher
>     and the subscriber are compared. An ERROR is logged listing all differing
>     sequences before the process exits. The apply worker detects this failure
>     and repeatedly respawns the sequence synchronization worker to continue
>     the synchronization process until all differences are resolved. See also
> ```
>
> * “An ERROR” => “An error”. If you search for the current doc, “error” are all in lower case.
> * " the sequence synchronization worker to continue the synchronization process”, the second “synchronization” sounds redundant, maybe enhance to "the sequence synchronization worker to retry"

Modified

> 5 - logic-replication.sgml
> ```
>     During sequence synchronization, if a sequence is dropped on the
>     publisher, the sequence synchronization worker will identify this and
>     remove it from sequence synchronization on the subscriber.
> ```
>
> “Will identify this” => “detects the change”, I think PG docs usually prefer more direct phrasing.

This behavior has been changed now, I have removed it.

These changes are available in the v20251029 version posted at [1].
[1] -  https://www.postgresql.org/message-id/CAHut%2BPtMc1fr6cQvUAnxRE%2Bbuim5m-d9M2dM0YAeEHNkS9KzBw%40mail.gmail.com

Regards,
Vignesh