Access to a block of data proceeds (roughly) as follows:
// pageID set from pg_catalog tables// buffer obtained from Buffer pool
getBlock(BufferTag pageID, Buffer buf)
{
File fid; off_t offset; int fd;
(fid, offset) = findBlock(pageID)
fd = VfdCache[fid].fd;
lseek(fd, offset, SEEK_SET)
VfdCache[fid].seekPos = offset;
nread = read(fd, buf, BLOCKSIZE)
if (nread < BLOCKSIZE) ... we have a problem
}
BLOCKSIZE is a global configurable constant (default: 8192)