Re: hio.c does visibilitymap_pin()/IO while holding buffer lock
От | Andres Freund |
---|---|
Тема | Re: hio.c does visibilitymap_pin()/IO while holding buffer lock |
Дата | |
Msg-id | 20230403190030.fk2frxv6faklrseb@awork3.anarazel.de обсуждение исходный текст |
Ответ на | Re: hio.c does visibilitymap_pin()/IO while holding buffer lock (Tomas Vondra <tomas.vondra@enterprisedb.com>) |
Ответы |
Re: hio.c does visibilitymap_pin()/IO while holding buffer lock
|
Список | pgsql-hackers |
Hi, On 2023-04-03 14:25:59 +0200, Tomas Vondra wrote: > On 4/3/23 00:40, Andres Freund wrote: > > 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 guess the 0001 part was already pushed, so I should be looking only at > 0002, correct? Yes. > I think 0002 makes RelationGetBufferForTuple() harder to understand. I'm > not saying it's incorrect, but I find it hard to reason about the new > combinations of conditions :-( > I mean, it only had this condition: > > if (otherBuffer != InvalidBuffer) > { > ... > } > > but now it have > > if (unlockedTargetBuffer) > { > ... > } > else if (otherBuffer != InvalidBuffer) > { > ... > } > > if (unlockedTargetBuffer || otherBuffer != InvalidBuffer) > { > ... > } > > Not sure how to improve that :-/ but not exactly trivial to figure out > what's going to happen. It's not great, I agree. I tried to make it easier to read in this version by a) changing GetVisibilityMapPins() as I proposed b) added a new variable "recheckVmPins", that gets set in if (unlockedTargetBuffer) and if (otherBuffer != InvalidBuffer) c) reformulated comments > Maybe this > > * If we unlocked the target buffer above, it's unlikely, but possible, > * that another backend used space on this page. > > might say what we're going to do in this case. I mean - I understand > some backend may use space in unlocked page, but what does that mean for > this code? What is it going to do? (The same comment talks about the > next condition in much more detail, for example.) There's a comment about that detail further below. But you're right, it wasn't clear as-is. How about now? > Also, isn't it a bit strange the free space check now happens outside > any if condition? It used to happen in the > > if (otherBuffer != InvalidBuffer) > { > ... > } > > block, but now it happens outside. Well, the alternative is to repeat it in the two branches, which doesn't seem great either. Particularly because there'll be a third branch after the bulk extension patch. Greetings, Andres Freund
Вложения
В списке pgsql-hackers по дате отправления: