Re: Internals question about buffers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: nield(at)usol(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Internals question about buffers
Date: 2002-06-08 04:47:56
Message-ID: 11575.1023511676@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
* ensuring that 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-06-08 04:53:29 Re: [HACKERS] Schemas: status report, call for developers
Previous Message Bruce Momjian 2002-06-08 04:42:20 Re: [HACKERS] Schemas: status report, call for developers