summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-05-24 15:30:22 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-05-24 15:30:22 +0300
commit1c8c6bcd6f984d05d6f68d332b1e79c801e02003 (patch)
tree059a6541eae407f66cf180bec9488ee068a5b208
parent52df8040264cc6f3226e78d371e4c1dd88dd22b6 (diff)
downloadmariadb-git-1c8c6bcd6f984d05d6f68d332b1e79c801e02003.tar.gz
MDEV-13779 InnoDB fails to shut down purge, causing hang
thd_destructor_proxy(): Ensure that purge actually exits, like the logic should have been ever since MDEV-14080. srv_purge_shutdown(): A new function to wait for the purge coordinator to exit. Before exiting, the purge coordinator will ensure that all purge workers have exited.
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/srv0srv.h5
-rw-r--r--storage/innobase/srv/srv0srv.cc9
3 files changed, 14 insertions, 2 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index b74c886c692..02457db7ee9 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -354,7 +354,7 @@ thd_destructor_proxy(void *)
need to be purged, so they have to be shut down before purge
threads if slow shutdown is requested. */
srv_shutdown_bg_undo_sources();
- srv_purge_wakeup();
+ srv_purge_shutdown();
destroy_thd(thd);
mysql_cond_destroy(&thd_destructor_cond);
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 9ba65d8097e..18abcbb49f8 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -920,6 +920,9 @@ srv_release_threads(enum srv_thread_type type, ulint n);
void
srv_purge_wakeup();
+/** Shut down the purge threads. */
+void srv_purge_shutdown();
+
/** Check if tablespace is being truncated.
(Ignore system-tablespace as we don't re-create the tablespace
and so some of the action that are suppressed by this function
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 802271bb96f..424e8fecd6d 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -2963,6 +2963,15 @@ srv_purge_wakeup()
|| srv_sys.n_threads_active[SRV_PURGE]));
}
+/** Shut down the purge threads. */
+void srv_purge_shutdown()
+{
+ do {
+ ut_ad(!srv_undo_sources);
+ srv_purge_wakeup();
+ } while (srv_sys.sys_threads[SRV_PURGE_SLOT].in_use);
+}
+
/** Check if tablespace is being truncated.
(Ignore system-tablespace as we don't re-create the tablespace
and so some of the action that are suppressed by this function