| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Weird usages of sentinel_ok() |
| Date: | 2026-10-15 03:18:33 |
| Message-ID: | CAApHDvq7HyLWX27XCSf5BmijeObV-QUF6CCbKAW00LxFPc71Ag@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
In [1], Matthias is proposing to introduce a new system memory context
type that basically ties palloc directly to malloc. While reviewing
that patch, I noticed it copied a usage of sentinel_ok() that deviates
from the norm. Technically it's fine, as sentinel_ok()'s first
parameter is a void pointer, so passing the MemoryChunk rather than
what palloc() would return is fine, provided you add on the byte
difference to the MemoryChunk. I felt the need to mention the
weirdness during the review, and since people clearly copy a load of
code from an existing context type when adding new ones, it means that
pattern is going to be copied again when the next person adds a new
allocator.
I thought it might be good to adjust this at the source to prevent that.
Anyone disagree?
Patch attached.
David
[1] https://postgr.es/m/CAApHDvp_-zh5cdR_aNaUCXGHeddWC0b1a5kiJpC1cKdG0vx6DA@mail.gmail.com
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Adjust-weird-usages-of-sentinel_ok.patch | application/octet-stream | 2.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Bharath Rupireddy | 2026-10-15 03:15:47 | Re: Parallel autovacuum: honor reduced parallel workers after heap scan phase |