Re: Race conditions, race conditions!

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Race conditions, race conditions!
Date: 2005-08-12 23:14:01
Message-ID: 200508122314.j7CNE1o21380@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Patch applied. Thanks.
> > * block is not currently in memory.
> > */
> > bufHdr = BufferAlloc(reln, blockNum, &found);
> > + /* we are guaranted that nobody else has touched this will-be-new block */
> > + Assert(!(found && isExtend));
> > if (found)
> > BufferHitCount++;
> > }
>
> This patch is utterly wrong. Please revert it.
>
> The case it is Asserting can't happen is explained in the comment a
> couple dozen lines further down:
>
> * try to extend a relation
> * read smgrnblocks to find the current relation length
> * allocate an empty buffer for the N+1'st page of the rel
> * call smgrextend
> * smgrextend fails for some reason (eg, no space left on disk)
> * buffer remains present, but is not BM_VALID
> * awhile later, try to extend relation again
> * read smgrnblocks to find the current relation length
> * allocate a buffer for the N+1'st page of the rel
>
> This is entirely likely to find the same non-BM_VALID buffer that was
> assigned in the first iteration.

Reverted.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2005-08-13 01:34:06 Re: DROP OWNED BY
Previous Message Alvaro Herrera 2005-08-12 22:57:34 Re: [HACKERS] Autovacuum loose ends