v8-0003-Fix-publication-does-not-exist-error.patch

application/octet-stream

Filename: v8-0003-Fix-publication-does-not-exist-error.patch
Type: application/octet-stream
Part: 2
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 v8-0003
Subject: Fix publication does not exist error.
File+
src/bin/pg_basebackup/pg_subscriber.c 3 20
From 9f538ed90a02fb13404ff0df4884d1e809a13f1c Mon Sep 17 00:00:00 2001
From: Shlok Kyal <shlok.kyal.oss@gmail.com>
Date: Mon, 22 Jan 2024 12:36:20 +0530
Subject: [PATCH v8 3/4] Fix publication does not exist error.

Fix publication does not exist error.
---
 src/bin/pg_basebackup/pg_subscriber.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/bin/pg_basebackup/pg_subscriber.c b/src/bin/pg_basebackup/pg_subscriber.c
index 3880d15ef9..355738c20c 100644
--- a/src/bin/pg_basebackup/pg_subscriber.c
+++ b/src/bin/pg_basebackup/pg_subscriber.c
@@ -679,6 +679,9 @@ create_all_logical_replication_slots(PrimaryInfo *primary,
 		if (create_logical_replication_slot(conn, false, perdb) == NULL && !dry_run)
 			return false;
 
+		/* Also create a publication */
+		create_publication(conn, primary, perdb);
+
 		disconnect_database(conn);
 	}
 
@@ -1794,26 +1797,6 @@ main(int argc, char **argv)
 	 */
 	wait_for_end_recovery(standby.base_conninfo, dbarr.perdb[0].dbname);
 
-	/*
-	 * Create a publication for each database. This step should be executed
-	 * after promoting the subscriber to avoid replicating unnecessary
-	 * objects.
-	 */
-	for (i = 0; i < dbarr.ndbs; i++)
-	{
-		LogicalRepPerdbInfo *perdb = &dbarr.perdb[i];
-
-		/* Connect to publisher. */
-		conn = connect_database(primary.base_conninfo, perdb->dbname);
-		if (conn == NULL)
-			exit(1);
-
-		/* Also create a publication */
-		create_publication(conn, &primary, perdb);
-
-		disconnect_database(conn);
-	}
-
 	/*
 	 * Create a subscription for each database.
 	 */
-- 
2.43.0