summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/srv0srv.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-01-04 18:43:32 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-01-05 00:20:06 +0200
commit719321e78e69249e796a907c17400dac14ef0921 (patch)
tree618c0f78cad1d6ed2a1ae97400b4ea6c55188460 /storage/xtradb/include/srv0srv.h
parent0f8e17af92cd0126aadf283e25edcd64872b2ea3 (diff)
downloadmariadb-git-719321e78e69249e796a907c17400dac14ef0921.tar.gz
MDEV-11638 Encryption causes race conditions in InnoDB shutdown
InnoDB shutdown failed to properly take fil_crypt_thread() into account. The encryption threads were signalled to shut down together with other non-critical tasks. This could be much too early in case of slow shutdown, which could need minutes to complete the purge. Furthermore, InnoDB failed to wait for the fil_crypt_thread() to actually exit before proceeding to the final steps of shutdown, causing the race conditions. Furthermore, the log_scrub_thread() was shut down way too early. Also it should remain until the SRV_SHUTDOWN_FLUSH_PHASE. fil_crypt_threads_end(): Remove. This would cause the threads to be terminated way too early. srv_buf_dump_thread_active, srv_dict_stats_thread_active, lock_sys->timeout_thread_active, log_scrub_thread_active, srv_monitor_active, srv_error_monitor_active: Remove a race condition between startup and shutdown, by setting these in the startup thread that creates threads, not in each created thread. In this way, once the flag is cleared, it will remain cleared during shutdown. srv_n_fil_crypt_threads_started, fil_crypt_threads_event: Declare in global rather than static scope. log_scrub_event, srv_log_scrub_thread_active, log_scrub_thread(): Declare in static rather than global scope. Let these be created by log_init() and freed by log_shutdown(). rotate_thread_t::should_shutdown(): Do not shut down before the SRV_SHUTDOWN_FLUSH_PHASE. srv_any_background_threads_are_active(): Remove. These checks now exist in logs_empty_and_mark_files_at_shutdown(). logs_empty_and_mark_files_at_shutdown(): Shut down the threads in the proper order. Keep fil_crypt_thread() and log_scrub_thread() alive until SRV_SHUTDOWN_FLUSH_PHASE, and check that they actually terminate.
Diffstat (limited to 'storage/xtradb/include/srv0srv.h')
-rw-r--r--storage/xtradb/include/srv0srv.h25
1 files changed, 8 insertions, 17 deletions
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index e2d141b4140..f3b6098a875 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation
+Copyright (c) 2013, 2017, MariaDB Corporation
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -349,7 +349,6 @@ extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes;
extern ulint* srv_data_file_is_raw_partition;
-
/** Whether the redo log tracking is currently enabled. Note that it is
possible for the log tracker thread to be running and the tracking to be
disabled */
@@ -359,6 +358,9 @@ extern ulonglong srv_max_bitmap_file_size;
extern
ulonglong srv_max_changed_pages;
+extern uint srv_n_fil_crypt_threads;
+extern uint srv_n_fil_crypt_threads_started;
+
extern ibool srv_auto_extend_last_data_file;
extern ulint srv_last_file_size_max;
extern char* srv_log_group_home_dir;
@@ -577,19 +579,17 @@ extern ibool srv_print_verbose_log;
"tables instead, see " REFMAN "innodb-i_s-tables.html"
extern ibool srv_print_innodb_table_monitor;
-extern ibool srv_monitor_active;
-extern ibool srv_error_monitor_active;
+extern bool srv_monitor_active;
+extern bool srv_error_monitor_active;
/* TRUE during the lifetime of the buffer pool dump/load thread */
-extern ibool srv_buf_dump_thread_active;
+extern bool srv_buf_dump_thread_active;
/* TRUE during the lifetime of the stats thread */
-extern ibool srv_dict_stats_thread_active;
+extern bool srv_dict_stats_thread_active;
/* TRUE if enable log scrubbing */
extern my_bool srv_scrub_log;
-/* TRUE during the lifetime of the log scrub thread */
-extern ibool srv_log_scrub_thread_active;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
@@ -1086,15 +1086,6 @@ srv_release_threads(
ulint n); /*!< in: number of threads to release */
/**********************************************************************//**
-Check whether any background thread are active. If so print which thread
-is active. Send the threads wakeup signal.
-@return name of thread that is active or NULL */
-UNIV_INTERN
-const char*
-srv_any_background_threads_are_active(void);
-/*=======================================*/
-
-/**********************************************************************//**
Wakeup the purge threads. */
UNIV_INTERN
void