Re: Separate HEAP WAL replay logic into its own file

From: "Li, Yong" <yoli(at)ebay(dot)com>
To: Sutou Kouhei <kou(at)clear-code(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, "Debnath, Shawn" <sdn(at)ebay(dot)com>, "Shyrabokau, Anton" <antons(at)ebay(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Separate HEAP WAL replay logic into its own file
Date: 2024-07-26 07:56:12
Message-ID: 599E67D2-2929-4858-B8BC-F9C4AE889BF6@ebay.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jul 23, 2024, at 09:54, Sutou Kouhei <kou(at)clear-code(dot)com> wrote:
>
>
> Here are my comments for your patch:
>
> 1. Could you create your patch by "git format-patch -vN master"
> or something? If you create your patch by "git format-patch",
> we can apply your patch by "git am XXX.patch".
>

Thanks for your review. I’ve updated the patch to follow your
suggested format.

>
> 3. Could you remove '#include "access/heapam_xlog.h"' from
> heapam.c because it's needless now.
>
> BTW, it seems that we can remove more includes from
> heapam.c:
>
> 4. Could you remove needless includes from heapam_xlog.c? It
> seems that we can remove the following includes:

I have removed the redundant includes in the latest patch.

>
> 5. There are still WAL related codes in heapam.c:
>
> 4.1. log_heap_update()
> 4.2. log_heap_new_cid()
> 4.3. if (RelationNeedsWAL()) {...} in heap_insert()
> 4.4. if (needwal) {...} in heap_multi_insert()
> 4.5. if (RelationNeedsWAL()) {...} in heap_delete()
> 4.6. if (RelationNeedsWAL()) {...}s in heap_update()
> 4.7. if (RelationNeedsWAL()) {...} in heap_lock_tuple()
> 4.8. if (RelationNeedsWAL()) {...} in heap_lock_updated_tuple_rec()
> 4.9. if (RelationNeedsWAL()) {...} in heap_finish_speculative()
> 4.10. if (RelationNeedsWAL()) {...} in heap_abort_speculative()
> 4.11. if (RelationNeedsWAL()) {...} in heap_inplace_update()
> 4.12. log_heap_visible()
>
> Should we move them to head_xlog.c too?
>
> If we should do it, separated commits will be easy to
> review. For example, the 0001 patch moves existing codes
> to head_xlog.c as-is. The 0002 patch extracts WAL related
> codes in heap_insert() to heap_xlog.c and so on.
>
>
> Thanks,
> --
> kou

I followed the convention of most access methods. The “xlog”
file includes the WAL replay logic only. The logic that generates
the log records themselves stays with the code that performs
the changes. Take nbtree as an example, you can also find
WAL generating code in several _bt_insertxxx() functions inside
the nbtinsert.c file.

Please help review the updated file again. Thanks in advance!

Yong

Attachment Content-Type Size
v2-0001-heapam_refactor.patch application/octet-stream 81.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-07-26 08:07:54 RE: [Proposal] Add foreign-server health checks infrastructure
Previous Message Richard Guo 2024-07-26 07:56:08 Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan