mariadb/storage
Marko Mäkelä 719321e78e 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.
2017-01-05 00:20:06 +02:00
..
archive Merge branch '10.0' into 10.1 2016-03-21 13:02:53 +01:00
blackhole MDEV-5120 Test suite test maria-no-logging fails 2014-09-30 20:31:14 +03:00
cassandra Merge branch '10.0' into 10.1 2015-12-21 21:24:22 +01:00
connect Merge branch '10.0-galera' into 10.1 2016-11-02 13:44:07 +01:00
csv Merge branch '10.0' into 10.1 2016-03-21 13:02:53 +01:00
example 5.5.40+ merge 2014-10-09 10:30:11 +02:00
federated Merge branch '10.0' into 10.1 2016-03-21 13:02:53 +01:00
federatedx Merge branch '10.0' into 10.1 2016-05-04 15:23:26 +02:00
heap Sage cleanup in heap storage engine 2015-11-10 13:46:56 +02:00
innobase MDEV-11638 Encryption causes race conditions in InnoDB shutdown 2017-01-05 00:20:06 +02:00
maria Merge branch '10.0' into 10.1 2016-12-11 09:53:42 +01:00
mroonga MDEV-9363 - Mroonga tests with datetime field fail on Solaris in buildbot 2016-07-08 23:38:05 +04:00
myisam Merge branch '10.0' into 10.1 2016-12-11 09:53:42 +01:00
myisammrg Merge branch '10.0' into 10.1 2016-05-04 15:23:26 +02:00
oqgraph Merge branch '10.0-galera' into 10.1 2016-11-02 13:44:07 +01:00
perfschema Merge branch '10.0' into 10.1 2016-09-28 17:55:28 +02:00
sequence test for group by pushdown with a view 2016-05-05 01:05:05 +02:00
sphinx MDEV-10985, MDEV-10986 - sphinx tests have not been maintained 2016-11-04 13:33:28 +03:00
spider revert part of 69f1a32 2016-06-22 10:23:11 +02:00
test_sql_discovery MDEV-3929 Add system variable explicit_defaults_for_timestamp for compatibility with MySQL 2015-09-22 14:01:54 +04:00
tokudb Merge branch '10.0' into 10.1 2016-12-11 09:53:42 +01:00
xtradb MDEV-11638 Encryption causes race conditions in InnoDB shutdown 2017-01-05 00:20:06 +02:00