|
typedef SlruCtlData *SlruCtl;
/*
* Shared-memorystate
*/
typedef struct SlruSharedData
{
LWLockId ControlLock;
/* Number of buffers managed by this SLRU structure */
int num_slots;
/*
* Arrays holding info for each bufferslot. Page number is undefined
* when status is EMPTY, as is page_lru_count.
*/
char **page_buffer;
SlruPageStatus*page_status;
bool *page_dirty;
int *page_number;
int *page_lru_count;
LWLockId *buffer_locks;
/*----------
* We mark a page "most recentlyused" by setting
* page_lru_count[slotno]= ++cur_lru_count;
* The oldest page is therefore the one withthe highest value of
* cur_lru_count- page_lru_count[slotno]
* The counts will eventually wrap around, butthis calculation still
* works as long as no page's age exceedsINT_MAX counts.
*----------
*/
int cur_lru_count;
/*
* latest_page_number is the page number of thecurrent end of the log;
* this is not critical data, since we use itonly to avoid swapping out
* the latest page.
*/
int latest_page_number;
} SlruSharedData;
typedef SlruSharedData *SlruShared;
下面看看初始化完"CLOG Ctl"相关结构后在内存中的结构图
初始化完clog的内 存结构图
为了精简上图,把创建shmem的哈希表索引"ShmemIndex"时创建的HCTL结构删掉了,这个结构的作用是记录创建可扩展哈希表的相关信息。增加了左边灰色底的部分,描述共享内存/shmem里各变量物理布局概览,由下往上,由低地址到高地址。其中的"CLOG Ctl"即clog的相关结构图下面分别给出,要不上面的图太大太复杂了。

CLOG相关结构图
|