pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Tristan Partin <tristan@neon.tech>
Cc: andres@anarazel.de
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Support to define custom wait events for extensions
Date: Mon, 31 Jul 2023 16:49:14 +0900
Message-ID: <dbd9bc09299ff72b940d674d44c45a41@oss.nttdata.com> (raw)
In-Reply-To: <ZMdikEm4Xq9KQKNY@paquier.xyz>
References: <ZK9iLbi2l2rrELfV@paquier.xyz>
	<97449ae1a3b2189934890f6d78b18216@oss.nttdata.com>
	<ca567bd4076dfc7e8b0d39afe5b0cc22@oss.nttdata.com>
	<CU69THFPG2CN.MK16RYW510YD@gonk>
	<ZMI1/tQp/TQ1/m3B@paquier.xyz>
	<cd09c86daa9e4c1c5f7903da39b75994@oss.nttdata.com>
	<ZMMUiR7kvzPWenhF@paquier.xyz>
	<CALj2ACVq=BogP=iQ0C=Pjzk4+rSTaKZU_+fdMRk4YyG8B60gAQ@mail.gmail.com>
	<ZMcJ7F7nkGkIs8zP@paquier.xyz>
	<446d286f3272437df705ee69ad0d8793@oss.nttdata.com>
	<ZMdikEm4Xq9KQKNY@paquier.xyz>

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





view thread (78+ messages)  latest in thread

Message-ID: <dbd9bc09299ff72b940d674d44c45a41@oss.nttdata.com>
Permalink:  ../dbd9bc09299ff72b940d674d44c45a41@oss.nttdata.com/
Also on:    postgresql.org/message-id/dbd9bc09299ff72b940d674d44c45a41@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ikedamsh@oss.nttdata.com, michael@paquier.xyz, bharath.rupireddyforpostgres@gmail.com, tristan@neon.tech, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
  Subject: Re: Support to define custom wait events for extensions
  In-Reply-To: <dbd9bc09299ff72b940d674d44c45a41@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox