设为首页 加入收藏

TOP

PostgreSQL启动过程中的那些事七:初始化共享内存和信号三:shmem中初始化clog(二)
2014-11-24 00:59:50 来源: 作者: 【 】 浏览:13
Tags:PostgreSQL 启动 过程 那些 初始 共享 内存 信号 shmem clog

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相关结构图

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇PostgreSQL启动过程中的那些事七.. 下一篇PostgreSQL启动过程中的那些事七..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: