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
g...@2ndquadrant.com   www.2ndQuadrant.us


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to