Re: Add support for specifying tables in pg_createsubscriber.

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add support for specifying tables in pg_createsubscriber.
Date: 2025-10-08 05:40:24
Message-ID: CAHut+Pv88obEAu7xegcXtQk8nLHgHkZ5Lg5sLXmWzFj8-SO5jA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shubham,

Here are some v14 review comments.

======
src/bin/pg_basebackup/pg_createsubscriber.c

check_and_drop_publications:

1.
+ * Publications copied during physical replication remain on the subscriber
+ * after promotion. If --clean=publications is specified, drop all existing
+ * publications in the subscriber database. Otherwise, only drop publications
+ * that were created by pg_createsubscriber during this operation.
+ *
+ * In dry-run mode, create_publication() and drop_publication() only
log actions
+ * without modifying the database. Importantly, since no publication
is actually
+ * created in dry-run, the query for existing publications won't include the
+ * "would-be" made publication. Thus, we must call drop_publication() for it
+ * regardless of drop_all_pubs to ensure the user sees the intended
log message.
*/

I think the "In dry-mode ..." paragraph is a good comment, but it
doesn't need to be at the function level. IMO, this can all be
cut/paste to later (see the next review comment).

~~~

2.
/*
- * In dry-run mode, we don't create publications, but we still try to drop
- * those to provide necessary information to the user.
+ * Handle the publication created (or would-be created) by
+ * pg_createsubscriber. In dry-run mode, enter this block regardless of
+ * drop_all_pubs to log the drop action for the made publication (which
+ * isn't actually present).
*/

The wording in the function header seemed better. IMO, this entire
comment can be replaced like:

/*
* Handle publications created by pg_createsubscriber.
*
* <here cut/paste all the "In dry-mode..." wording from the function
header comment>
*/
~~~

I provided a top-up diff patch to illustrate my point.

////////////////////

I also had a look at the 'results' logging from your script.

~~~

For test case 1. (new pub pub2 + clean):

I hoped to see some evidence that --clean is dropping all other
existing pubs; e.g. pub1,pub2,pub3, whatever...

~~~

For test case 3. (Existing pub pub1 + clean):

I hoped to see some evidence that --clean is dropping existing pubs;
e.g. pub1,pub2,pub3, whatever...

~~~

For test case 5. (Auto pub + clean):

I hoped to see some evidence that --clean is dropping existing pubs;
e.g. pub1,pub2,pub3, whatever...

======
Kind Regards,
Peter Smith.
Fujitsu Australia.

Attachment Content-Type Size
PS_topup_v14.diff application/octet-stream 1.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2025-10-08 06:05:14 Re: Add support for specifying tables in pg_createsubscriber.
Previous Message Amit Kapila 2025-10-08 05:35:54 Re: Logical Replication of sequences