摘要: BDB中 内存池是用一个 hash table来管理 buffers. 这个hash table的大小首先是和 内存池的大小成正比. 其次, bdb code会经常遍历hash chain, 它的长度 不能太大. 计算公式为: cache 大小/region数目 = 每个region的大小 buck 阅读全文
posted @ 2016-02-26 22:43 brayden 阅读(471) 评论(0) 推荐(0) 编辑
摘要: 一个典型的 buddy system. 代码在env/env_alloc.c 数据结构: ALLOC_LAYOUT: 管理整块内存(即bdb的某个region)的 数据结构. 放于此内存 开头位置. SH_TAILQ_HEAD(__addrq) addrq; // address queue. 按地 阅读全文
posted @ 2016-02-26 17:44 brayden 阅读(692) 评论(0) 推荐(0) 编辑
摘要: 下面的代码保证了BDB 的write ahead logging机制. 在写database page之前, 确保此page buffer对应的log lsn已经 sync到 disk上. //src/mp/mp_bh.c, __memp_pgwrite() /* * If the page is 阅读全文
posted @ 2016-02-26 14:11 brayden 阅读(370) 评论(0) 推荐(0) 编辑