From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c) |
Date: | 2022-08-11 11:15:16 |
Message-ID: | CAEudQAr7-dVTXhFeAQRA9waUWSbe=23mZE0wt3V=DFGp1MF3GQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em qui., 11 de ago. de 2022 às 07:38, Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)com> escreveu:
> On 01.08.22 19:08, Ranier Vilela wrote:
> > Like how
> >
> https://github.com/postgres/postgres/commit/9fd45870c1436b477264c0c82eb195df52bc0919
> > <
> https://github.com/postgres/postgres/commit/9fd45870c1436b477264c0c82eb195df52bc0919
> >
> > New attempt to remove more MemSet calls, that are safe.
> >
> > Attached v3 patch.
>
> Note that struct initialization does not set padding bits.
According to:
https://interrupt.memfault.com/blog/c-struct-padding-initialization
2. individually set all members to 0:
struct foo a = {
.i = 0,
.b = 0,};
Suffer from this problem.
3. use { 0 } zero-initializer, not.
So any
> struct that is used as a hash key or that goes to disk or something
> similar needs to be set with memset/MemSet instead. Various places in
> the code make explicit comments about that, which your patch deletes,
> which is a mistake. This patch needs to be adjusted carefully with this
> in mind before it can be considered.
>
I think this needs better comprovation?
regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2022-08-11 11:49:04 | Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c) |
Previous Message | Amit Kapila | 2022-08-11 11:04:21 | Re: Allow logical replication to copy tables in binary format |