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 1muBpm-0001Nf-A1 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Dec 2021 11:07:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1muBpk-0003T5-Vy for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Dec 2021 11:07:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muBpk-0003Sv-MQ for pgsql-hackers@lists.postgresql.org; Mon, 06 Dec 2021 11:07:00 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muBpd-0005v8-HA for pgsql-hackers@lists.postgresql.org; Mon, 06 Dec 2021 11:06:59 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 3C3966053C; Mon, 6 Dec 2021 20:06:49 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.4 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 06 Dec 2021 20:06:49 +0900 From: Shinya Kato To: kuroda.hayato@fujitsu.com Cc: pgsql-hackers@lists.postgresql.org, zyu@yugabyte.com Subject: Re: [Proposal] Add foreign-server health checks infrastructure In-Reply-To: References: <54449d7bea79263e937266ad6ebc65b3@oss.nttdata.com> <4e64bb8a0a88f5b6ac5a8901377c81af@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: Shinya11.Kato@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-11-29 21:36, Zhihong Yu wrote: > On Mon, Nov 29, 2021 at 12:51 AM kuroda.hayato@fujitsu.com > wrote: > >> Dear Zhihong, >> >> Thank you for giving comments! I'll post new patches later. >> >>> +#define HOLD_CHECKING_REMOTE_SERVERS_INTERRUPTS() >> (CheckingRemoteServersHoldoffCount++) >>> >>> The macro contains only one operation. Can the macro be removed >> (with `CheckingRemoteServersHoldoffCount++` inlined) ? >> >> Hmm, these HOLD/RESUME macros are followed HOLD_INTERRUPUST() and >> HOLD_CANCEL_INTERRUPTS(): >> >> ``` >> #define HOLD_INTERRUPTS() (InterruptHoldoffCount++) >> >> #define RESUME_INTERRUPTS() \ >> do { \ >> Assert(InterruptHoldoffCount > 0); \ >> InterruptHoldoffCount--; \ >> } while(0) >> >> #define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++) >> >> #define RESUME_CANCEL_INTERRUPTS() \ >> do { \ >> Assert(QueryCancelHoldoffCount > 0); \ >> QueryCancelHoldoffCount--; \ >> } while(0) >> >> #define START_CRIT_SECTION() (CritSectionCount++) >> >> #define END_CRIT_SECTION() \ >> do { \ >> Assert(CritSectionCount > 0); \ >> CritSectionCount--; \ >> } while(0) >> ``` >> >> So I want to keep the current style. Could you tell me if you have >> any other reasons? >> >>> + if (CheckingRemoteServersTimeoutPending && >> CheckingRemoteServersHoldoffCount != 0) >>> + { >>> + /* >>> + * Skip checking foreign servers while reading messages. >>> + */ >>> + InterruptPending = true; >>> + } >>> + else if (CheckingRemoteServersTimeoutPending) >>> >>> Would the code be more readable if the above two if blocks be >> moved inside one enclosing if block (factoring the common >> condition)? >>> >>> + if (CheckingRemoteServersTimeoutPending) >> >> +1. Will fix. >> >> Best Regards, >> Hayato Kuroda >> FUJITSU LIMITED > > Hi, > > It is Okay to keep the macros. > > Thanks Hi, Kuroda-san. Sorry for late reply. Even for local-only transaction, I thought it useless to execute CallCheckingRemoteServersCallbacks() and enable_timeout_after(). Can I make it so that it determines outside whether it contains SQL to the remote or not? The following points are minor. 1. In foreign.c, some of the lines are too long and should be broken. 2. In pqcomm.c, the newline have been removed, what is the intention of this? 3. In postgres.c, 3-1. how about inserting a comment between lines 2713 and 2714, similar to line 2707? 3-2. the line breaks in line 3242 and line 3243 should be aligned. 3-3. you should change /* * Skip checking foreign servers while reading messages. */ to /* * Skip checking foreign servers while reading messages. */ 4. In connection.c, There is a typo in line 1684, so "fucntion" should be changed to "function". -- Regards, -- Shinya Kato Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION