Re: hio.c does visibilitymap_pin()/IO while holding buffer lock - Mailing list pgsql-hackers

From Andres Freund
Subject Re: hio.c does visibilitymap_pin()/IO while holding buffer lock
Date
Msg-id 20230402224024.aealekgu2df4cnhs@awork3.anarazel.de
Whole thread Raw
In response to Re: hio.c does visibilitymap_pin()/IO while holding buffer lock  (Andres Freund <andres@anarazel.de>)
Responses Re: hio.c does visibilitymap_pin()/IO while holding buffer lock  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
List pgsql-hackers
Hi,

On 2023-03-28 19:17:21 -0700, Andres Freund wrote:
> On 2023-03-28 18:21:02 -0700, Andres Freund wrote:
> > Here's a draft patch.
> 
> Attached is v2, with a stupid bug fixed and a bit of comment / pgindent
> polish.

I'd welcome some review (Tomas?), but otherwise I'm planning to push ahead
with this.

I'm still debating with myself whether this commit (or a prerequisite commit)
should move logic dealing with the buffer ordering into
GetVisibilityMapPins(), so we don't need two blocks like this:


        if (otherBuffer == InvalidBuffer || targetBlock <= otherBlock)
            GetVisibilityMapPins(relation, buffer, otherBuffer,
                                 targetBlock, otherBlock, vmbuffer,
                                 vmbuffer_other);
        else
            GetVisibilityMapPins(relation, otherBuffer, buffer,
                                 otherBlock, targetBlock, vmbuffer_other,
                                 vmbuffer);
...

        if (otherBuffer != InvalidBuffer)
        {
            if (GetVisibilityMapPins(relation, otherBuffer, buffer,
                                     otherBlock, targetBlock, vmbuffer_other,
                                     vmbuffer))
                unlockedTargetBuffer = true;
        }
        else
        {
            if (GetVisibilityMapPins(relation, buffer, InvalidBuffer,
                                     targetBlock, InvalidBlockNumber,
                                     vmbuffer, InvalidBuffer))
                unlockedTargetBuffer = true;
        }
    }


Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Joseph Koshakow
Date:
Subject: Re: Infinite Interval
Next
From: Peter Geoghegan
Date:
Subject: Re: Pass heaprel to GlobalVisTestFor() in vacuumRedirectAndPlaceholder()