Re: type cache cleanup improvements - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: type cache cleanup improvements
Date
Msg-id CAJ7c6TP3-bnL5J+fm3-zmXK9WrHxhtQQYdZeFFpba0Eh3j+atg@mail.gmail.com
Whole thread Raw
In response to Re: type cache cleanup improvements  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: type cache cleanup improvements
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Call perror on popen failure
Next
From: Tom Lane
Date:
Subject: Re: type cache cleanup improvements