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

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