Re: Patch: Implement failover on libpq connect level.

Поиск
Список
Период
Сортировка
От Mithun Cy
Тема Re: Patch: Implement failover on libpq connect level.
Дата
Msg-id CAD__OuhqPRGpcsfwPHz_PDqAGkoqS1UvnUnOnAB-LBWBW=wu4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch: Implement failover on libpq connect level.  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Patch: Implement failover on libpq connect level.
Re: Patch: Implement failover on libpq connect level.
Список pgsql-hackers
On Thu, Nov 3, 2016 at 7:16 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> Great, committed.  There's still potentially more work to be done
> here, because my patch omits some features that were present in
> Victor's original submission, like setting the failover timeout,
> optionally randomizing the order of the hosts, and distinguishing
> between master and standby servers; Victor, or anyone, please feel
> free to submit separate patches for those things.

Among the remaining things I have worked on failover to new master idea. Below patch implement that idea. This is taken from Victors patch but rewritten by me to do some cleanup. As in Victor's patch we have a new connection parameter "target_server_type", It can take 2 values 1. "any" 2. "master" with DEFAULT as "any". If it's has the value "any" we can connect to any of the host server (both master(primary) and slave(standby)). If the value is "master" then we try to connect to master(primary) only.
NOTE: Parameter name is inspired and taken from PostgreSql JDBC Driver.

The main difference between Victor's and this new patch is Default value of parameter target_server_type. In Victor's patch if number of host in connection string is 1 then default value is "any" (This was done to make sure old psql connect to standby as it is now). If it is greater than 1 then default value is set as "master". For me this appeared slightly inconsistent having default value as "any" for any number of connection appeared more appropriate which is also backward compatible. And, if user want failover to master he should ask for it by setting target_server_type=master in connection string.

This patch do not include load balancing feature by trying to connect to host in random fashion.

This patch also do not have failover timeout feature. Victor's implementation of same is not a strict one. i. e. 1 walk of all of the host is allowed even if timer might have expired. Only on second walk we check for timeout. I thought application can manage the failover timeout instead libpq doing it. So avoided the same in this patch. If others find that I am wrong to think that way, will add the same. 

-- 
Thanks and Regards
Mithun C Y
Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Do we need use more meaningful variables to replace 0 in catalog head files?
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Do we need use more meaningful variables to replace 0 in catalog head files?