innodb_fast_shutdown中值为1或者2的区别是?

innodb_fast_shutdown=0 , 1 , 2时的意思分别是

0

把buffer pool中的脏页刷到磁盘和合并insert buffer,当然包括redo log也会写到磁盘中。

2

只把redo log刷到磁盘中,然后关闭

1

关于1,它解释说,是先暂时略过一些flush操作,但没有具体说忽略哪些操作。manual中也没有详细说明,

The default shutdown procedure for InnoDB, based on the configuration setting innodb_fast_shutdown=1. To save time, certain flush operations are skipped. This type of shutdown is safe during normal usage, because the flush operations are performed during the next startup, using the same mechanism as in crash recovery. In cases where the database is being shut down for an upgrade or downgrade, do a slow shutdown instead to ensure that all relevant changes are applied to the data files during the shutdown.

所以我不是很明白2和1的区别, 为了找到答案,只能看代码了。最后发现这个函数

buf_flush_page_cleaner_thread,其中就描述了内部细微的区别。 因为涉及到具体的实现,我就没看了。

好吧,有时间再看。

MySQL限时解答,24小时内友哥专业解答
http://www.yougemysqldba.com
如有进一步需要请联系微信onesoft007
微博账号@友哥一指
原文地址:https://www.cnblogs.com/youge-OneSQL/p/4464459.html