RE: Timeout parameters

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Nagaura, Ryohei" <nagaura(dot)ryohei(at)jp(dot)fujitsu(dot)com>
Cc: "Jamison, Kirk" <k(dot)jamison(at)jp(dot)fujitsu(dot)com>, 'Kyotaro HORIGUCHI' <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, "coelho(at)cri(dot)ensmp(dot)fr" <coelho(at)cri(dot)ensmp(dot)fr>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "MikalaiKeida(at)ibagroup(dot)eu" <MikalaiKeida(at)ibagroup(dot)eu>, "AYahorau(at)ibagroup(dot)eu" <AYahorau(at)ibagroup(dot)eu>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Timeout parameters
Date: 2019-03-29 03:36:45
Message-ID: 0A3221C70F24FB45833433255569204D1FBECD0B@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nagaura-san,

The socket_timeout patch needs the following fixes. Now that others have already tested these patches successfully, they appear committable to me.

(1)
+ else
+ goto iiv_error;
...
+
+iiv_error:
+ conn->status = CONNECTION_BAD;
+ printfPQExpBuffer(&conn->errorMessage,
+ libpq_gettext("invalid integer value for socket_timeout\n"));
+ return false;

This goto and its corresponding iiv_error label are redundant. You can just set the error message and return at the call site of parse_int_param(). i.e.:

if (!parse_int_param(...))
{
error processing
return false;
}
if(conn->socket_timeout > 0 && conn->socket_timeout < 2)
conn->socket_timeout = 2;

The reason why oom_error label is present is that it is used at multiple places to avoid repeating the same error processing code.

(2)
+ conn->sock = -1;

Use PGINVALID_SOCKET instead of -1.

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-29 03:42:35 Re: Syntax diagrams in user documentation
Previous Message Amit Langote 2019-03-29 02:55:48 Re: Misleading errors with column references in default expressions and partition bounds