Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-25 Thread Peter Eisentraut
On 23.06.25 05:48, Hayato Kuroda (Fujitsu) wrote: Thanks for posting the patch. Largely it seems OK. Thanks, I have committed this. One comment: I feel most of the word "remove" can be changed to "dropped", in pg_createsubscriber.c and 040_pg_createsubscriber.pl. E.g., ``` # Confirm the phy

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-22 Thread Hayato Kuroda (Fujitsu)
Dear Peter, Thanks for posting the patch. Largely it seems OK. One comment: I feel most of the word "remove" can be changed to "dropped", in pg_createsubscriber.c and 040_pg_createsubscriber.pl. E.g., ``` # Confirm the physical replication slot has been removed $result = $node_p->safe_psql($db1

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-22 Thread Peter Eisentraut
On 18.06.25 07:49, Peter Smith wrote: I'm also suggesting that "clean" or "cleanup" may be even better than "drop". Because if you look at related tools such as pg_basebackup, pg_receivewal, etc., the "create" and "drop" actions all happen on the remote instance, but what we are talking about he

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-18 Thread Amit Kapila
On Wed, Jun 18, 2025 at 10:32 AM David G. Johnston wrote: > >> >> The list can be longer than one or two. We may need to provide similar >> options for other objects, such as replication slots (synced failover >> replication slots on the physical standby), user-defined functions, >> triggers, view

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-17 Thread Peter Smith
On Wed, Jun 18, 2025 at 2:22 PM Amit Kapila wrote: > > On Tue, Jun 17, 2025 at 2:14 PM Peter Eisentraut wrote: > > > > I have been trying to reconstruct how the new pg_createsubscriber option > > --remove/-R came about, specifically the name. There was a dizzying > > number of messages in this t

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-17 Thread David G. Johnston
On Tue, Jun 17, 2025 at 9:22 PM Amit Kapila wrote: > On Tue, Jun 17, 2025 at 2:14 PM Peter Eisentraut > wrote: > > > I'm also suggesting that "clean" or "cleanup" may be even better than > > "drop". Because if you look at related tools such as pg_basebackup, > > pg_receivewal, etc., the "create

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-17 Thread Amit Kapila
On Tue, Jun 17, 2025 at 2:14 PM Peter Eisentraut wrote: > > I have been trying to reconstruct how the new pg_createsubscriber option > --remove/-R came about, specifically the name. There was a dizzying > number of messages in this thread about and around that, and in the end > I don't think the

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-06-17 Thread Peter Eisentraut
I have been trying to reconstruct how the new pg_createsubscriber option --remove/-R came about, specifically the name. There was a dizzying number of messages in this thread about and around that, and in the end I don't think the solution is great at the moment. To recap, the first proposal

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-05 Thread Peter Smith
Hi, I was away for the last few weeks when this feature got committed, so I missed the chance to post my comments earlier. It seems the final SGML docs are mostly from this [1] suggestion, but I think there are one or two more improvements that can be made to it: == 1. It is not at all obvi

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-05 Thread Shubham Khanna
On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston wrote: > > On Monday, March 17, 2025, Shubham Khanna wrote: >> >> >> I have added validation for "all" to address both issues at once. >> > > Usage needs to be changed to refer to object types and we should try and > specify which are valid ther

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-05 Thread Euler Taveira
On Mon, Mar 17, 2025, at 9:34 AM, Shubham Khanna wrote: > I have incorporated the "--remove/-r" parameter in the attached patch, > as it seems more intuitive and straightforward for users. > The attached patch contains the latest changes. There were a lot of discussion around the single vs multipl

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-05 Thread Amit Kapila
On Thu, Mar 20, 2025 at 9:45 AM Shubham Khanna wrote: > The patch had a bug in dry-run mode such that it was not emitting the drop-related command for publications created by the tool with the new option. I fixed that and pushed the patch. Thanks! -- With Regards, Amit Kapila.

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-03 Thread Amit Kapila
On Thu, Apr 3, 2025 at 2:20 PM vignesh C wrote: > > On Thu, 3 Apr 2025 at 09:07, Peter Smith wrote: > > > > Hi, > > > > I was away for the last few weeks when this feature got committed, so > > I missed the chance to post my comments earlier. > > > > It seems the final SGML docs are mostly from t

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-04-03 Thread vignesh C
On Thu, 3 Apr 2025 at 09:07, Peter Smith wrote: > > Hi, > > I was away for the last few weeks when this feature got committed, so > I missed the chance to post my comments earlier. > > It seems the final SGML docs are mostly from this [1] suggestion, but > I think there are one or two more improve

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Shubham Khanna
On Thu, Mar 20, 2025 at 9:37 AM vignesh C wrote: > > On Thu, 20 Mar 2025 at 09:06, Shubham Khanna > wrote: > > > > The attached patch contains the suggested changes. > > Couple of minor comments: > 1) The second and third line comments can be in same line: > +# Create user-defined publications, w

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread vignesh C
On Thu, 20 Mar 2025 at 09:06, Shubham Khanna wrote: > > The attached patch contains the suggested changes. Couple of minor comments: 1) The second and third line comments can be in same line: +# Create user-defined publications, wait for streaming replication to sync them +# to the standby, then

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 3:15 PM vignesh C wrote: > > On Wed, 19 Mar 2025 at 14:32, Shubham Khanna > wrote: > > > > > > Changed -r to -R based on the shared analysis to avoid conflict with > > the --retain option used in pg_upgrade and to maintain consistency > > across tools. > > > > The attached

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 12:29 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > One comment for the API. Currently the patch introduces new option '--remove', > and the short term is '-r'. My suggestion is to use '-R' instead. > > Background > == > IIUC, we've planned to put outut-lo

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 2:14 PM Amit Kapila wrote: > > On Wed, Mar 19, 2025 at 12:29 PM Hayato Kuroda (Fujitsu) > wrote: > > > > One comment for the API. Currently the patch introduces new option > > '--remove', > > and the short term is '-r'. My suggestion is to use '-R' instead. > > > > Backgr

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread vignesh C
On Wed, 19 Mar 2025 at 14:32, Shubham Khanna wrote: > > > Changed -r to -R based on the shared analysis to avoid conflict with > the --retain option used in pg_upgrade and to maintain consistency > across tools. > > The attached patch contains the suggested change. Few suggestions: 1) I felt the

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Amit Kapila
On Wed, Mar 19, 2025 at 12:29 PM Hayato Kuroda (Fujitsu) wrote: > > One comment for the API. Currently the patch introduces new option '--remove', > and the short term is '-r'. My suggestion is to use '-R' instead. > > Background > == > IIUC, we've planned to put outut-logs in some files o

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 12:44 PM Zhijie Hou (Fujitsu) wrote: > > On Wed, Mar 19, 2025 at 2:55 PM Shubham Khanna wrote: > > > > I have merged the changes and prepared the latest patch. The attached > > patch contains the suggested changes. > > Thanks for updating the patch. Here are few comments: >

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-19 Thread Zhijie Hou (Fujitsu)
On Wed, Mar 19, 2025 at 2:55 PM Shubham Khanna wrote: > > I have merged the changes and prepared the latest patch. The attached > patch contains the suggested changes. Thanks for updating the patch. Here are few comments: 1. pg_log_error("object type \"%s

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, One comment for the API. Currently the patch introduces new option '--remove', and the short term is '-r'. My suggestion is to use '-R' instead. Background == IIUC, we've planned to put outut-logs in some files on the directory [1]. This follows what pg_ugprade does. In pg

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 12:09 PM vignesh C wrote: > > On Wed, 19 Mar 2025 at 10:39, Shubham Khanna > wrote: > > > > On Tue, Mar 18, 2025 at 5:17 PM Amit Kapila wrote: > > > > > > On Tue, Mar 18, 2025 at 4:01 PM Shubham Khanna > > > wrote: > > > > > > > > On Tue, Mar 18, 2025 at 12:07 PM David G

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread vignesh C
On Wed, 19 Mar 2025 at 10:39, Shubham Khanna wrote: > > On Tue, Mar 18, 2025 at 5:17 PM Amit Kapila wrote: > > > > On Tue, Mar 18, 2025 at 4:01 PM Shubham Khanna > > wrote: > > > > > > On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston > > > wrote: > > > > > > > > > > > It would be good if we c

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 9:06 AM Amit Kapila wrote: > > On Wed, Mar 19, 2025 at 2:11 AM David G. Johnston > wrote: > > > > On Tue, Mar 18, 2025 at 4:47 AM Amit Kapila wrote: > >> > >> I don't understand --dry-run part of conversation here. As per > >> existing code (or with the patch), we seem to

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Shubham Khanna
On Wed, Mar 19, 2025 at 2:11 AM David G. Johnston wrote: > > On Tue, Mar 18, 2025 at 4:47 AM Amit Kapila wrote: >> >> I don't understand --dry-run part of conversation here. As per >> existing code (or with the patch), we seem to be already printing the >> publications to be dropped in dry-run mo

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Shubham Khanna
On Tue, Mar 18, 2025 at 5:17 PM Amit Kapila wrote: > > On Tue, Mar 18, 2025 at 4:01 PM Shubham Khanna > wrote: > > > > On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston > > wrote: > > > > > > > > It would be good if we could get this to play nicely with —dry-run; maybe > > > connecting to the

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Amit Kapila
On Wed, Mar 19, 2025 at 2:11 AM David G. Johnston wrote: > > On Tue, Mar 18, 2025 at 4:47 AM Amit Kapila wrote: >> >> I don't understand --dry-run part of conversation here. As per >> existing code (or with the patch), we seem to be already printing the >> publications to be dropped in dry-run mo

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread David G. Johnston
On Tue, Mar 18, 2025 at 4:47 AM Amit Kapila wrote: > I don't understand --dry-run part of conversation here. As per > existing code (or with the patch), we seem to be already printing the > publications to be dropped in dry-run mode. > Sorry, that was me making a bad assumption rather than check

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-18 Thread Amit Kapila
On Tue, Mar 18, 2025 at 4:01 PM Shubham Khanna wrote: > > On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston > wrote: > > > > > It would be good if we could get this to play nicely with —dry-run; maybe > > connecting to the source for the queries instead of the target. That would > > help alle

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread Amit Kapila
On Tue, Mar 18, 2025 at 12:07 PM David G. Johnston wrote: > > On Monday, March 17, 2025, Shubham Khanna wrote: >> >> >> I have added validation for "all" to address both issues at once. >> > > Usage needs to be changed to refer to object types and we should try and > specify which are valid ther

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread David G. Johnston
On Monday, March 17, 2025, Shubham Khanna wrote: > > I have added validation for "all" to address both issues at once. > > Usage needs to be changed to refer to object types and we should try and specify which are valid there too. The sgml docs need to mention “all” as a valid value and what it

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread Shubham Khanna
On Tue, Mar 18, 2025 at 5:48 AM David G. Johnston wrote: > > On Mon, Mar 17, 2025 at 4:01 PM Euler Taveira wrote: >> >> On Mon, Mar 17, 2025, at 9:34 AM, Shubham Khanna wrote: >> >> I have incorporated the "--remove/-r" parameter in the attached patch, >> as it seems more intuitive and straightfo

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread Shubham Khanna
On Tue, Mar 18, 2025 at 4:31 AM Euler Taveira wrote: > > On Mon, Mar 17, 2025, at 9:34 AM, Shubham Khanna wrote: > > I have incorporated the "--remove/-r" parameter in the attached patch, > as it seems more intuitive and straightforward for users. > The attached patch contains the latest changes.

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread David G. Johnston
On Mon, Mar 17, 2025 at 4:01 PM Euler Taveira wrote: > On Mon, Mar 17, 2025, at 9:34 AM, Shubham Khanna wrote: > > I have incorporated the "--remove/-r" parameter in the attached patch, > as it seems more intuitive and straightforward for users. > The attached patch contains the latest changes. >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-17 Thread Shubham Khanna
On Mon, Mar 17, 2025 at 8:44 AM Amit Kapila wrote: > > On Sat, Mar 15, 2025 at 8:03 PM David G. Johnston > wrote: > > > > On Friday, March 14, 2025, Amit Kapila wrote: > >> > >> > >> Style-1 sounds reasonable to me, but how exactly we want to do. One > >> idea is to have short and long switches

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-16 Thread Amit Kapila
On Sat, Mar 15, 2025 at 8:03 PM David G. Johnston wrote: > > On Friday, March 14, 2025, Amit Kapila wrote: >> >> >> Style-1 sounds reasonable to me, but how exactly we want to do. One >> idea is to have short and long switches like -r and >> --remove_exiting_object=publication. The user would be

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-15 Thread David G. Johnston
On Friday, March 14, 2025, Amit Kapila wrote: > On Sat, Mar 15, 2025 at 11:35 AM Peter Smith > wrote: > > > > On Sat, Mar 15, 2025 at 4:52 PM Peter Smith > wrote: > > > > > > On Fri, Mar 14, 2025 at 5:39 PM David G. Johnston > > > wrote: > > > > > > > > On Tuesday, March 11, 2025, Peter Smith

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-15 Thread Amit Kapila
On Sat, Mar 15, 2025 at 11:35 AM Peter Smith wrote: > > On Sat, Mar 15, 2025 at 4:52 PM Peter Smith wrote: > > > > On Fri, Mar 14, 2025 at 5:39 PM David G. Johnston > > wrote: > > > > > > On Tuesday, March 11, 2025, Peter Smith wrote: > > >> > > >> > > >> Choice 3. Implement some option that ha

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-14 Thread Peter Smith
On Sat, Mar 15, 2025 at 4:52 PM Peter Smith wrote: > > On Fri, Mar 14, 2025 at 5:39 PM David G. Johnston > wrote: > > > > On Tuesday, March 11, 2025, Peter Smith wrote: > >> > >> > >> Choice 3. Implement some option that has an argument saying what to delete > >> > >> Implement an option that ta

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-14 Thread Peter Smith
On Fri, Mar 14, 2025 at 5:39 PM David G. Johnston wrote: > > On Tuesday, March 11, 2025, Peter Smith wrote: >> >> >> Choice 3. Implement some option that has an argument saying what to delete >> >> Implement an option that takes some argument saying what objects to remove. >> >> Here, the current

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-14 Thread David G. Johnston
On Mon, Mar 10, 2025 at 5:00 PM Peter Smith wrote: > > 6. > The test code remains difficult to review because I can't see the > forest for the trees due to the dozens of S->S1 node name changes. > These name changes are unrelated to the new feature so please separate > them into a different prere

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-14 Thread David G. Johnston
On Fri, Mar 14, 2025 at 12:26 AM Zhijie Hou (Fujitsu) < houzj.f...@fujitsu.com> wrote: > For logical replication, there is a frequent need to automatically delete > all > objects (including publications) on replicas that are no longer needed. > This > requirement comes from a common use case in lo

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-14 Thread Zhijie Hou (Fujitsu)
On 2025/03/14 15:25:00 wrote: On Wed, Mar 12, 2025 at 12:13 PM David G. Johnston wrote: > On Tuesday, March 11, 2025, Amit Kapila > wrote: > > On Tue, Mar 11, 2025 at 8:21 PM David G. Johnston > > mailto:david.g.johns...@gmail.com> > wrote: > > > > > > On Tue,

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-13 Thread David G. Johnston
On Tuesday, March 11, 2025, Peter Smith wrote: > > Choice 3. Implement some option that has an argument saying what to delete > > Implement an option that takes some argument saying what objects to remove. > > Here, the current patch would be something like: > "--remove-target-objects=publication

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-13 Thread Amit Kapila
On Fri, Mar 14, 2025 at 3:06 AM Euler Taveira wrote: > > On Wed, Mar 12, 2025, at 3:41 AM, Amit Kapila wrote: > > This could be another option, but I feel an option with a tool is more > meaningful than allowing users to do afterward steps. > > > I wasn't paying much attention to this discussion.

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-13 Thread Euler Taveira
On Wed, Mar 12, 2025, at 3:41 AM, Amit Kapila wrote: > This could be another option, but I feel an option with a tool is more > meaningful than allowing users to do afterward steps. I wasn't paying much attention to this discussion. The thread title refers to a general option to clean publisher

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Amit Kapila
On Wed, Mar 12, 2025 at 10:42 AM David G. Johnston wrote: > > On Tuesday, March 11, 2025, Amit Kapila wrote: >> >> On Wed, Mar 12, 2025 at 9:43 AM David G. Johnston >> wrote: >> > >> > I’m honestly question how much value this provides - no improvement here >> > seems like a viable choice. Let

Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread David G. Johnston
On Tuesday, March 11, 2025, Amit Kapila wrote: > On Wed, Mar 12, 2025 at 9:43 AM David G. Johnston > wrote: > > > > I’m honestly question how much value this provides - no improvement here > seems like a viable choice. Let them issue the drop commands they desire > manually. This doesn’t feel

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Amit Kapila
On Wed, Mar 12, 2025 at 9:43 AM David G. Johnston wrote: > > I’m honestly question how much value this provides - no improvement here > seems like a viable choice. Let them issue the drop commands they desire > manually. This doesn’t feel like something one should/would automate. > There is a

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread David G. Johnston
On Tuesday, March 11, 2025, Amit Kapila wrote: > On Tue, Mar 11, 2025 at 6:02 AM David G. Johnston > wrote: > > > > Can you briefly recap how this is different than the automatic behavior > described in the existing Step 6? > > "Drop publications on the target server that were replicated because

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread David G. Johnston
On Tuesday, March 11, 2025, Amit Kapila wrote: > On Tue, Mar 11, 2025 at 8:21 PM David G. Johnston > wrote: > > > > On Tue, Mar 11, 2025 at 12:20 AM Peter Smith > wrote: > >> > >> > >> Unfortunately, we are spinning in circles a bit trying to come up with > >> a good way to represent the option

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Amit Kapila
On Tue, Mar 11, 2025 at 6:02 AM David G. Johnston wrote: > > Can you briefly recap how this is different than the automatic behavior > described in the existing Step 6? > "Drop publications on the target server that were replicated because they > were created before the replication start locatio

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Amit Kapila
On Tue, Mar 11, 2025 at 8:21 PM David G. Johnston wrote: > > On Tue, Mar 11, 2025 at 12:20 AM Peter Smith wrote: >> >> >> Unfortunately, we are spinning in circles a bit trying to come up with >> a good way to represent the option needed for this, while at the same >> time trying to be future-pro

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Shubham Khanna
On Mon, Mar 10, 2025 at 5:02 PM Nisha Moond wrote: > > On Mon, Mar 10, 2025 at 4:31 PM Shubham Khanna > wrote: > > > > > 2) This part of code has another bug: > > > "dbinfos.dbinfo->made_publication = false;" incorrectly modifies > > > dbinfo[0], even if the failure occurs in other databases (db

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread David G. Johnston
On Tue, Mar 11, 2025 at 12:20 AM Peter Smith wrote: > > Unfortunately, we are spinning in circles a bit trying to come up with > a good way to represent the option needed for this, while at the same > time trying to be future-proof. I see 3 choices... > > == > > Choice 1. Generic option > >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Nisha Moond
On Mon, Mar 10, 2025 at 4:31 PM Shubham Khanna wrote: > > > 2) This part of code has another bug: > > "dbinfos.dbinfo->made_publication = false;" incorrectly modifies > > dbinfo[0], even if the failure occurs in other databases (dbinfo[1], > > etc.). Since cleanup_objects_atexit() checks made_pub

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-11 Thread Peter Smith
On Tue, Mar 11, 2025 at 11:32 AM David G. Johnston wrote: > > On Mon, Mar 10, 2025 at 5:00 PM Peter Smith wrote: >> >> Hi Shubham. >> >> Some review comments for patch v16-0001. >> >> == >> doc/src/sgml/ref/pg_createsubscriber.sgml >> >> 1. >> + -c >> + --drop-all-publications >> >> I

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-10 Thread David G. Johnston
On Mon, Mar 10, 2025 at 5:00 PM Peter Smith wrote: > Hi Shubham. > > Some review comments for patch v16-0001. > > == > doc/src/sgml/ref/pg_createsubscriber.sgml > > 1. > + -c > + --drop-all-publications > > Is 'c' the best switch choice letter for this option? It doesn't seem > intuit

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-10 Thread Peter Smith
Hi Shubham. Some review comments for patch v16-0001. == doc/src/sgml/ref/pg_createsubscriber.sgml 1. + -c + --drop-all-publications Is 'c' the best switch choice letter for this option? It doesn't seem intuitive, but unfortunately, I don't have any better ideas since d/D and p/P are

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-10 Thread Shubham Khanna
On Mon, Mar 10, 2025 at 3:09 PM Nisha Moond wrote: > > On Mon, Mar 10, 2025 at 12:11 PM Shubham Khanna > wrote: > > > > On Thu, Mar 6, 2025 at 9:27 AM Peter Smith wrote: > > > > > > 6. > > > - dbinfo->pubname, dbinfo->dbname, PQresultErrorMessage(res)); > > > - dbinfo->made_publication = false;

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-10 Thread Nisha Moond
On Mon, Mar 10, 2025 at 12:11 PM Shubham Khanna wrote: > > On Thu, Mar 6, 2025 at 9:27 AM Peter Smith wrote: > > > > 6. > > - dbinfo->pubname, dbinfo->dbname, PQresultErrorMessage(res)); > > - dbinfo->made_publication = false; /* don't try again. */ > > + pubname, dbname, PQresultErrorMessage(res

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-09 Thread Shubham Khanna
On Thu, Mar 6, 2025 at 9:27 AM Peter Smith wrote: > > Hi Shubham. > > Some review comments for patch v13-0001. > > == > GENERAL > > 1. > --cleanup-existing-publications > > I've never liked this proposed switch name much. > > e.g. why say "cleanup" instead of "drop"? What is the difference? >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-09 Thread Shubham Khanna
On Wed, Mar 5, 2025 at 3:55 PM Nisha Moond wrote: > > On Tue, Mar 4, 2025 at 8:05 PM Shubham Khanna > wrote: > > > > The attached Patch contains the suggested changes. > > > > Hi Shubham, > > Here are few comments for 040_pg_createsubscriber.pl > > 1) > +# Run pg_createsubscriber on node S using

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-05 Thread Peter Smith
Hi Shubham. Some review comments for patch v13-0001. == GENERAL 1. --cleanup-existing-publications I've never liked this proposed switch name much. e.g. why say "cleanup" instead of "drop"? What is the difference? Saying drop is very explicit about what the switch will do. e.g. why say "ex

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-05 Thread Nisha Moond
On Tue, Mar 4, 2025 at 8:05 PM Shubham Khanna wrote: > > The attached Patch contains the suggested changes. > Hi Shubham, Here are few comments for 040_pg_createsubscriber.pl 1) +# Run pg_createsubscriber on node S using '--cleanup-existing-publications'. +# --verbose is used twice to show more

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-04 Thread Shubham Khanna
On Tue, Mar 4, 2025 at 4:31 PM Nisha Moond wrote: > > On Tue, Mar 4, 2025 at 10:30 AM Shubham Khanna > wrote: > > > > Fixed the suggested changes. The attached patch contains the required > > changes. > > > > Hi Shubham, > > Thanks for the patch! I tested its functionality and didn't find any >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-04 Thread Nisha Moond
On Tue, Mar 4, 2025 at 10:30 AM Shubham Khanna wrote: > > Fixed the suggested changes. The attached patch contains the required changes. > Hi Shubham, Thanks for the patch! I tested its functionality and didn't find any issues so far. I'll continue with further testing. Here are some review comm

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-03 Thread Shubham Khanna
On Mon, Mar 3, 2025 at 5:59 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > I did a quick check and have a comment in drop_publication(). > > ``` > + /* For cleanup purposes */ > + dbinfos.dbinfo->made_publication = true; > + > ``` > > Please do not modify randomly. Currently,

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-03-03 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, I did a quick check and have a comment in drop_publication(). ``` + /* For cleanup purposes */ + dbinfos.dbinfo->made_publication = true; + ``` Please do not modify randomly. Currently, made_publication is set to false when the command fails. No need to set to true here

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-28 Thread Shubham Khanna
On Tue, Feb 25, 2025 at 4:50 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > Thanks for updating the patch. Few comments. > > 01. CreateSubscriberOptions > ``` > + boolcleanup_existing_publications; /* drop all > publications */ > ``` > > My previous comment [1] #1 did

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-25 Thread Shubham Khanna
On Tue, Feb 25, 2025 at 4:50 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > Thanks for updating the patch. Few comments. > > 01. CreateSubscriberOptions > ``` > + boolcleanup_existing_publications; /* drop all > publications */ > ``` > > My previous comment [1] #1 did

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-25 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, Thanks for updating the patch. Few comments. 01. CreateSubscriberOptions ``` + boolcleanup_existing_publications; /* drop all publications */ ``` My previous comment [1] #1 did not intend to update attributes. My point was only for the third argument of setup_su

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-25 Thread Shubham Khanna
On Fri, Feb 21, 2025 at 3:06 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > Thanks for updating the patch. Here are comments. > > 01. > ``` > /* > * Create the subscriptions, adjust the initial location for logical > * replication and enable the subscriptions. That's the last step for l

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-25 Thread Shubham Khanna
On Fri, Feb 21, 2025 at 8:31 AM Peter Smith wrote: > > On Thu, Feb 20, 2025 at 5:44 PM Shubham Khanna > wrote: > > > > On Mon, Feb 17, 2025 at 9:49 AM Peter Smith wrote: > > > > ... > > > == > > > 1 GENERAL. Option Name? > > > > > > Wondering why the patch is introducing more terminology lik

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-21 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, Thanks for updating the patch. Here are comments. 01. ``` /* * Create the subscriptions, adjust the initial location for logical * replication and enable the subscriptions. That's the last step for logical * replication setup. If 'drop_publications' is true, existing publications

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-20 Thread Peter Smith
On Thu, Feb 20, 2025 at 5:44 PM Shubham Khanna wrote: > > On Mon, Feb 17, 2025 at 9:49 AM Peter Smith wrote: > > ... > > == > > 1 GENERAL. Option Name? > > > > Wondering why the patch is introducing more terminology like > > "cleanup"; if we are dropping publications then why not say "drop"?

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-19 Thread Shubham Khanna
On Mon, Feb 17, 2025 at 9:49 AM Peter Smith wrote: > > Hi Shubham > > Some review comments for v7-0001. > > (I am late to this thread. If some of my comments have already been > discussed and rejected please let me know). > > == > 1 GENERAL. Option Name? > > Wondering why the patch is introduc

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-17 Thread vignesh C
On Mon, 17 Feb 2025 at 09:49, Peter Smith wrote: > > Hi Shubham > > Some review comments for v7-0001. > > (I am late to this thread. If some of my comments have already been > discussed and rejected please let me know). > > == > 1 GENERAL. Option Name? > > Wondering why the patch is introducin

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-16 Thread Peter Smith
Hi Shubham Some review comments for v7-0001. (I am late to this thread. If some of my comments have already been discussed and rejected please let me know). == 1 GENERAL. Option Name? Wondering why the patch is introducing more terminology like "cleanup"; if we are dropping publications the

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-14 Thread Shubham Khanna
On Fri, Feb 14, 2025 at 4:57 PM Shlok Kyal wrote: > > On Fri, 14 Feb 2025 at 10:50, Shubham Khanna > wrote: > > > > On Thu, Feb 13, 2025 at 5:36 PM Shlok Kyal wrote: > > > > > > On Thu, 13 Feb 2025 at 15:20, Shubham Khanna > > > wrote: > > > > > > > > On Tue, Feb 11, 2025 at 9:56 PM Shlok Kyal

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-14 Thread Shlok Kyal
On Fri, 14 Feb 2025 at 10:50, Shubham Khanna wrote: > > On Thu, Feb 13, 2025 at 5:36 PM Shlok Kyal wrote: > > > > On Thu, 13 Feb 2025 at 15:20, Shubham Khanna > > wrote: > > > > > > On Tue, Feb 11, 2025 at 9:56 PM Shlok Kyal > > > wrote: > > > > > > > > On Tue, 11 Feb 2025 at 09:51, Shubham Kh

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-13 Thread Shubham Khanna
On Thu, Feb 13, 2025 at 5:36 PM Shlok Kyal wrote: > > On Thu, 13 Feb 2025 at 15:20, Shubham Khanna > wrote: > > > > On Tue, Feb 11, 2025 at 9:56 PM Shlok Kyal wrote: > > > > > > On Tue, 11 Feb 2025 at 09:51, Shubham Khanna > > > wrote: > > > > > > > > On Fri, Feb 7, 2025 at 7:46 AM Hayato Kurod

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-13 Thread Shlok Kyal
On Thu, 13 Feb 2025 at 15:20, Shubham Khanna wrote: > > On Tue, Feb 11, 2025 at 9:56 PM Shlok Kyal wrote: > > > > On Tue, 11 Feb 2025 at 09:51, Shubham Khanna > > wrote: > > > > > > On Fri, Feb 7, 2025 at 7:46 AM Hayato Kuroda (Fujitsu) > > > wrote: > > > > > > > > Dear Shubham, > > > > > > > >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-13 Thread Shubham Khanna
On Wed, Feb 12, 2025 at 12:57 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > Thanks for updating the patch! Few comments. > > 01. pg_createsubscriber.sgml > ``` > + > + Remove all existing publications on the subscriber node before > creating > + a subscription. > +

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-13 Thread Shubham Khanna
On Tue, Feb 11, 2025 at 9:56 PM Shlok Kyal wrote: > > On Tue, 11 Feb 2025 at 09:51, Shubham Khanna > wrote: > > > > On Fri, Feb 7, 2025 at 7:46 AM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > Dear Shubham, > > > > > > Thanks for updating the patch. > > > > > > Previously you told that you had

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-11 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, Thanks for updating the patch! Few comments. 01. pg_createsubscriber.sgml ``` + + Remove all existing publications on the subscriber node before creating + a subscription. + + ``` I think this is not accurate. Publications on databases which are not target

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-11 Thread Shlok Kyal
On Tue, 11 Feb 2025 at 09:51, Shubham Khanna wrote: > > On Fri, Feb 7, 2025 at 7:46 AM Hayato Kuroda (Fujitsu) > wrote: > > > > Dear Shubham, > > > > Thanks for updating the patch. > > > > Previously you told that you had a plan to extend the patch to drop other > > replication > > objects [1],

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-10 Thread Shubham Khanna
On Fri, Feb 7, 2025 at 7:46 AM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > Thanks for updating the patch. > > Previously you told that you had a plan to extend the patch to drop other > replication > objects [1], but I think it is not needed. pg_createsubscriber has already > been > abl

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-06 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, Thanks for updating the patch. Previously you told that you had a plan to extend the patch to drop other replication objects [1], but I think it is not needed. pg_createsubscriber has already been able to drop the existing subscrisubscriptions in check_and_drop_existing_subscripti

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-06 Thread Shubham Khanna
On Tue, Feb 4, 2025 at 5:39 PM Shlok Kyal wrote: > > On Wed, 29 Jan 2025 at 15:14, Shubham Khanna > wrote: > > > > On Wed, Jan 29, 2025 at 10:42 AM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > Dear Shubham, > > > > > > > I propose adding the --clean-publisher-objects option to the > > > > pg_c

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-04 Thread Shlok Kyal
On Wed, 5 Feb 2025 at 07:49, Hayato Kuroda (Fujitsu) wrote: > > Dear Shlok, > > > 4. Instead of warning we should throw an error here: > > + if (PQresultStatus(res) != PGRES_TUPLES_OK) > > + { > > + pg_log_warning("could not obtain publication information: %s", > > +

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-04 Thread Hayato Kuroda (Fujitsu)
Dear Shlok, > 4. Instead of warning we should throw an error here: > + if (PQresultStatus(res) != PGRES_TUPLES_OK) > + { > + pg_log_warning("could not obtain publication information: %s", > + PQresultErrorMessage(res)); > + I don't think so. ERROR ev

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-02-04 Thread Shlok Kyal
On Wed, 29 Jan 2025 at 15:14, Shubham Khanna wrote: > > On Wed, Jan 29, 2025 at 10:42 AM Hayato Kuroda (Fujitsu) > wrote: > > > > Dear Shubham, > > > > > I propose adding the --clean-publisher-objects option to the > > > pg_createsubscriber utility. As discussed in [1], this feature ensures > > >

Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-01-29 Thread Shubham Khanna
On Wed, Jan 29, 2025 at 10:42 AM Hayato Kuroda (Fujitsu) wrote: > > Dear Shubham, > > > I propose adding the --clean-publisher-objects option to the > > pg_createsubscriber utility. As discussed in [1], this feature ensures > > a clean and streamlined setup of logical replication by removing stale

RE: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-01-28 Thread Hayato Kuroda (Fujitsu)
Dear Shubham, > I propose adding the --clean-publisher-objects option to the > pg_createsubscriber utility. As discussed in [1], this feature ensures > a clean and streamlined setup of logical replication by removing stale > or unnecessary publications from the subscriber node. These > publication

Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility.

2025-01-28 Thread Shubham Khanna
Hi all, I propose adding the --clean-publisher-objects option to the pg_createsubscriber utility. As discussed in [1], this feature ensures a clean and streamlined setup of logical replication by removing stale or unnecessary publications from the subscriber node. These publications, replicated du