v3-0003-Disable-slot-sync-during-the-convertion.patch
application/octet-stream
Filename: v3-0003-Disable-slot-sync-during-the-convertion.patch
Type: application/octet-stream
Part: 1
Message:
Re: speed up a logical replica setup
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v3-0003
Subject: Disable slot sync during the convertion
| File | + | − |
|---|---|---|
| src/bin/pg_basebackup/pg_createsubscriber.c | 13 | 0 |
From 1ea33b061d692b2b890e983104b4afd304200704 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Thu, 9 May 2024 02:20:40 +0000
Subject: [PATCH v3 3/5] Disable slot sync during the convertion
---
src/bin/pg_basebackup/pg_createsubscriber.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 72322babd3..71ce16113c 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -1349,6 +1349,19 @@ start_standby_server(const struct CreateSubscriberOptions *opt, bool restricted_
if (opt->config_file != NULL)
appendPQExpBuffer(pg_ctl_cmd, " -o \"-c config_file=%s\"",
opt->config_file);
+
+ /*
+ * We set up some recovery parameters in the middle part of the
+ * pg_createsubscriber to ensure all changes are caught up. At that time,
+ * primary_conninfo will be set without the dbname attribute. Basically, it
+ * works well, but if the slot sync is enabled, the slot sync worker will
+ * exit with ERROR because the process requires dbname within
+ * primary_conninfo. To avoid the error, we override sync_replication_slots
+ * to off. The synchronization won't happen after the conversion, so it is
+ * acceptable to stop here as well.
+ */
+ appendPQExpBuffer(pg_ctl_cmd, " -o \"-c sync_replication_slots=off\"");
+
pg_log_debug("pg_ctl command is: %s", pg_ctl_cmd->data);
rc = system(pg_ctl_cmd->data);
pg_ctl_status(pg_ctl_cmd->data, rc);
--
2.34.1