Skip site navigation (1) Skip section navigation (2)

Re: Race conditions, race conditions!

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Race conditions, race conditions!
Date: 2005-07-29 03:20:29
Message-ID: dcc7ee$7uj$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-hackers
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes
>
> WARNING:  relation "t1" page 196 is uninitialized --- fixing
> TRAP: FailedAssertion("!((((PageHeader) ((PageHeader)
pageHeader))->pd_upper == 0))", File: "hio.c", Line: 263)
> LOG:  server process (PID 11296) was terminated by signal 6
>

Inspired by this, can we put an asseration here:

---
  /*
   * lookup the buffer.  IO_IN_PROGRESS is set if the requested
   * 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++;
---

BufferAlloc() consists of two parts, one is looking for the blockNum, the
other is allocating a free buffer. If the asseration is good, then for
"isExtend", we just need the second part. This could bring marginal
performance benefits.


Regards,
Qingqing



In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2005-07-29 03:23:55
Subject: Re: [HACKERS] O_DIRECT for WAL writes
Previous:From: Michael FuhrDate: 2005-07-29 03:12:15
Subject: Information Schema DBMS VERSION wrong

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group