Commit fcb29391 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix long xtradb shutdown on Windows XP

The reason for the long shutdown is hanging in io threads. It appears
that just closing completion port on XP does not necessarily signal 
thread waiting in GetIOCompletionStatus() (even if this works fine
on later Windows versions)

The fix is to wakeup background threads using PostQueuedCompletionStatus()
with a special 'key' parameter indicating shutdown.
parent 0a837698
......@@ -53,6 +53,10 @@ Created 10/21/1995 Heikki Tuuri
# endif /* __WIN__ */
#endif /* !UNIV_HOTBACKUP */
#ifdef _WIN32
#define IOCP_SHUTDOWN_KEY (ULONG_PTR)-1
#endif
/* This specifies the file permissions InnoDB uses when it creates files in
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to
my_umask */
......@@ -3235,9 +3239,7 @@ os_aio_array_wake_win_aio_at_shutdown(
{
if(completion_port)
{
ut_a(CloseHandle(completion_port));
completion_port = 0;
PostQueuedCompletionStatus(completion_port, 0, IOCP_SHUTDOWN_KEY, NULL);
}
}
#endif
......@@ -3836,11 +3838,17 @@ os_aio_windows_handle(
BOOL ret;
DWORD len;
BOOL retry = FALSE;
ULONG_PTR dummy_key;
ULONG_PTR key;
ret = GetQueuedCompletionStatus(completion_port, &len, &dummy_key,
ret = GetQueuedCompletionStatus(completion_port, &len, &key,
(OVERLAPPED **)&slot, INFINITE);
/* If shutdown key was received, repost the shutdown message and exit */
if (ret && (key == IOCP_SHUTDOWN_KEY)) {
PostQueuedCompletionStatus(completion_port, 0, key, NULL);
os_thread_exit(NULL);
}
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_thread_exit(NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment