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

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(at)vondra(dot)me>, David Rowley <dgrowleyml(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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: 2026-09-21 16:18:41
Message-ID: CAAKRu_aXuDQxVLFz__=M=YLOFJE=YMVkf9zb6QrtQ6bFx66xdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review.

On Mon, Sep 21, 2026 at 4:37 AM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> On Fri, Sep 18, 2026, Melanie Plageman wrote:
> > Pruning and freezing
> > always required a cleanup lock in recovery
>
> Could 0002 use just do_prune instead of do_prune || do_freeze?
> The comment for XLHP_CLEANUP_LOCK allows freezing under an ordinary
> exclusive lock. Before pruning and freezing shared a WAL record,
> freeze-only replay in heap_xlog_freeze_page() used normal exclusive
> lock IIUC.
>
> With 0002 I observe VACUUM FREEZE on a page containing only live
> tuples to terminate a standby cursor holding a pin. Using just do_prune
> lets replay finish without canceling the cursor.

Good point. I see this brought up also in [1]

> 0001, 0003 and 0004 look good to me. I tried 0003/0004 with a manual
> primary/standby test, but found nothing interesting.

I've tightened up the commit messages in the latest version and
changed 0002 as you suggested. I'll commit 0001-0003 after beta4 is
tagged tomorrow. 0004 I'm going to think about just a bit longer (and
would be master only).

- Melanie

[1] https://www.postgresql.org/message-id/CAHg%2BQDf3NcB3vOAqQ5EFcV5DYYUZ9snCSJAU-x1JDbtcjK3eBQ%40mail.gmail.com

Attachment Content-Type Size
v2-0001-Assert-correct-VM-page-passed-to-pruning.patch text/x-patch 1.8 KB
v2-0002-Avoid-replay-cleanup-locks-for-freeze-only-and-VM.patch text/x-patch 2.1 KB
v2-0003-Correct-on-access-VM-setting-heuristic.patch text/x-patch 11.4 KB
v2-0004-Retain-newest-live-xid-as-prune-hint-after-visibi.patch text/x-patch 2.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-09-21 16:20:00 Re: Add a hook for handling logical decoding messages on subscribers.
Previous Message Jacob Champion 2026-09-21 16:01:46 Re: [PATCH] Explain what the default output_plugin_libraries do