Bug #45547 Bug&Feature request: Make innodb_fast_shutdown=2 default on Windows
Submitted: 17 Jun 2009 5:26 Modified: 17 Jun 2009 9:20
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Windows Severity:S2 (Serious)
Version: OS:Windows
Assigned to: CPU Architecture:Any

[17 Jun 2009 5:26] Roel Van de Paar
Description:
o Windows only waits 20 seconds for a service to terminate (WaitToKillServiceTimeout in registry).
o InnoDB shutdown may take longer

So, theoretically InnoDB may not be fully shutdown by the time mysqld is killed by the OS, especially on slower machines.

How to repeat:
Should be able to produce it on a slower/busy machine running a busy mysql server with lots of InnoDB use.

Suggested fix:
It may be better to set innodb_fast_shutdown=2 default on Windows, or alternatively, to have mysqld function similarly to this (i.e. InnoDB work done at startup instead of at shutdown) as the default for Windows.

http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_fast_shutdown

However, when changing this, please keep the time to start the windows service as short as possible. It would be best to first start the service and then execute whatever is needed (InnoDB startup etc.) - I've logged a separate feature request for this here: bug #45546
[17 Jun 2009 9:20] Valeriy Kravchuk
Thank you for the feature request.
[16 Apr 2011 15:19] MySQL Verification Team
I personally don't like the idea of a crash recovery being done on every startup.
We often rely on a proper startup to ensure that problems didn't exist before a certain point in time.  Also, I don't trust crash recovery is 100% safe in all cases.

Can mysqld.exe programmatically set the estimated shutdown time to a higher value (or make it configurable?).

http://msdn.microsoft.com/en-us/library/ms685996%28v=vs.85%29.aspx
See dwWaitHint and dwCheckPoint descriptions.
[16 Apr 2011 15:25] MySQL Verification Team
We already set timeout of 60 seconds if i read the code correctly.  Of course, for large 64-bit innodb buffer pool, 60 seconds might not be nearly enough!

void NTService::Stop(void)
{
  SetStatus(SERVICE_STOP_PENDING,NO_ERROR, 0, 1, 60000);
  StopService();
<cut>
[18 Jun 2014 2:23] MySQL Verification Team
related: http://bugs.mysql.com/bug.php?id=73017

Different bugs, same fix - update dwCheckPoint periodically.