Update buf_init.cpp

This commit is contained in:
xxxsparkle 2023-10-04 21:00:32 +08:00
parent 4ad08cf542
commit de2cece442
1 changed files with 6 additions and 12 deletions

View File

@ -179,28 +179,22 @@ void InitBufferPool(void)
Size BufferShmemSize(void)
{
Size size = 0;
/* size of buffer descriptors */
/* 缓冲区描述符的大小*/
size = add_size(size, mul_size(TOTAL_BUFFER_NUM, sizeof(BufferDescPadded)));
size = add_size(size, PG_CACHE_LINE_SIZE);
/* size of data pages */
/* 数据页面的大小 */
size = add_size(size, mul_size(TOTAL_BUFFER_NUM, BLCKSZ));
#ifdef __aarch64__
size = add_size(size, PG_CACHE_LINE_SIZE);
#endif
/* size of stuff controlled by freelist.c */
/* 由freelist.c所控制的东西的大小 */
size = add_size(size, StrategyShmemSize());
/* size of checkpoint sort array in bufmgr.c */
/* 在bufmgr.c中的检查点排序数组的大小*/
size = add_size(size, mul_size(TOTAL_BUFFER_NUM, sizeof(CkptSortItem)));
/* size of candidate buffers */
/* 候选缓冲区的大小 */
size = add_size(size, mul_size(TOTAL_BUFFER_NUM, sizeof(Buffer)));
/* size of candidate free map */
/* 候选自由映射的大小 */
size = add_size(size, mul_size(TOTAL_BUFFER_NUM, sizeof(bool)));
return size;
}