Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQNfc-00Di7A-AW for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2023 07:50:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qQNec-00CeCs-EP for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2023 07:49:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQNec-00CeCh-54 for pgsql-hackers@lists.postgresql.org; Mon, 31 Jul 2023 07:49:22 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQNeZ-001Q3v-Jz for pgsql-hackers@lists.postgresql.org; Mon, 31 Jul 2023 07:49:21 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 713886057E; Mon, 31 Jul 2023 16:49:14 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 31 Jul 2023 16:49:14 +0900 From: Masahiro Ikeda To: Michael Paquier Cc: Bharath Rupireddy , Tristan Partin , andres@anarazel.de, pgsql-hackers@lists.postgresql.org Subject: Re: Support to define custom wait events for extensions In-Reply-To: References: <97449ae1a3b2189934890f6d78b18216@oss.nttdata.com> <446d286f3272437df705ee69ad0d8793@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: ikedamsh@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-07-31 16:28, Michael Paquier wrote: > On Mon, Jul 31, 2023 at 03:53:27PM +0900, Masahiro Ikeda wrote: >> /* This should only be called for user-defined wait event. */ >> if (eventId < NUM_BUILTIN_WAIT_EVENT_EXTENSION) >> ereport(ERROR, >> errcode(ERRCODE_INVALID_PARAMETER_VALUE), >> errmsg("invalid wait event ID %u", eventId)); >> >> I was just wondering if it should also check the eventId >> that has been allocated though it needs to take the spinlock >> and GetWaitEventExtensionIdentifier() doesn't take it into account. > > What kind of extra check do you have in mind? Once WAIT_EVENT_ID_MASK > is applied, we already know that we don't have something larger than > PG_UNIT16_MAX, or perhaps you want to cross-check this number with > what nextId holds in shared memory and that we don't have a number > between nextId and PG_UNIT16_MAX? I am not sure that we need to care > much about that this much in this code path, and I'd rather avoid > taking an extra time the spinlock just for a cross-check. OK. I assumed to check that we don't have a number between nextId and PG_UNIT16_MAX. Regards, -- Masahiro Ikeda NTT DATA CORPORATION