No parameter values checking while creating Alter subscription...Connection

Started by tusharover 8 years ago5 messages
#1tushar
tushar.ahuja@enterprisedb.com

Hi,

We usually check connection parameter values while creating create
subscription

\\port is WRONG

postgres=# create subscription c1 connection 'port=4000 ' publication pub;
ERROR: could not connect to the publisher: could not connect to server:
No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.4000"?
postgres=#

\\when database doesn't exist

postgres=# create subscription c1 connection 'dbname=postgre '
publication pub;
ERROR: could not connect to the publisher: FATAL: database "postgre"
does not exist
postgres=#

but such checking is not done at the time of alter subscription ..
connection

postgres=# alter subscription c1 connection 'port=4000';
ALTER SUBSCRIPTION
postgres=# alter subscription c1 connection 'dbname=cc';
ALTER SUBSCRIPTION

--
regards,tushar
EnterpriseDB https://www.enterprisedb.com/
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Masahiko Sawada
sawada.mshk@gmail.com
In reply to: tushar (#1)
Re: No parameter values checking while creating Alter subscription...Connection

On Thu, May 25, 2017 at 9:43 AM, tushar <tushar.ahuja@enterprisedb.com> wrote:

Hi,

We usually check connection parameter values while creating create
subscription

\\port is WRONG

postgres=# create subscription c1 connection 'port=4000 ' publication pub;
ERROR: could not connect to the publisher: could not connect to server: No
such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.4000"?
postgres=#

\\when database doesn't exist

postgres=# create subscription c1 connection 'dbname=postgre ' publication
pub;
ERROR: could not connect to the publisher: FATAL: database "postgre" does
not exist
postgres=#

but such checking is not done at the time of alter subscription ..
connection

postgres=# alter subscription c1 connection 'port=4000';
ALTER SUBSCRIPTION
postgres=# alter subscription c1 connection 'dbname=cc';
ALTER SUBSCRIPTION

CREATE SUBSCRIPTION tries to connect to publisher to create
replication slot or to get table list for table synchronization, not
to check the connection parameter value. So if you specify connect =
false then CREATE SUBSCRIPTION doesn't try to connect.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Masahiko Sawada (#2)
Re: No parameter values checking while creating Alter subscription...Connection

On 5/25/17 10:18, Masahiko Sawada wrote:

postgres=# alter subscription c1 connection 'port=4000';
ALTER SUBSCRIPTION
postgres=# alter subscription c1 connection 'dbname=cc';
ALTER SUBSCRIPTION

CREATE SUBSCRIPTION tries to connect to publisher to create
replication slot or to get table list for table synchronization, not
to check the connection parameter value. So if you specify connect =
false then CREATE SUBSCRIPTION doesn't try to connect.

We don't make a connection attempt as part of ALTER SUBSCRIPTION. I
guess we could just connect and disconnect to check that it works.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Andres Freund
andres@anarazel.de
In reply to: Peter Eisentraut (#3)
Re: No parameter values checking while creating Alter subscription...Connection

On 2017-05-25 17:08:57 -0400, Peter Eisentraut wrote:

On 5/25/17 10:18, Masahiko Sawada wrote:

postgres=# alter subscription c1 connection 'port=4000';
ALTER SUBSCRIPTION
postgres=# alter subscription c1 connection 'dbname=cc';
ALTER SUBSCRIPTION

CREATE SUBSCRIPTION tries to connect to publisher to create
replication slot or to get table list for table synchronization, not
to check the connection parameter value. So if you specify connect =
false then CREATE SUBSCRIPTION doesn't try to connect.

We don't make a connection attempt as part of ALTER SUBSCRIPTION. I
guess we could just connect and disconnect to check that it works.

I think during reconfigurations it's quite useful to be able to do so
even if the other hosts aren't reachable that second.

- Andres

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Andres Freund (#4)
Re: No parameter values checking while creating Alter subscription...Connection

On 25/05/17 23:18, Andres Freund wrote:

On 2017-05-25 17:08:57 -0400, Peter Eisentraut wrote:

On 5/25/17 10:18, Masahiko Sawada wrote:

postgres=# alter subscription c1 connection 'port=4000';
ALTER SUBSCRIPTION
postgres=# alter subscription c1 connection 'dbname=cc';
ALTER SUBSCRIPTION

CREATE SUBSCRIPTION tries to connect to publisher to create
replication slot or to get table list for table synchronization, not
to check the connection parameter value. So if you specify connect =
false then CREATE SUBSCRIPTION doesn't try to connect.

We don't make a connection attempt as part of ALTER SUBSCRIPTION. I
guess we could just connect and disconnect to check that it works.

I think during reconfigurations it's quite useful to be able to do so
even if the other hosts aren't reachable that second.

Yes, it's intended behavior for this very reason, we want ability to
(re)configure downstream without any existing upstream. It's also reason
why we have the WITH (connect = false) in CREATE SUBSCRIPTION. I don't
see a nice way how to do something similar (ie make it optional) for
ALTER though.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers