summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-19 14:28:57 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-20 08:41:34 +0300
commita4d4a5fe82bc87b222c50d192adf5e379fe6365d (patch)
treec467679dffa8bda0cf8c79e3d4f15c7b57337808
parent65e1399e64a306f1ce1d920e66206954f8630da8 (diff)
downloadmariadb-git-a4d4a5fe82bc87b222c50d192adf5e379fe6365d.tar.gz
After-merge fix for MDEV-11638
In commit 360a4a037271d65ab6471f7ab3f9b6a893d90a31 some debug assertions were introduced to the page flushing code in XtraDB. Add these assertions to InnoDB as well, and adjust the InnoDB shutdown so that these assertions will not fail. logs_empty_and_mark_files_at_shutdown(): Advance srv_shutdown_state from the first phase SRV_SHUTDOWN_CLEANUP only after no page-dirtying activity is possible (well, except by srv_master_do_shutdown_tasks(), which will be fixed separately in MDEV-12052). rotate_thread_t::should_shutdown(): Already exit the key rotation threads at the first phase of shutdown (SRV_SHUTDOWN_CLEANUP). page_cleaner_sleep_if_needed(): Do not sleep during shutdown. This change is originally from XtraDB.
-rw-r--r--storage/innobase/buf/buf0flu.cc9
-rw-r--r--storage/innobase/fil/fil0crypt.cc4
-rw-r--r--storage/innobase/log/log0log.cc2
-rw-r--r--storage/xtradb/fil/fil0crypt.cc4
-rw-r--r--storage/xtradb/log/log0log.cc2
5 files changed, 15 insertions, 6 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index b5ce171c92e..b8429052e93 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -150,6 +150,7 @@ buf_flush_insert_in_flush_rbt(
buf_page_t* prev = NULL;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
ut_ad(buf_flush_list_mutex_own(buf_pool));
/* Insert this buffer into the rbt. */
@@ -359,6 +360,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_page_t* prev_b;
buf_page_t* b;
+ ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
ut_ad(!buf_pool_mutex_own(buf_pool));
ut_ad(log_flush_order_mutex_own());
ut_ad(mutex_own(&block->mutex));
@@ -678,6 +680,7 @@ buf_flush_write_complete(
flush_type = buf_page_get_flush_type(bpage);
buf_pool->n_flush[flush_type]--;
+ ut_ad(buf_pool->n_flush[flush_type] != ULINT_MAX);
ut_ad(buf_pool_mutex_own(buf_pool));
@@ -1051,6 +1054,7 @@ buf_flush_page(
}
++buf_pool->n_flush[flush_type];
+ ut_ad(buf_pool->n_flush[flush_type] != 0);
mutex_exit(block_mutex);
buf_pool_mutex_exit(buf_pool);
@@ -2273,6 +2277,11 @@ page_cleaner_sleep_if_needed(
ulint next_loop_time) /*!< in: time when next loop iteration
should start */
{
+ /* No sleep if we are cleaning the buffer pool during the shutdown
+ with everything else finished */
+ if (srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)
+ return;
+
ulint cur_time = ut_time_ms();
if (next_loop_time > cur_time) {
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index b7841a4c411..a6d85fb89bf 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1294,10 +1294,10 @@ struct rotate_thread_t {
bool should_shutdown() const {
switch (srv_shutdown_state) {
case SRV_SHUTDOWN_NONE:
- case SRV_SHUTDOWN_CLEANUP:
return thread_no >= srv_n_fil_crypt_threads;
- case SRV_SHUTDOWN_FLUSH_PHASE:
+ case SRV_SHUTDOWN_CLEANUP:
return true;
+ case SRV_SHUTDOWN_FLUSH_PHASE:
case SRV_SHUTDOWN_LAST_PHASE:
case SRV_SHUTDOWN_EXIT_THREADS:
break;
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 934350f9efb..8b97ccf890e 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -3321,8 +3321,8 @@ wait_suspend_loop:
switch (srv_get_active_thread_type()) {
case SRV_NONE:
- srv_shutdown_state = SRV_SHUTDOWN_FLUSH_PHASE;
if (!srv_n_fil_crypt_threads_started) {
+ srv_shutdown_state = SRV_SHUTDOWN_FLUSH_PHASE;
break;
}
os_event_set(fil_crypt_threads_event);
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index bbafad6d04b..da78d4dd85d 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1294,10 +1294,10 @@ struct rotate_thread_t {
bool should_shutdown() const {
switch (srv_shutdown_state) {
case SRV_SHUTDOWN_NONE:
- case SRV_SHUTDOWN_CLEANUP:
return thread_no >= srv_n_fil_crypt_threads;
- case SRV_SHUTDOWN_FLUSH_PHASE:
+ case SRV_SHUTDOWN_CLEANUP:
return true;
+ case SRV_SHUTDOWN_FLUSH_PHASE:
case SRV_SHUTDOWN_LAST_PHASE:
case SRV_SHUTDOWN_EXIT_THREADS:
break;
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 7abab278416..d39bcb87117 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -3639,8 +3639,8 @@ wait_suspend_loop:
switch (srv_get_active_thread_type()) {
case SRV_NONE:
- srv_shutdown_state = SRV_SHUTDOWN_FLUSH_PHASE;
if (!srv_n_fil_crypt_threads_started) {
+ srv_shutdown_state = SRV_SHUTDOWN_FLUSH_PHASE;
break;
}
os_event_set(fil_crypt_threads_event);