MySQL :: MySQL 8.0 Reference Manual :: 17.6.4 Doublewrite Buffer (original) (raw)

17.6.4 Doublewrite Buffer

The doublewrite buffer is a storage area whereInnoDB writes pages flushed from the buffer pool before writing the pages to their proper positions in theInnoDB data files. If there is an operating system, storage subsystem, or unexpected mysqld process exit in the middle of a page write,InnoDB can find a good copy of the page from the doublewrite buffer during crash recovery.

Although data is 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 in a large sequential chunk, with a single fsync() call to the operating system (except in the case thatinnodb_flush_method is set toO_DIRECT_NO_FSYNC).

Prior to MySQL 8.0.20, the doublewrite buffer storage area is located in the InnoDB system tablespace. As of MySQL 8.0.20, the doublewrite buffer storage area is located in doublewrite files.

The following variables are provided for doublewrite buffer configuration:

#ib_16384_0.dblwr  
#ib_16384_1.dblwr  

The innodb_doublewrite_files variable is intended for advanced performance tuning. The default setting should be suitable for most users.

As of MySQL 8.0.23, InnoDB automatically encrypts doublewrite file pages that belong to encrypted tablespaces (see Section 17.13, “InnoDB Data-at-Rest Encryption”). Likewise, doublewrite file pages belonging to page-compressed tablespaces are compressed. As a result, doublewrite files can contain different page types including unencrypted and uncompressed pages, encrypted pages, compressed pages, and pages that are both encrypted and compressed.