Re: Internals question about buffers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Internals question about buffers
Date
Msg-id 11575.1023511676@sss.pgh.pa.us
Whole thread Raw
In response to Internals question about buffers  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Is there a race condition in ReadBufferInternal() ?

No.

As the comments in bufmgr.c point out, this is not bufmgr.c's problem:
* ReadBuffer -- returns a buffer containing the requested*        block of the requested relation.  If the blknum*
 requested is P_NEW, extend the relation file and*        allocate a new block.  (Caller is responsible for*
ensuringthat only one backend tries to extend a*        relation at the same time!)
 

In practice, the necessary locking is done by hio.c in the case of
heap relations:
*    Note that we use LockPage(rel, 0) to lock relation for extension.

and in the case of index relations the various index AMs have their own
approaches.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Schemas: status report, call for developers
Next
From: Tom Lane
Date:
Subject: Re: Schemas: status report, call for developers