From: | Shubham Khanna <khannashubham1197(at)gmail(dot)com> |
---|---|
To: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> |
Subject: | Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility. |
Date: | 2025-02-13 09:53:41 |
Message-ID: | CAHv8RjJEALYkErnH6zJehC9Gxo-RevZjyaQJDcrPex3ZtY=9Gw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Feb 12, 2025 at 12:57 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Shubham,
>
> Thanks for updating the patch! Few comments.
>
> 01. pg_createsubscriber.sgml
> ```
> + <para>
> + Remove all existing publications on the subscriber node before creating
> + a subscription.
> + </para>
> +
> ```
>
Fixed.
> I think this is not accurate. Publications on databases which are not target will
> retain. Also, I'm not sure it is important to clarify "before creating a subscription.".
>
> How about: Remove all existing publications from specified databases.
>
> 02. main()
> ```
> + opt.cleanup_existing_publications = false;
> ```
>
> ISTM initialization is done with the same ordering with CreateSubscriberOptions.
> Thus this should be at after recovery_timeout.
>
Fixed.
> 03. 040_pg_createsubscriber.pl
> ```
> +$node_p->wait_for_replay_catchup($node_s);
> +
> +# Verify the existing publications
> +my $pub_count_before =
> + $node_s->safe_psql($db1, "SELECT COUNT(*) FROM pg_publication;");
> +is($pub_count_before, '2',
> + 'two publications created before --cleanup-existing-publications is run');
> ```
>
> I think no need to declare $pub_count_before. How about:
>
> ```
> ok( $node_s->poll_query_until(
> $db1, "SELECT COUNT(*) = 2 FROM pg_publication"),
> 'two publications created before --cleanup-existing-publications is run');
> ```
>
Fixed.
> 04. 040_pg_createsubscriber.pl
> ``` +my $pub_count_after =
> + $node_s->safe_psql($db1, "SELECT COUNT(*) FROM pg_publication;");
> +is($pub_count_after, '0',
> + 'all publications dropped after --cleanup-existing-publications is run');
> +
> ```
>
> I think no need to declare $pub_count_after. How about:
>
> ```
> is($node_s->safe_psql($db1, "SELECT COUNT(*) FROM pg_publication;"), '0',
> 'all publications dropped after --cleanup-existing-publications is run');
> ```
>
Fixed.
> 05.
>
> According to the document [1], we must do double-quote for each identifiers. But current
> patch seems not to do. Below example shows the case when three publications exist.
>
> ```
> pg_createsubscriber: dropping publications "aaa, bbb, ccc" in database "postgres"
> ```
>
> I think the output must be `"aaa", "bbb", "ccc"`. This means drop_publication() should be refactored.
>
> [1]: https://www.postgresql.org/docs/devel/error-style-guide.html#ERROR-STYLE-GUIDE-QUOTES
>
Fixed.
The attached patch at [1] contains the suggested changes.
Thanks and regards,
Shubham Khanna.
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2025-02-13 10:08:13 | Re: Get rid of WALBufMappingLock |
Previous Message | Sébastien | 2025-02-13 09:52:31 | [Feature Request] INSERT FROZEN to Optimize Large Cold Data Imports and Migrations |