Re: type cache cleanup improvements

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: type cache cleanup improvements
Date: 2024-03-08 15:31:45
Message-ID: CAJ7c6TP3-bnL5J+fm3-zmXK9WrHxhtQQYdZeFFpba0Eh3j+atg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> > I would like to tweak the patch a little bit - change some comments,
> > add some Asserts, etc. Don't you mind?
> You are welcome!

Thanks. PFA the updated patch with some tweaks by me. I added the
commit message as well.

One thing that I couldn't immediately figure out is why 0 hash value
is treated as a magic invalid value in TypeCacheTypCallback():

```
- hash_seq_init(&status, TypeCacheHash);
+ if (hashvalue == 0)
+ hash_seq_init(&status, TypeCacheHash);
+ else
+ hash_seq_init_with_hash_value(&status, TypeCacheHash,
hashvalue);
```

Is there anything that prevents the actual hash value from being zero?
I don't think so, but maybe I missed something.

If zero is indeed an invalid hash value I would like to reference the
corresponding code. If zero is a correct hash value we should either
change this by adding something like `if(!hash) hash++` or use an
additional boolean argument here.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v3-0001-Improve-performance-of-type-cache-cleanup.patch application/octet-stream 16.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-03-08 15:35:39 Re: type cache cleanup improvements
Previous Message Tom Lane 2024-03-08 15:24:48 Re: Call perror on popen failure