doublewrite buffer

http://www.mysqlperformanceblog.com/2006/08/04/innodb-double-write/

 

 

/** Doublewrite control struct */ struct trx_doublewrite_struct{ mutex_t mutex; /*!< mutex protecting the first_free field and write_buf */ ulint block1; /*!< the page number of the first doublewrite block (64 pages) */ ulint block2; /*!< page number of the second block */ ulint first_free; /*!< first free position in write_buf measured in units of UNIV_PAGE_SIZE */ byte* write_buf; /*!< write buffer used in writing to the doublewrite buffer, aligned to an address divisible by UNIV_PAGE_SIZE (which is required by Windows aio) */ byte* write_buf_unaligned; /*!< pointer to write_buf, but unaligned */ buf_page_t** buf_block_arr; /*!< array to store pointers to the buffer blocks which have been cached to write_buf */ }; /** File space extent size (one megabyte) in pages */ #define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT)) /** Size of the doublewrite block in pages */ #define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE trx_doublewrite->write_buf_unaligned = ut_malloc( (1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE); //内存里面,doublewrite buffer是占用了128个页面,2M大小,block1和block2分别指向一个extent, 1M

 

 doublewrite buffer不是在内存中的,是在硬盘中分配了一块连续的空间,

在启动的过程中,会把那128个页面和物理文件中的比较一下,如果不同,就覆盖

 

你可能感兴趣的:(windows,struct,File,buffer,Pointers)