diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-08-08 18:40:41 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-08-08 18:40:41 +0200 |
commit | fcb2939131754a1f041f83644debe157c0625a26 (patch) | |
tree | f8ae65e5f12437b80b1328b6a6728e96e6cd1cc1 /storage | |
parent | 0a837698959111a5dbbaf4c9bf9af39d4f6fdba2 (diff) | |
download | mariadb-git-fcb2939131754a1f041f83644debe157c0625a26.tar.gz |
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.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/xtradb/os/os0file.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c index 7a8e5802b19..e0acb9abd65 100644 --- a/storage/xtradb/os/os0file.c +++ b/storage/xtradb/os/os0file.c @@ -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); } |