Re: [HACKERS] Anyone understand shared buffer refcount mechanism? - Mailing list pgsql-hackers

From Vadim Mikheev
Subject Re: [HACKERS] Anyone understand shared buffer refcount mechanism?
Date
Msg-id 37E59458.64D563D@krs.ru
Whole thread Raw
In response to Anyone understand shared buffer refcount mechanism?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Anyone understand shared buffer refcount mechanism?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 
> In trying to understand what the code is doing, I am confused by the
> buffer refcount save/restore mechanism.  Why does the executor want
> to save/restore buffer refcounts?  I can sort of see that that might

...

> If anyone understands why this mechanism is designed this way,
> please tell me about it.

This bothered me for long time too.
The only explanation I see in execMain.c:

/** reset buffer refcount.  the current refcounts are saved and will be* restored when ExecutorEnd is called** this
makessure that when ExecutorRun's are called recursively as for* postquel functions, the buffers pinned by one
ExecutorRunwill not* be unpinned by another ExecutorRun.*/
 

But buffers pinned by one Executor invocation SHOULDN'T
be unpinned by another one (if there are no bugs in code,
but this is another story).

So, try to remove this save/restore mechanism and let's see...

Vadim


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] Why do we need pg_vlock?
Next
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] couldn't rollback cache ?