Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSwKy-0001F5-NN for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Feb 2023 08:43:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSwKx-0007uu-EM for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Feb 2023 08:43:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSwKx-0007ul-4T for pgsql-hackers@lists.postgresql.org; Fri, 17 Feb 2023 08:43:23 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSwKt-0003Km-Ej for pgsql-hackers@lists.postgresql.org; Fri, 17 Feb 2023 08:43:22 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 8163A60743; Fri, 17 Feb 2023 17:43:13 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.7 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 17 Feb 2023 17:43:13 +0900 From: Katsuragi Yuta To: "Hayato Kuroda (Fujitsu)" Cc: 'Ted Yu' , Tom Lane , vignesh C , pgsql-hackers@lists.postgresql.org, =?UTF-8?Q?=C3=96nder_Kalac=C4=B1?= , Fujii Masao , Shinya11.Kato@oss.nttdata.com, Kyotaro Horiguchi Subject: Re: [Proposal] Add foreign-server health checks infrastructure In-Reply-To: References: <20221206182638.w3vrfal4qix4hf2w@awork3.anarazel.de> <204604.1673324688@sss.pgh.pa.us> <20a2c622cd4d763cf0b09b395a953ccc@oss.nttdata.com> <986867cac0ff331911da5990f054790c@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: katsuragiy@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-02-09 23:39, Hayato Kuroda (Fujitsu) wrote: > Dear Katsuragi-san, > > Thank you for reviewing! PSA new version patches. Thank you for updating the patch! These are my comments, please check. 0001: Extending pqSocketPoll seems to be a better way because we can avoid having multiple similar functions. I also would like to hear horiguchi-san's opinion whether this matches his expectation. Improvements of pqSocketPoll/pqSocketCheck is discussed in this thread[1]. I'm concerned with the discussion. As for the function's name, what do you think about keeping current name (pqSocketCheck)? pqSocketIsReadable... describes the functionality very well though. pqConnCheck seems to be a family of pqReadReady or pqWriteRedy, so how about placing pqConnCheck below them? + * Moreover, when neither forRead nor forWrite is requested and timeout is + * disabled, try to check the health of socket. Isn't it better to put the comment on how the arguments are interpreted before the description of return value? +#if defined(POLLRDHUP) + input_fd.events = POLLRDHUP | POLLHUP | POLLNVAL; ... + input_fd.events |= POLLERR; To my understanding, POLLHUP, POLLNVAL and POLLERR are ignored in event. Are they necessary? 0002: As for the return value of postgres_fdw_verify_connection_states, what do you think about returning NULL when connection-checking is not performed? I think there are two cases 1) ConnectionHash is not initialized or 2) connection is not found for specified server name, That is, no entry passes the first if statement below (case 2)). ``` if (all || entry->serverid == serverid) { if (PQconnCheck(entry->conn)) { ``` 0004: I'm wondering if we should add kqueue support in this version, because adding kqueue support introduces additional things to be considered. What do you think about focusing on the main functionality using poll in this patch and going for kqueue support after this patch? [1]: https://www.postgresql.org/message-id/20230209.115009.2229702014236187289.horikyota.ntt%40gmail.com regards, -- Katsuragi Yuta Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION