From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | lizenko79(at)gmail(dot)com, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol |
Date: | 2017-06-28 13:52:36 |
Message-ID: | 8594.1498657956@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> Concretely, something like the attached. I have no way to test this
> locally, so I'm thinking of just pushing it and seeing what the buildfarm
> says.
So that didn't work: castoroides is still showing
[5953a7e1.1fff:13] LOG: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol
[5953a7e1.1fff:14] STATEMENT: select name, setting from pg_settings where name like 'enable%';
which implies that TCP_KEEPALIVE_THRESHOLD doesn't exist on Solaris 10.
Evidently, the logic here needs to be along the lines of
#if defined(TCP_KEEPIDLE)
...
#elif defined(TCP_KEEPALIVE_THRESHOLD)
...
#elif defined(TCP_KEEPALIVE) && defined(__darwin__)
...
Or we could make the last test be !defined(__solaris__), but I'm not
sure that's better. Anybody have an opinion?
As long as I have to touch this code again anyway, I'm also going to
look into Michael's thought of trying to reduce code duplication.
I was unhappy yesterday about how to handle the error messages,
but we could do it like this:
#if defined(TCP_KEEPIDLE)
#define PG_TCP_KEEPALIVE TCP_KEEPIDLE
#define PG_TCP_KEEPALIVE_STR "TCP_KEEPIDLE"
#elif ...
#ifdef PG_TCP_KEEPALIVE
if (setsockopt(port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE,
(char *) &idle, sizeof(idle)) < 0)
{
elog(LOG, "setsockopt(%s) failed: %m", PG_TCP_KEEPALIVE_STR);
which doesn't seem too painful.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | bricklen | 2017-06-28 15:48:31 | Re: Multi-Master Replication |
Previous Message | Amol Dongare | 2017-06-28 13:18:58 | Multi-Master Replication |