Proposal to add connection request Wait-time in PSQL client.

From: amul sul <sul_amul(at)yahoo(dot)co(dot)in>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal to add connection request Wait-time in PSQL client.
Date: 2013-05-17 00:22:40
Message-ID: 1368750160.98161.YahooMailNeo@web193502.mail.sg3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I have observed the following same situation in PG 9.3beta1
Multiple PSQL clients are connected to server, some of them running  transaction and some of them are idle state.

 
When one of the backend is killed or crashed (using kill -9 <backend-pid>).
The connection reset attempt from the active clients( that is, which were running a  transaction and crashed in between) fails, since they immediately make the attempt while the server is in startup phase.
 
 
I just gone through and found following:
 
1. When backend crashes , server goes into recovery mode and come in the  normal state to accept connection, it take little time.
2. But at busy client(which was running transaction before crash),  immediately tries to reconnect to server which is under startup phase so it  gets a negative reply and fails to reconnect.
 
So I thought, before sending reconnect request from client need to wait for  the server come to a state when it can accept connections.  It should have some timeout wait.
 
I am not sure is this correct way to code modification or does it have any other impact.
I tried wait to client before sending reconnect request to server.
For that added some sleep time for client in src/bin/psql/common.c (that is it changes things only  for psql clients)
 
Please check the attached patch for the modification.
 

Regards,
Amul Sul

Attachment Content-Type Size
0001-psql-connection-reset-wait.patch application/octet-stream 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-05-17 00:33:33 Re: counting algorithm for incremental matview maintenance
Previous Message Robert Haas 2013-05-17 00:16:57 Re: Logging of PAM Authentication Failure