Re: Race conditions, race conditions!

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Race conditions, race conditions!
Дата
Msg-id 200508122141.j7CLf6R27676@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Race conditions, race conditions!  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Ответы Re: Race conditions, race conditions!  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Patch applied.  Thanks.

---------------------------------------------------------------------------


Qingqing Zhou wrote:
>
> "Tom Lane" <tgl@sss.pgh.pa.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
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/storage/buffer/bufmgr.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v
retrieving revision 1.193
diff -c -c -r1.193 bufmgr.c
*** src/backend/storage/buffer/bufmgr.c    12 Aug 2005 05:05:50 -0000    1.193
--- src/backend/storage/buffer/bufmgr.c    12 Aug 2005 21:40:41 -0000
***************
*** 153,158 ****
--- 153,160 ----
           * 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++;
      }

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PL/Perl list value return causes segfault
Следующее
От: Alvaro Herrera
Дата:
Сообщение: DROP OWNED BY