[dynahash] do not refill the hashkey after hash_search

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [dynahash] do not refill the hashkey after hash_search
Date: 2023-09-13 06:46:30
Message-ID: CAEG8a3+UPF=R2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

It's not necessary to fill the key field for most cases, since
hash_search has already done that for you. For developer that
using memset to zero the entry structure after enter it, fill the
key field is a must, but IMHO that is not good coding style, we
really should not touch the key field after insert it into the
dynahash.

This patch fixed some most abnormal ones, instead of refilling the
key field of primitive types, adding some assert might be a better
choice.

--
Regards
Junwang Zhao

Attachment Content-Type Size
0001-do-not-refill-the-hashkey-after-hash_search.patch application/octet-stream 4.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-09-13 06:52:39 Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows
Previous Message Michael Paquier 2023-09-13 06:37:39 Re: pg_upgrade and logical replication