Re: Logical Replication of sequences - Mailing list pgsql-hackers

From shveta malik
Subject Re: Logical Replication of sequences
Date
Msg-id CAJpy0uCF1YpQdZpyx-kqt9FjgugFR2=BEbPUx7ga8eRQrGp_BA@mail.gmail.com
Whole thread Raw
In response to Re: Logical Replication of sequences  (vignesh C <vignesh21@gmail.com>)
Responses Re: Logical Replication of sequences
List pgsql-hackers
On Fri, Nov 7, 2025 at 10:58 AM vignesh C <vignesh21@gmail.com> wrote:
>
>
> Thanks for pushing the patch, here is a rebased version of the
> remaining patches.
>

Please find a few comments on doc patch:

1)
+    them. To verify this, compare the
+    <link linkend="catalog-pg-subscription-rel">pg_subscription_rel</link>.<structfield>srsublsn</structfield>
+    on the subscriber with the page_lsn obtained from the
+    <function>pg_get_sequence_data</function> for the sequence on the
publisher.

Is there a way to give link of 'pg_get_sequence_data' here?

2)
+   <warning>
+    <para>
+     Each sequence caches a block of values (typically 32) in memory before
+     generating a new WAL record, so its LSN advances only after the entire
+     cached batch has been consumed. As a result, sequence value
drift cannot be
+     detected by comparing LSNs for sequence increments that fall within the
+     same cached block.
+    </para>
+   </warning>

In such a case, shall we mention that compare last_value to see the
drift? Thoughts?

3)

+    To detect this, compare the
+    <link linkend="catalog-pg-subscription-rel">pg_subscription_rel</link>.<structfield>srsublsn</structfield>
+    on the subscriber with the page_lsn obtained from the
+    <function>pg_get_sequence_data</function> for the sequence on the
publisher.


We have mentioned above. But in the example of the same, we do not
show srsublsn or page_lsn anywhere. Shall we query and show that as
well?


4)
         Maximum number of synchronization workers per subscription. This
         parameter controls the amount of parallelism of the initial data copy
         during the subscription initialization or when new tables are added.
+        One additional worker is also needed for sequence synchronization.
        </para>

Since now the first line is talking only about table-sync, shall we tweak it:
'of the initial data copy' --> 'of the initial data copy for tables'

5)
+        Returns information about the sequence. <literal>last_value</literal>
+        indicates last sequence value set in sequence by nextval or setval,

last_value can also be set by seq synchronization. Do you think that
we need to mention that or current info is good enough?

thanks
Shveta



pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: XMLSerialize: version and explicit XML declaration
Next
From: Fujii Masao
Date:
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench