summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
-rw-r--r--storage/innobase/include/srv0start.h5
-rw-r--r--storage/innobase/srv/srv0start.cc23
3 files changed, 27 insertions, 6 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 42dce9d79b7..83dd0c17eaa 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -345,6 +345,11 @@ thd_destructor_proxy(void *)
while (trx_sys_any_active_transactions()) {
os_thread_sleep(1000);
}
+
+ /* Some background threads might generate undo pages that will
+ 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();
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index 0dd98e5b19b..82b5446c62a 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -88,6 +88,11 @@ Shuts down the Innobase database.
dberr_t
innobase_shutdown_for_mysql(void);
+/****************************************************************//**
+Shuts down background threads that can generate undo pages. */
+void
+srv_shutdown_bg_undo_sources(void);
+
/********************************************************************
Signal all per-table background threads to shutdown, and wait for them to do
so. */
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 0c5007fbc13..96c2d8fa8c4 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2769,6 +2769,21 @@ srv_fts_close(void)
}
#endif
+
+/****************************************************************//**
+Shuts down background threads that can generate undo pages. */
+void
+srv_shutdown_bg_undo_sources(void)
+/*===========================*/
+{
+ fts_optimize_shutdown();
+ dict_stats_shutdown();
+
+ /* Shutdown key rotation threads */
+ fil_crypt_threads_end();
+}
+
+
/****************************************************************//**
Shuts down the InnoDB database.
@return DB_SUCCESS or error code */
@@ -2785,12 +2800,8 @@ innobase_shutdown_for_mysql(void)
return(DB_SUCCESS);
}
- if (!srv_read_only_mode) {
- fts_optimize_shutdown();
- dict_stats_shutdown();
-
- /* Shutdown key rotation threads */
- fil_crypt_threads_end();
+ if (!srv_read_only_mode && srv_fast_shutdown) {
+ srv_shutdown_bg_undo_sources();
}
/* 1. Flush the buffer pool to disk, write the current lsn to