Re: [PATCH] Support automatic sequence replication - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [PATCH] Support automatic sequence replication
Date
Msg-id CAA4eK1K3S=FaeDS62qoidt=uUaOzRiyzq=DVV1uhV-jcva8KxA@mail.gmail.com
Whole thread
In response to Re: [PATCH] Support automatic sequence replication  (shveta malik <shveta.malik@gmail.com>)
Responses RE: [PATCH] Support automatic sequence replication
List pgsql-hackers
On Thu, Mar 5, 2026 at 9:35 AM shveta malik <shveta.malik@gmail.com> wrote:
>
>
> 3)
> + /* Sleep for the configured interval */
> + (void) WaitLatch(MyLatch,
> + WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
> + sleep_ms,
> + WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE);
>
> I don't think this wait-event is appropriate. Unlike tablesync, we are
> not waiting for any state change here. Shall we add a new one for our
> case? How about WAIT_EVENT_LOGICAL_SEQSYNC_MAIN? Thoughts?
>

+1 for a new wait event. Few other minor comments:

1.
+ * Check if the subscription includes sequences and start a sequencesync
+ * worker if one is not already running. The active sequencesync worker will
+ * handle all pending sequence synchronization. If any sequences remain
+ * unsynchronized after it exits, a new worker can be started in the next
+ * iteration.
  *
- * Start a sequencesync worker if one is not already running. The active
- * sequencesync worker will handle all pending sequence synchronization. If any
- * sequences remain unsynchronized after it exits, a new worker can be started
- * in the next iteration.

Why did this comment change? The earlier one sounds okay to me.

2.
  break;
+
  case COPYSEQ_INSUFFICIENT_PERM:

Why does this patch add additional new lines? We use both styles
(existing and what this patch does) in the code but it seems
unnecessary to change for this patch.

3.
- ProcessSequencesForSync();
+
+ /* Check if sequence worker needs to be started */
+ MaybeLaunchSequenceSyncWorker();

No need for an additional line and a comment here.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Akshay Joshi
Date:
Subject: Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement
Next
From: Laurenz Albe
Date:
Subject: Re: Relstats after VACUUM FULL and CLUSTER