PostgreSQL中ReadBuffer_common函數
數據結構
BufferDesc
共享緩沖區的共享描述符(狀態)數據
typedef struct BufferDesc
{//buffer tagBufferTag tag; /* ID of page contained in buffer *///buffer索引編號(0開始)int buf_id; /* buffer's index number (from 0) *//* state of the tag, containing flags, refcount and usagecount *///tag狀態,包括flags/refcount和usagecountpg_atomic_uint32 state;//pin-count等待進程IDint wait_backend_pid; /* backend PID of pin-count waiter *///空閑鏈表鏈中下一個空閑的bufferint freeNext; /* link in freelist chain *///緩沖區內容鎖LWLock content_lock; /* to lock access to buffer contents */
} BufferDesc;
BufferTag
Buffer tag標記了buffer存儲的是磁盤中哪個block
typedef struct buftag
{//物理relation標識符RelFileNode rnode; /* physical relation identifier */ForkNu