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 1pUNZ4-00089G-1F for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Feb 2023 07:59:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUNZ2-0001bv-Rx for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Feb 2023 07:59:52 +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 1pUNZ2-0001bg-IL for pgsql-hackers@lists.postgresql.org; Tue, 21 Feb 2023 07:59:52 +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 1pUNZ0-0005pU-02 for pgsql-hackers@lists.postgresql.org; Tue, 21 Feb 2023 07:59:52 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id C0FD860777; Tue, 21 Feb 2023 16:59:44 +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: Tue, 21 Feb 2023 16:59:44 +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: 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 Hi Kuroda-san, Thank you for updating the patch! On 2023-02-20 15:42, Hayato Kuroda (Fujitsu) wrote: > Dear Katsuragi-san, > > Thank you for reviewing! PSA new version. I rethought the pqSocketPoll part. Current interpretation of arguments seems a little bit confusing because a specific pattern of arguments has a different meaning. What do you think about introducing a new argument like `int forConnCheck`? This seems straightforward and readable. >> 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)) >> { >> ``` > > I think in that case we can follow postgres_fdw_disconnect(). > About postgres_fdw_disconnect(), if the given server_name does not > exist, > an error is reported. Yes, I think this error is fine. I think there are cases where the given server name does exist, however the connection check is not performed (does not pass the first if statement above). 1) a case where the server name exist, however an open connection to the specified server is not found. 2) case where connection for specified server is invalidated. 3) case where there is not ConnectionHash entry for the specified server. Current implementation returns true in that case, however the check is not performed. Suppose the checking mechanism is supported on the platform, it does not seem reasonable to return true or false when the check is not performed. What do you think? regards, -- Katsuragi Yuta Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION