From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
---|---|
To: | "Ashutosh Sharma" <ashu(dot)coek88(at)gmail(dot)com>, "vignesh C" <vignesh21(at)gmail(dot)com> |
Cc: | "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec>, "Dilip Kumar" <dilipbalaut(at)gmail(dot)com>, japin <japinli(at)hotmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Bharath Rupireddy" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Subject: | Re: Identify missing publications from publisher while create/alter subscription. |
Date: | 2022-02-09 18:23:06 |
Message-ID: | ed6209f3-378b-45bc-9009-e6bb95e656ba@www.fastmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Feb 9, 2022, at 12:06 PM, Ashutosh Sharma wrote:
> Just wondering if we should also be detecting the incorrect conninfo
> set with ALTER SUBSCRIPTION command as well. See below:
>
> -- try creating a subscription with incorrect conninfo. the command fails.
> postgres=# create subscription sub1 connection 'host=localhost
> port=5490 dbname=postgres' publication pub1;
> ERROR: could not connect to the publisher: connection to server at
> "localhost" (::1), port 5490 failed: Connection refused
> Is the server running on that host and accepting TCP/IP connections?
> connection to server at "localhost" (127.0.0.1), port 5490 failed:
> Connection refused
> Is the server running on that host and accepting TCP/IP connections?
That's because by default 'connect' parameter is true.
The important routine for all SUBSCRIPTION commands that handle connection
string is to validate the connection string e.g. check if all parameters are
correct. See walrcv_check_conninfo that calls PQconninfoParse.
The connection string is syntactically correct. Hence, no error. It could be
the case that the service is temporarily down. It is a useful and common
scenario that I wouldn't want to be forbid.
> -- reset the connninfo in the subscription to some wrong value. the
> command succeeds.
> postgres=# alter subscription sub1 connection 'host=localhost
> port=5490 dbname=postgres';
> ALTER SUBSCRIPTION
> postgres=#
>
> postgres=# drop subscription sub1;
> ERROR: could not connect to publisher when attempting to drop
> replication slot "sub1": connection to server at "localhost" (::1),
> port 5490 failed: Connection refused
> Is the server running on that host and accepting TCP/IP connections?
> connection to server at "localhost" (127.0.0.1), port 5490 failed:
> Connection refused
> Is the server running on that host and accepting TCP/IP connections?
> HINT: Use ALTER SUBSCRIPTION ... SET (slot_name = NONE) to
> disassociate the subscription from the slot.
Again, dropping a subscription that is associated with a replication slot
requires a connection to remove the replication slot. If the publisher is gone
(and so the replication slot), follow the HINT advice.
--
Euler Taveira
EDB https://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2022-02-09 18:34:21 | Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints |
Previous Message | Nathan Bossart | 2022-02-09 18:21:10 | Re: Unnecessary call to resetPQExpBuffer in getIndexes |