Re: sequencesync worker race with REFRESH SEQUENCES - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: sequencesync worker race with REFRESH SEQUENCES
Date
Msg-id CAA4eK1+a6FyNW-LEqWAmohM3oC6h6KOrBBSeU+-cfopZQLXs3g@mail.gmail.com
Whole thread
In response to Re: sequencesync worker race with REFRESH SEQUENCES  (vignesh C <vignesh21@gmail.com>)
List pgsql-hackers
On Mon, Jul 13, 2026 at 4:38 PM vignesh C <vignesh21@gmail.com> wrote:
>
> The attached v2 version patch has the changes for the same.
> In addition, it includes a fix for Finding 2
> (default_transaction_read_only) reported by Noah at [1], following the
> approach suggested by Amit at [2].
>

*
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -5809,6 +5809,14 @@ InitializeLogRepWorker(void)
  */
  SetConfigOption("search_path", "", PGC_SUSET, PGC_S_OVERRIDE);

+ /*
+ * Ignore default_transaction_read_only for logical replication workers,
+ * as they need to be able to modify subscriber-side state (e.g. apply
+ * changes, update sequences) regardless of that setting.
+ */
+ SetConfigOption("default_transaction_read_only", "off", PGC_SUSET,
+ PGC_S_OVERRIDE);
+
  ApplyContext = AllocSetContextCreate(TopMemoryContext,
  "ApplyContext",
  ALLOCSET_DEFAULT_SIZES);

As pointed out in my previous email, initially let's make
backpatchable fix by adding this override only for sequencesync worker
in SequenceSyncWorkerMain(). We can discuss in a separate thread to
make this generic for all logical rep workers as a HEAD-only patch.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [Proposal] Adding callback support for custom statistics kinds
Next
From: Jeff Davis
Date:
Subject: Re: Small patch to improve safety of utf8_to_unicode().