From 5c8232353161b7e6e554871e0122583c1c4c56b3 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 14 Apr 2010 08:08:27 +0000 Subject: [PATCH] Move fast-fail relaunch logic around. Do it together with fast-fail disconnect. When kept separately it can launch even if there are no new clients coming. This causes problem with permanently dead dbs/users, as the retry will not stop if all clients are gone. --- src/janitor.c | 7 ------- src/objects.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/janitor.c b/src/janitor.c index b37d028..21b6396 100644 --- a/src/janitor.c +++ b/src/janitor.c @@ -429,13 +429,6 @@ static void check_pool_size(PgPool *pool) disconnect_server(server, true, "too many servers in the pool"); many--; } - - /* - * Because of fast-fail we may not have any waiting clients that would - * trigger server re-connect. So do it explicitly. - */ - if (cur == 0 && pool->last_connect_failed) - launch_new_connection(pool); } /* maintain servers in a pool */ diff --git a/src/objects.c b/src/objects.c index 4078355..1605e7e 100644 --- a/src/objects.c +++ b/src/objects.c @@ -524,6 +524,9 @@ bool find_server(PgSocket *client) if (!server && pool->last_connect_failed) { int cnt = pool_server_count(pool) - statlist_count(&pool->new_server_list); if (!cnt) { + /* usual relaunch wont work, as there are no waiting clients */ + launch_new_connection(client->pool); + disconnect_client(client, true, "no working server connection"); return false; } -- 2.39.5