因为InnoDB是一个复杂的存储引擎,因此必须正确配置才能最好地执行。 标准InnoDB中的这些点不能配置。 此功能的目标是为XtraDB提供更详尽的选项。
Version Specific Information
• 5.7.10-1
– 功能从Percona Server 5.6移植
系统变量
variable innodb_use_global_flush_log_at_trx_commit
Command Line Yes
Config File Yes
Scope Global
Dynamic Yes
Type Boolean
Default Value True
Range True/False
改变量使用方式参考MySQL innodb_flush_log_at_trx_commit 变量.
如果innodb_use_global_flush_log_at_trx_commit 设置为0(False),客户端可以设置全局MySQL变量,使用:
SET innodb_use_global_flush_log_at_trx_commit=N
如果innodb_use_global_flush_log_at_trx_commit 设置为1(True), innodb_use_global_flush_log_at_trx_commit可以在用户会话级别设置,并不能重置全局变量。
variable innodb_flush_method
Version Info
• 5.7.10-3 - Ported from Percona Server 5.6
Command Line Yes
Config File Yes
Scope Global
Dyn No
Variable Type Enumeration
Default Value fdatasync
Allowed Values fdatasync, O_DSYNC, O_DIRECT, O_DIRECT_NO_FSYNC,ALL_O_DIRECT
这个变量已经在MySQL 5.7系统变量中,有新的允许值ALL_O_DIRECT。它确定InnoDB用于刷新其数据和日志文件的方法。(参考MySQL5.7 手册innodb_flush_method )
允许以下值:
fdatasync: 使用fsync() 来刷新数据,日志和并行doublewrite文件。
O_SYNC: 使用O_SYNC 来打开并且刷新日志和并发doublewrite文件;使用fsync()来刷新日志文件。不使用fsync()来刷新并发doublewrite文件。
O_DIRECT: 使用O_DIRECT来打开数据文件并且fsync() system call to flush data, log, and parallel doublewrite files。
O_DIRECT_NO_FSYNC: 使用O_DIRECT来打开数据文件,但不使用fsync() 系统调用flush data,log,和parallel doublewrite files。
ALL_O_DIRECT: 使用 O_DIRECT来打开数据和日志文件,并且使用fsync()来刷新数据文件。当InnoDB日志文件大(超过8GB)时,建议使用此选项,否则可能会降低性能。注意:在ext4文件系统变量上使用此选项时,应将innodb_log_write_ahead_size设置为4096(ext4中的默认日志块大小),以避免未对齐的AIO / DIO警告。
Status Variables
以下信息已添加到SHOW ENGINE INNODB STATUS中以确认检查点活动:
The max checkpoint age
The current checkpoint age target
The current age of the oldest page modification which has not been flushed to disk
˓→yet.
The current age of the last checkpoint
…
LOG
Log sequence number 0 1059494372
Log flushed up to 0 1059494372
Last checkpoint at 0 1055251010
Max checkpoint age 162361775
Checkpoint age target 104630090
Modified age 4092465
Checkpoint age 4243362
0 pending log writes, 0 pending chkp writes
…