Re: Support to define custom wait events for extensions

From: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
To: Tristan Partin <tristan(at)neon(dot)tech>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Support to define custom wait events for extensions
Date: 2023-07-12 07:59:22
Message-ID: bbc68bc47ecfcc4e0efea5f514f8a6a8@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-07-12 02:39, Tristan Partin wrote:
>> From bf06b8100cb747031959fe81a2d19baabc4838cf Mon Sep 17 00:00:00 2001
>> From: Masahiro Ikeda <masahiro(dot)ikeda(dot)us(at)hco(dot)ntt(dot)co(dot)jp>
>> Date: Fri, 16 Jun 2023 11:53:29 +0900
>> Subject: [PATCH 1/2] Support custom wait events for extensions.
>
>> + * This is indexed by event ID minus
>> NUM_BUILTIN_WAIT_EVENT_EXTENSION, and
>> + * stores the names of all dynamically-created event ID known to the
>> current
>> + * process. Any unused entries in the array will contain NULL.
>
> The second ID should be plural.

Thanks for reviewing. Yes, I'll fix it.

>> + /* If necessary, create or enlarge array. */
>> + if (eventId >= ExtensionWaitEventTrancheNamesAllocated)
>> + {
>> + int newalloc;
>> +
>> + newalloc = pg_nextpower2_32(Max(8, eventId + 1));
>
> Given the context of our last conversation, I assume this code was
> copied from somewhere else. Since this is new code, I think it would
> make more sense if newalloc was a uint16 or size_t.

As Michael-san said, I used LWLockRegisterTranche() as a reference.
I think it is a good idea to fix the current master. I'll modify the
above code accordingly.

> From what I undersatnd, Neon differs from upstream in some way related
> to this patch. I am trying to ascertain how that is. I hope to provide
> more feedback when I learn more about it.

Oh, it was unexpected for me. Thanks for researching the reason.

Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-07-12 08:24:45 Re: SQL:2011 application time
Previous Message Masahiro Ikeda 2023-07-12 07:52:38 Re: Support to define custom wait events for extensions