Re: lazy_scan_heap() forgets to mark buffer dirty when setting all frozen?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: Re: lazy_scan_heap() forgets to mark buffer dirty when setting all frozen?
Date: 2019-04-08 04:55:37
Message-ID: 20190408045537.n2fsximxg6njh3yq@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-04-08 00:48:20 -0400, Alvaro Herrera wrote:
> On 2019-Apr-07, Andres Freund wrote:
>
> > lazy_scan_heap() contains the following block:
> >
> > /*
> > * If the all-visible page is turned out to be all-frozen but not
> > * marked, we should so mark it. Note that all_frozen is only valid
> > * if all_visible is true, so we must check both.
> > */
> > else if (all_visible_according_to_vm && all_visible && all_frozen &&
> > !VM_ALL_FROZEN(onerel, blkno, &vmbuffer))
> > {
> > /*
> > * We can pass InvalidTransactionId as the cutoff XID here,
> > * because setting the all-frozen bit doesn't cause recovery
> > * conflicts.
> > */
> > visibilitymap_set(onerel, blkno, buf, InvalidXLogRecPtr,
> > vmbuffer, InvalidTransactionId,
> > VISIBILITYMAP_ALL_FROZEN);
> > }
> >
> > but I'm afraid that's not quite enough.
>
> Apparently the initial commit a892234f830e had MarkBufferDirty, but it
> was removed one week later by 77a1d1e79892.

Good catch. Kinda looks like it could have been an accidental removal?
Robert?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-04-08 05:21:11 Re: Ordered Partitioned Table Scans
Previous Message Alvaro Herrera 2019-04-08 04:51:50 Re: reloption to prevent VACUUM from truncating empty pages at the end of relation