From: | Victor Wagner <vitus(at)wagner(dot)pp(dot)ru> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Patch: Implement failover on libpq connect level. |
Date: | 2016-01-21 09:49:09 |
Message-ID: | 20160121124909.7fa66dab@fafnir.local.vm |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-jdbc |
On Tue, 19 Jan 2016 14:34:54 +0000
Thom Brown <thom(at)linux(dot)com> wrote:
> The segfault issue I originally reported now appears to be resolved.
>
> But now I have another one:
>
> psql
> 'postgresql://thom(at)127(dot)0(dot)0(dot)1:5530,127.0.0.1:5531,127.0.0.1:5532,127.0.0.1:5533/postgres?hostorder=random&readonly=1&failover_timeout=5'
> -c 'show port'
>
> Segmentation fault
This segfault appears to be a simple programming error.
which comes out only when we need to retry address list (which happens
when no node is available at the time of first scan)
There is code which prevents random hostorder to connect same node
twice a row
while (current != NULL)
{
if (current == conn->addr_cur)
{
current = current->ai_next;
}
count++;
if ((rand()&0xffff) < 0x10000 / count)
{
choice = current;
}
current = current->ai_next;
}
There should be continue; after first current = current->ai_next;
> This is where no nodes are available. If I remove hostorder=random,
> or replace it with hostorder=sequential, it doesn't segfault.
> However, it then tries to connect to PGHOST on PGPORT repeatedly, even
> if I bring up one of the nodes it should be looking for. Not only
> this, but it seems to do it forever if failover_timeout is greater
> than 0.
But this turns out to be more complicated matter, so I'm not ready to
provide next version of patch yet.
From | Date | Subject | |
---|---|---|---|
Next Message | Etsuro Fujita | 2016-01-21 09:50:40 | Re: Optimization for updating foreign tables in Postgres FDW |
Previous Message | Kyotaro HORIGUCHI | 2016-01-21 09:26:49 | Re: [PoC] Asynchronous execution again (which is not parallel) |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Kajaba | 2016-01-21 10:03:39 | Re: [pgjdbc] Implement JDBC specs via pre-processor step (#435) |
Previous Message | Álvaro Hernández Tortosa | 2016-01-21 00:30:27 | Re: Step towards being able to build on Linux (Pull request #435) |