From: | Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> |
---|---|
To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | [PATCH] Improve treatment of page special and page header alignment during page init. |
Date: | 2021-04-07 12:02:18 |
Message-ID: | CALT9ZEFFq2-n5Lmfg59L6Hm3ZrgCexyhR9eqme7v1jodtXGg1A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I was looking at changes in Sp-Gist by
commit 4c0239cb7a7775e3183cb575e62703d71bf3302d
(discussion
https://postgr.es/m/CALj2ACViOo2qyaPT7krWm4LRyRTw9kOXt+g6PfNmYuGA=YHj9A@mail.gmail.com
) and realized that during PageInit, both page header and page special are
expected to be maxaligned but in reality, their treatment is quite
different:
1. page special size is silently enforced to be maxaligned by PageInit()
even if caller-specified specialSize is not of a maxalign'ed size.
2. page header size alignment is not checked at all (but we expect it
maxalign'ed, yes).
I'd propose do both things in the same way: just Assert both sizes are
maxalign'ed during page init.
I dived further and it appears that the only caller, who provides not
properly aligned page special is fill_seq_with_data() and corrected it.
I am really convinced, that _callers_ should care about proper special
size. So now PageInit() just checks the right lengths of page special and
page header with assert, not enforcing size change silently. PFA my small
patch on this. I'd propose it to commit if in the HEAD only likewise the
commit 4c0239cb7a7775e3183cb575e62703d71bf3302d.
What do you think?
--
Best regards,
Pavel Borisov
Postgres Professional: http://postgrespro.com <http://www.postgrespro.com>
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Ensure-same-treatment-of-page-header-and-page-spe.patch | application/octet-stream | 2.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Borisov | 2021-04-07 12:08:51 | Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit? |
Previous Message | Magnus Hagander | 2021-04-07 12:01:42 | Re: hba.c:3160:18: warning: comparison of unsigned enum expression |