Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL - Mailing list pgsql-patches

From Oliver Jowett
Subject Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Date
Msg-id 4296585D.90504@opencloud.com
Whole thread Raw
In response to Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL (was Re: [HACKERS] Feature freeze date for 8.1)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
List pgsql-patches
Tom Lane wrote:
> Oliver Jowett <oliver@opencloud.com> writes:
>
>>Here's a patch that adds four new GUCs:
>
>
>>  tcp_keepalives (defaults to on, controls SO_KEEPALIVE)
>>  tcp_keepalives_idle (controls TCP_KEEPIDLE)
>>  tcp_keepalives_interval (controls TCP_KEEPINTVL)
>>  tcp_keepalives_count (controls TCP_KEEPCNT)
>
> Do you think the system defaults are really going to be port-specific?

I don't understand what you mean. TCP_* override the system defaults on
a per-connection basis, if that's what you mean.

> I'm slightly annoyed by the number of syscalls this adds to every
> connection startup ... getting rid of redundant getsockopt calls would
> help.  Getting rid of redundant setsockopt calls (ie, a call to
> establish the value that we already know is in force) would help more.

I originally did this but went in favor of simpler code. Are the extra
syscalls an issue? I didn't think they were that expensive..

> Alternatively, we could lose the frammish that PostgreSQL can tell you
> what the system defaults are: 0 in the GUC just means "do nothing",
> not "find out what the current setting is on the off chance that the
> user might want to know".

I didn't do this as it meant that using SET tcp_whatever = 0 does *not*
reset the setting to what you'd get with a value of 0 in
postgresql.conf, which seemed confusing to me.

This could all get simpler if we didn't allow per-connection changing of
that GUC (i.e. set it once at startup and forget about it), which
probably isn't unreasonable. I wonder if those socket options get
inherited from the listening socket? Will check.

-O

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fix for timestamp rouding
Next
From: Neil Conway
Date:
Subject: Re: Remove second argument from textToQualifiedNameList