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