diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index d0fdcde..bc2aacc 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -1571,49 +1571,88 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
- Sequences
+ Replicating Sequences
- Sequences can be synchronized between a publisher and a subscriber using
- CREATE SUBSCRIPTION
- to initially synchronize sequences,
- ALTER SUBSCRIPTION ... REFRESH PUBLICATION to
- synchronize any newly added sequences and
- ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
- to re-synchronize all sequences. A new sequence synchronization worker will
- be started to synchronize the sequences after executing the above commands
- and will exit once the sequences are synchronized.
+ To replicate sequences from a publisher to a subscriber, first publish the
+ sequence using
+ CREATE PUBLICATION ... FOR ALL SEQUENCES.
- Sequence synchronization worker will be used from
-
+ At the subscriber side:
+
+
+
+ use CREATE SUBSCRIPTION
+ to initially synchronize the published sequences.
+
+
+
+
+ use
+ ALTER SUBSCRIPTION ... REFRESH PUBLICATION
+ to synchronize any newly added sequences.
+
+
+
+
+ use
+ ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
+ to re-synchronize all sequences.
+
+
+
+
+
+
+ A new sequence synchronization worker will be started to synchronize the
+ sequences after executing any of the above subscriber commands, and will
+ will exit once the sequences are synchronized.
+
+
+ The ability to launch a sequence synchronization worker will be limited by
+ the
max_sync_workers_per_subscription
configuration.
-
- Differences in Sequence Definitions Between Publisher and Subscriber
+
+ Sequence Definition Mismatches
+
+
+ If there are differences in sequence definitions between the publisher and
+ subscriber, a WARNING is logged.
+
+
- If there are differences in sequence definitions between the publisher and
- subscriber, a WARNING is logged. To resolve this, use
+ To resolve this, use
ALTER SEQUENCE
to align the subscriber's sequence parameters with those of the publisher.
Subsequently, execute
ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES.
- It is advisable not to change sequence definitions on either the publisher
- or the subscriber until synchronization is complete and the
+
+
+ Changes to sequence definitions during the execution of
+
+ ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
+ may not be detected, potentially leading to inconsistent values. To avoid
+ this, refrain from modifying sequence definitions on both publisher and
+ subscriber until synchronization is complete and the
pg_subscription_rel.srsubstate
reaches r (ready) state.
-
+
- Handling Sequences Out of Sync Between Publisher and Subscriber
+ Refreshing Stale Sequences
- Sequence values may frequently become out of sync due to updates on the
- publisher. To verify this, compare the sequences values between the
- publisher and subscriber and execute
+ Subscriber side sequence values may frequently become out of sync due to
+ updates on the publisher.
+
+
+ To verify this, compare the sequences values between the publisher and
+ subscriber and execute
ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
if required.
@@ -1621,7 +1660,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
- Examples: Synchronizing Sequences Between Publisher and Subscriber
+ Examples
Create some test sequences on the publisher.
@@ -1642,7 +1681,7 @@ CREATE SEQUENCE
- Update the sequences at the publisher side few times.
+ Update the sequences at the publisher side few times.
test_pub=# SELECT nextval('s1');
nextval
@@ -1667,14 +1706,14 @@ test_pub=# SELECT nextval('s2');
- Create publications for the sequences.
+ Create a publication for the sequences.
test_pub=# CREATE PUBLICATION pub1 FOR ALL SEQUENCES;
CREATE PUBLICATION
- Create subscriptions for the publications.
+ Subscribe to the publication.
test_sub=# CREATE SUBSCRIPTION sub1
test_sub-# CONNECTION 'host=localhost dbname=test_pub application_name=sub1'
@@ -1683,7 +1722,7 @@ CREATE SUBSCRIPTION
- Observe that initial sequence value is synchronized.
+ Observe that initial sequence values are synchronized.
test_sub=# SELECT * FROM s1;
last_value | log_cnt | is_called
@@ -1699,7 +1738,7 @@ test_sub=# SELECT * FROM s2;
- Update the sequneces at the publisher side.
+ Update the sequences at the publisher side.
test_pub=# SELECT nextval('s1');
nextval
@@ -1714,7 +1753,9 @@ test_pub=# SELECT nextval('s2');
- Re-synchronize all the sequences at the subscriber using ALTER SUBSCRIPTION REFRESH PUBLCIATIN SEQUENCES:
+ Re-synchronize all the sequences at the subscriber side using
+
+ ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES.
test_sub=# ALTER SUBSCRIPTION sub1 REFRESH PUBLICATION SEQUENCES;
ALTER SUBSCRIPTION
@@ -1733,35 +1774,6 @@ test_sub=# SELECT * FROM s2
-
- Caveats
-
-
- At this writing, there are couple of limitations of the sequence
- replication. These will probably be fixed in future releases:
-
-
-
-
- Changes to sequence definitions during the execution of
-
- ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
- may not be detected, potentially leading to inconsistent values. To avoid
- this, refrain from modifying sequence definitions on both publisher and
- subscriber until synchronization is complete and the
- pg_subscription_rel.srsubstate
- reaches r (ready) state.
-
-
-
-
-
- Incremental synchronization of sequences is not supported.
-
-
-
-
-
@@ -1871,7 +1883,7 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
- Incremental sequence changes is not replicated. The data in serial or
+ Incremental sequence changes are not replicated. The data in serial or
identity columns backed by sequences will of course be replicated as part
of the table, but the sequence itself would still show the start value on
the subscriber. If the subscriber is used as a read-only database, then
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index 7d1399b..457a614 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -200,7 +200,7 @@ ALTER SUBSCRIPTION name RENAME TO <
ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES
- See for recommendations on how
+ See for recommendations on how
to handle any warnings about differences in the sequence definition
between the publisher and the subscriber, which might occur when
copy_data = true.
@@ -234,14 +234,14 @@ ALTER SUBSCRIPTION name RENAME TO <
will re-synchronize the sequence data for all subscribed sequences.
- See for recommendations on how
- to identify sequences and handle out of sync sequences.
-
-
- See for
+ See for
recommendations on how to handle any warnings about differences in the
sequence definition between the publisher and the subscriber.
+
+ See for recommendations on how
+ to identify sequences and handle out-of-sync sequences.
+
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index d39976c..1b1c999 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -264,7 +264,7 @@ CREATE SUBSCRIPTION subscription_nameorigin parameter.
- See
+ See
for recommendations on how to handle any warnings about differences in
the sequence definition between the publisher and the subscriber,
which might occur when copy_data = true.