Re: where are the getting buf data from disk really done?

Поиск
Список
Период
Сортировка
Искать
От
Greg Smith
Тема
Re: where are the getting buf data from disk really done?
Дата
Msg-id
4BCD0C28.2010102@2ndquadrant.com
Ответ на
Список
Дерево обсуждения
Re: where are the getting buf data from disk really done? Tom Lane <tgl@sss.pgh.pa.us>
sunpeng wrote:
>
> I noticed at the function StartBufferIO() in bufmgr.c, there is no 
> really getting buffer data from disk, only set InProgressBuf = buf; 
> and return true;
> i wondered where is the getting buf data from disk really done?
> are there a background process to do this work? which function does 
> this work?

That's done by ReadBuffer_common in that same bit of source code.  The 
call to smgrread is the one that does the read from disk.  StartBufferIO 
is actually part of the buffer allocation code, used to lock things so 
that only one backend tries to read in a buffer that more than one might 
want.  Some highlights of the main code path here:

ReadBuffer | ReadBufferExtended | ReadBufferWithoutRelcache
  ReadBuffer_common
    BufferAlloc
      StrategyGetBuffer
      StartBufferIO
    smgrread

There is no background process involved at any point here.  The only 
background process related to the buffer cache in the current PostgreSQL 
implementation alternates between writing out checkpoint data and 
writing dirty buffers that haven't been used recently, in hopes of 
speeding up the BufferAlloc section here.  Everything else is done 
directly by the client backends.

-- 
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us

В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
От: John R Pierce
Дата:
Сообщение: Re: Int64GetDatum
FAQ