Re: [dynahash] do not refill the hashkey after hash_search

Поиск
Список
Период
Сортировка
От John Naylor
Тема Re: [dynahash] do not refill the hashkey after hash_search
Дата
Msg-id CANWCAZYc-easGz5sjDxm1iXXM14xs5_NwMu4DA5gr23CMjXmwQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [dynahash] do not refill the hashkey after hash_search  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: [dynahash] do not refill the hashkey after hash_search
Список pgsql-hackers
On Fri, Oct 13, 2023 at 10:07 AM Nathan Bossart
<nathandbossart@gmail.com> wrote:
>
> On Thu, Sep 14, 2023 at 04:28:26PM +0800, Junwang Zhao wrote:
> > Add a v2 with some change to fix warnings about unused-parameter.
> >
> > I will add this to Commit Fest.
>
> This looks reasonable to me.  I've marked the commitfest entry as
> ready-for-committer.  I will plan on committing it in a couple of days
> unless John has additional feedback or would like to do the honors.

(I've been offline for a few weeks, and have been catching up this week.)

I agree it's reasonable, but there are a couple small loose ends I'd
like to see addressed.

- strlcpy(hentry->name, name, sizeof(hentry->name));

This might do with a comment stating we already set the value, (we've
seen in this thread that some other code does this), but I don't feel
strongly about it.

  do
  {
- hash_search(uncommitted_enums, serialized++, HASH_ENTER, NULL);
+ (void) hash_search(uncommitted_enums, serialized++, HASH_ENTER, NULL);
  } while (OidIsValid(*serialized));

I still consider this an unrelated and unnecessary cosmetic change.

- NotificationHash *hentry;
  bool found;

- hentry = (NotificationHash *) hash_search(pendingNotifies->hashtab,
-   &oldn,
-   HASH_ENTER,
-   &found);
+ (void) hash_search(pendingNotifies->hashtab,
+    &oldn,
+    HASH_ENTER,
+    &found);
  Assert(!found);
- hentry->event = oldn;

I'd prefer just adding "Assert(hentry->event == oldn);" and declaring
hentry PG_USED_FOR_ASSERTS_ONLY.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dilip Kumar
Дата:
Сообщение: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [dynahash] do not refill the hashkey after hash_search