Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Date: 2025-10-08 22:54:25
Message-ID: CAAKRu_bgkOQqu3K5n4YLRsNBZqJ9Rjg80ROqgKSr2UGz4b5hUg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 6, 2025 at 6:40 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> In attached v16, I’ve reverted to removing XLOG_HEAP2_VISIBLE
> entirely, rather than first removing each caller's heap page from the
> VM WAL chain. I reordered changes and squashed several refactoring
> patches to improve patch-by-patch readability. This should make the
> set read differently from earlier versions that removed
> XLOG_HEAP2_VISIBLE and had more step-by-step mechanical refactoring.
>
> I think if we plan to go all the way with removing XLOG_HEAP2_VISIBLE,
> having intermediate patches that just set PD_ALL_VISIBLE when making
> other heap pages are more confusing than helpful. Also, I think having
> separate flags for setting PD_ALL_VISIBLE in the WAL record
> over-complicated the code.

I decided to reorder the patches to remove XLOG_HEAP2_VISIBLE from
vacuum phase III before removing it from vacuum phase I because
removing it from phase III doesn't require preliminary refactoring
patches. I've done that in the attached v17.

I've also added an experimental patch on the end that refactors large
chunks of heap_page_prune_and_freeze() into helpers. I got some
feedback off-list that heap_page_prune_and_freeze() is too unwieldy
now. I'm not sure how I feel about them yet, so I haven't documented
them or moved them up in the patch set to before changes to
heap_page_prune_and_freeze().

0001: Eliminate XLOG_HEAP2_VISIBLE from COPY FREEZE
0002: Eliminate XLOG_HEAP2_VISIBLE from phase III of vacuum
0003 - 0006: cleanup and refactoring to prepare for 0007
0007: Eliminate XLOG_HEAP2_VISIBLE from vacuum prune/freeze
0008 - 0009: Remove XLOG_HEAP2_VISIBLE
0010 - 0012: refactoring to prepare for 0013
0013: Set VM on-access
0014: Set pd_prune_xid on insert
0015: Experimental refactoring of heap_page_prune_and_freeze into helpers

- Melanie

Attachment Content-Type Size
v17-0001-Eliminate-COPY-FREEZE-use-of-XLOG_HEAP2_VISIBLE.patch text/x-patch 12.0 KB
v17-0002-Eliminate-XLOG_HEAP2_VISIBLE-from-vacuum-phase-I.patch text/x-patch 24.9 KB
v17-0003-Assorted-trivial-heap_page_prune_and_freeze-clea.patch text/x-patch 15.6 KB
v17-0008-Eliminate-XLOG_HEAP2_VISIBLE-from-empty-page-vac.patch text/x-patch 2.5 KB
v17-0006-Make-heap_page_is_all_visible-independent-of-LVR.patch text/x-patch 6.6 KB
v17-0004-Add-helper-for-freeze-determination-to-heap_page.patch text/x-patch 7.0 KB
v17-0007-Eliminate-XLOG_HEAP2_VISIBLE-from-vacuum-prune-f.patch text/x-patch 40.7 KB
v17-0005-Update-PruneState.all_-visible-frozen-earlier-in.patch text/x-patch 14.8 KB
v17-0010-Rename-GlobalVisTestIsRemovableXid-to-GlobalVisX.patch text/x-patch 8.2 KB
v17-0011-Use-GlobalVisState-in-vacuum-to-determine-page-l.patch text/x-patch 10.4 KB
v17-0012-Inline-TransactionIdFollows-Precedes.patch text/x-patch 5.0 KB
v17-0013-Allow-on-access-pruning-to-set-pages-all-visible.patch text/x-patch 27.9 KB
v17-0009-Remove-XLOG_HEAP2_VISIBLE-entirely.patch text/x-patch 26.4 KB
v17-0014-Set-pd_prune_xid-on-insert.patch text/x-patch 6.7 KB
v17-0015-Split-heap_page_prune_and_freeze-into-helpers.patch text/x-patch 17.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-10-08 23:02:44 Re: Use streaming read I/O in BRIN vacuuming
Previous Message Masahiko Sawada 2025-10-08 22:43:53 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart