14.4.7 Doublewrite Buffer

The doublewrite buffer is a storage area located in the system tablespace where InnoDB writes pages that are flushed from the InnoDB buffer pool, before the pages are written to their proper positions in the data file. Only after flushing and writing pages to the doublewrite buffer, does InnoDB write pages to their proper positions. If there is an operating system, storage subsystem, or mysqld process crash in the middle of a page write, InnoDB can later find a good copy of the page from the doublewrite buffer during crash recovery.
doublewrite buffer是位于系统表空间中的存储区域, 其中 InnoDB 在将页写入数据文件中的适当位置之前, 先在 InnoDB 缓冲池中写入刷新的页,只有在刷新并将页面写入 doublewrite buffer后, InnoDB 才能将页面写入其适当位置。如果操作系统,存储子系统或mysqld进程在页面写入过程中崩溃,InnoDB稍后可以在崩溃恢复期间从doublewrite buffer中找到页面的一个很好的副本。

Although data is always written twice, the doublewrite buffer does not require twice as much I/O overhead or twice as many I/O operations. Data is written to the doublewrite buffer itself as a large sequential chunk, with a single fsync() call to the operating system.
虽然数据总是写两次,但doublewrite buffer并不需要两倍的I/O开销或者其他的两倍I/O操作,数据作为一个大的顺序块写入到doublewrite buffer本身,并对操作系统进行一次fsync()调用。
The doublewrite buffer is enabled by default in most cases. To disable the doublewrite buffer, set innodb_doublewrite to 0.
doublewrite buffer在大多数情况下都是默认开启的,可以通过设置innodb_doublewrite=0来关闭doublewrite buffer
If system tablespace files (“ibdata files”) are located on Fusion-io devices that support atomic writes, doublewrite buffering is automatically disabled and Fusion-io atomic writes are used for all data files. Because the doublewrite buffer setting is global, doublewrite buffering is also disabled for data files residing on non-Fusion-io hardware. This feature is only supported on Fusion-io hardware and is only enabled for Fusion-io NVMFS on Linux. To take full advantage of this feature, an innodb_flush_method setting of O_DIRECT is recommended
如果系统表空间文件(‘ibdata文件’)位于支持原子写的fusion-io设备,doublewrite buffering自动失效并且Fusion-io原子写会被用于所有数据文件。由于doublewrite buffer设置是全局性的,所以对于驻留在非Fusion-io硬件上的数据文件,也会禁用doublewrite buffering。,该特性仅支持Fusion-io硬件并且只能通过linux系统上的Fusion-io NVMFS启动,为了充分利用该特性,建议使用O_DIRECT的innodb_flush_method设置。

PREV: 14.4.6 InnoDB Data Dictionary https://blog.51cto.com/itzhoujun/2353190
NEXT: 14.4.8 Undo Logs. https://blog.51cto.com/itzhoujun/2353194

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章