Innodb的三把刀之一的DW

来源:这里教程网 时间:2026-03-01 16:50:36 作者:

The  innodb_doublewrite variable controls whether the doublewrite buffer is enabled. It is enabled by default in most cases. To disable the doublewrite buffer, set  innodb_doublewrite to  OFF. Consider disabling the doublewrite buffer if you are more concerned with performance than data integrity, as may be the case when performing benchmarks, for example.

From MySQL 8.0.30,  innodb_doublewrite supports  DETECT_AND_RECOVER and  DETECT_ONLY settings.

The  DETECT_AND_RECOVER setting is the same as the  ON setting. With this setting, the doublewrite buffer is fully enabled, with database page content written to the doublewrite buffer where it is accessed during recovery to fix incomplete page writes.

With the  DETECT_ONLY setting, only metadata is written to the doublewrite buffer. Database page content is not written to the doublewrite buffer, and recovery does not use the doublewrite buffer to fix incomplete page writes. This lightweight setting is intended for detecting incomplete page writes only.

MySQL 8.0.30 onwards supports dynamic changes to the  innodb_doublewrite setting that enables the doublewrite buffer, between  ON,  DETECT_AND_RECOVER, and  DETECT_ONLY. MySQL does not support dynamic changes between a setting that enables the doublewrite buffer and  OFF or vice versa.

If the doublewrite buffer is located on a Fusion-io device that supports atomic writes, the doublewrite buffer is automatically disabled and data file writes are performed using Fusion-io atomic writes instead. However, be aware that the  innodb_doublewrite setting is global. When the doublewrite buffer is disabled, it is disabled for all data files including those that do not reside on 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.8.0.30之后,支持   DETECT_AND_RECOVER  and  DETECT_ONLY设置,前者和on设置一样。 后者表示只记录元数据信息到DW中,只是用来发现不完整的页。 Fusion-io设备支持原子写,DW会自动关闭。只是在Fusion-io硬件上并且只会在Linux的Fusion-io NVMES上开启

相关推荐