From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
---|---|
To: | 'Shubham Khanna' <khannashubham1197(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com> |
Subject: | RE: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided. |
Date: | 2025-02-18 02:02:05 |
Message-ID: | OSCPR01MB149661FC9BB7015EE67B1E36BF5FA2@OSCPR01MB14966.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Shubham,
Thanks for updating the patch. Few comments.
```
+ If a database is present on the source but missing on the target, an
+ error is raised.
```
I'm not sure this description is accurate. I feel there is a case the command can
succeed.
Assuming that there are three databases (db1, db2, and db3) on the primary but db3
is missing on the standby when DBA is running the command. In check_subscriber(),
pg_createsubscriber connects to the db1 and it says OK. Then we wait until all
changes are replicated, thus db3 is created on the target. Everything may go well afterward.
Possible handling is as follows:
1) Ignore the corner case and retain,
2) Remove the description,
3) Modify the description, or
4) Modify codes to reject when the speficied database is missing on the target.
I feel 2) may be enough, but I want to ask others as well.
```
+ If a database exists on the target but not on the source, no
+ subscription is created for it.
```
I do not think this is needed. If the database exists on the target but not on the
source, IIUC this means the DROP DATABASE was executed on the primary server but
not replicated to the standby yet. In this case such databases would be dropped
during the command because we ensure all changes are replicated before the promotion.
Tell me if there are other situations...
```
+ disconnect_database(conn, false);
+ exit(1);
```
This combination can be changed to disconnect_database(conn, true).
Best regards,
Hayato Kuroda
FUJITSU LIMITED
From | Date | Subject | |
---|---|---|---|
Next Message | wenhui qiu | 2025-02-18 03:12:03 | Re: [Feature Request] INSERT FROZEN to Optimize Large Cold Data Imports and Migrations |
Previous Message | Zhang Mingli | 2025-02-18 01:54:51 | Re: Proposal to CREATE FOREIGN TABLE LIKE |