From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Pavel Golub <pavel(at)microolap(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: keepalive in libpq using |
Date: | 2010-07-08 06:55:24 |
Message-ID: | AANLkTikznZld7svAA1ayjHfVjPLRlljOYCNLkPw57b7F@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 7, 2010 at 10:04 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jul 6, 2010 at 1:08 PM, Pavel Golub <pavel(at)microolap(dot)com> wrote:
>> While I'm very excited about enabling keepalives in libpq, I want to
>> know how can I use this functionality in my application?
>>
>> Let's imagine that I connect to a server with keepalives option, other
>> options (keepalives_idle, keepalives_interval, keepalives_count) are
>> used either. Then network goes down. So, how will I know that
>> connection is dead? Any callback function? Or should I check PQstatus
>> periodically?
>
> I'm not sure, exactly. I think what'll happen is that if you're
> trying to read data from the remote server, the connection will
> eventually break instead of hanging forever, but I'm not exactly sure
> what that'll look like at the libpq level. I'm not sure what effect
> it'll have on an idle connection.
When network goes down while receiving result from server, you will
get PGRES_FATAL_ERROR from PQresultStatus(). Also you can get the
error message "could not receive data from server: Connection timed out"
via PQerrorMessage().
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Takahiro Itagaki | 2010-07-08 07:15:38 | Re: patch (for 9.1) string functions |
Previous Message | Simon Riggs | 2010-07-08 06:16:05 | Re: ALTER TABLE SET STATISTICS requires AccessExclusiveLock |