Обсуждение: Fix inconsistencies with code and beautify xlog structures description and fin hash_xlog.h

Поиск
Список
Период
Сортировка

Fix inconsistencies with code and beautify xlog structures description and fin hash_xlog.h

От
Kirill Reshke
Дата:
Hi hackers!

While doing some xlog-related task at my job I noticed inconsistency
between [0] & [1]. hash_xlog.h xl_hash_squeeze_page structure
description mismatches with actual code.
PFA fixing issue.

I also allowed myself to standardise description of
xl_hash_move_page_contents and xl_hash_init_bitmap_page, so
xl_hash_delete, xl_hash_init_bitmap_page and
xl_hash_move_page_contents describes their zeroth backup block akin to
each other.


[0]
https://git.postgresql.org/cgit/postgresql.git/tree/src/include/access/hash_xlog.h?id=567d27e8e2b752743626eb259ba75ecdc936eaf3#n147
[1]
https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/access/hash/hash_xlog.c?id=567d27e8e2b752743626eb259ba75ecdc936eaf3#n830

-- 
Best regards,
Kirill Reshke

Вложения
On Fri, 5 Sept 2025 at 11:17, I wrote:

> I also allowed myself to standardise description of
> xl_hash_move_page_contents and xl_hash_init_bitmap_page, so
> xl_hash_delete, xl_hash_init_bitmap_page and
> xl_hash_move_page_contents describes their zeroth backup block akin to
> each other.

Ahh... sorry for the noise, this part is wrong.
PFA v2


-- 
Best regards,
Kirill Reshke

Вложения


On Sep 5, 2025, at 14:24, Kirill Reshke <reshkekirill@gmail.com> wrote:
--
Best regards,
Kirill Reshke
<v2-0001-Fix-comments-in-xlog.h.patch>

LGTM. SlruRecentlyUsed() is now an inline function.

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






On Sep 5, 2025, at 16:29, Chao Li <li.evan.chao@gmail.com> wrote:



On Sep 5, 2025, at 14:24, Kirill Reshke <reshkekirill@gmail.com> wrote:
--
Best regards,
Kirill Reshke
<v2-0001-Fix-comments-in-xlog.h.patch>

LGTM. SlruRecentlyUsed() is now an inline function.


After pulling master, I just found this patch has been pushed.

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/





> On 5 Sep 2025, at 11:24, Kirill Reshke <reshkekirill@gmail.com> wrote:
>
> PFA v2

Proposed change is correct and in line with a description of e.g. XLOG_HASH_MOVE_PAGE_CONTENTS.
I'd note that block is for lock only and record does not include image, but other such cases are not reported in
comments.


Best regards, Andrey Borodin.


Re: Fix inconsistencies with code and beautify xlog structures description and fin hash_xlog.h

От
Michael Paquier
Дата:
On Wed, Sep 10, 2025 at 05:36:48PM +0500, Andrey Borodin wrote:
> Proposed change is correct and in line with a description of
> e.g. XLOG_HASH_MOVE_PAGE_CONTENTS.
> I'd note that block is for lock only and record does not include
> image, but other such cases are not reported in comments.

Right, the case of block 0 being registered in a MOVE_PAGE_CONTENTS
record to ensure that a cleanup lock is taken is documented in
_hash_squeezebucket()@hashovfl.c, for SQUEEZE_PAGE, or for DELETE.
Squeeze can also do that for buffer 1.

On top of your suggestions, I have double-checked the rest of the hash
records, and they seem to be in line with hash_xlog.h.  Will fix,
thanks.
--
Michael

Вложения