Re: Patch: Implement failover on libpq connect level.

Поиск
Список
Период
Сортировка
От Mithun Cy
Тема Re: Patch: Implement failover on libpq connect level.
Дата
Msg-id CAD__OujS2tU9nkTAeVnfJ-vMe8+JT3Po+puSopu8WF_Cyx4sOA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch: Implement failover on libpq connect level.  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Ответы Re: Patch: Implement failover on libpq connect level.  (Victor Wagner <vitus@wagner.pp.ru>)
Re: Patch: Implement failover on libpq connect level.  (Victor Wagner <vitus@wagner.pp.ru>)
Список pgsql-hackers

On Mon, Sep 5, 2016 at 4:33 PM, Aleksander Alekseev <a.alekseev@postgrespro.ru> wrote:
>After a brief examination I've found following ways to improve the patch.
Adding to above comments.

1)
+ /*
+ * consult connection options and check if RO connection is OK
+ * RO connection is OK if readonly connection is explicitely
+ * requested or if replication option is set, or just one
+ * host is specified in the connect string.
+ */
+ if ((conn->pghost==NULL || strchr(conn->pghost,',')==NULL) ||
+ ((conn->read_only && conn->read_only[0] > '0'))
+ ||(conn->replication && conn->replication[0])
+ )
+ {

Now if only one host is in connection string and it ask for read_write connection(connect to master) I mean read_only is set 0 explicitly. With above logic we will allow it to connect to standby?. I still think psql connection to standby should be handled by changing the default value of readonly to 1 (which means connect to any). Thinking further probably replacing readonly parameter with targetServerType=any|master (with default being any) should clear some confusions and bring consistency since same is used in JDBC multi host connection string.

2)
@@ -1460,33 +1538,80 @@ connectDBStart(PGconn *conn)
   portstr,
   (int) (UNIXSOCK_PATH_BUFLEN - 1));
  conn->options_valid = false;
+ free(nodes->port);

nodes->port was not allocated at this point.

--
Thanks and Regards
Mithun C Y

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Install extensions using update scripts (was Re: Remove superuser() checks from pgstattuple)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_sequence catalog