diff options
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 4 | ||||
-rw-r--r-- | storage/innobase/fil/fil0crypt.cc | 3 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 15 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 4 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 2 | ||||
-rw-r--r-- | storage/innobase/trx/trx0roll.cc | 20 | ||||
-rw-r--r-- | storage/xtradb/fil/fil0crypt.cc | 3 | ||||
-rw-r--r-- | storage/xtradb/log/log0log.cc | 9 | ||||
-rw-r--r-- | storage/xtradb/srv/srv0srv.cc | 10 | ||||
-rw-r--r-- | storage/xtradb/trx/trx0roll.cc | 20 |
10 files changed, 53 insertions, 37 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 97dee779bcc..3f03ee8256f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -2398,8 +2398,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( thread_exit: buf_page_cleaner_is_active = FALSE; - os_event_free(buf_flush_event); - /* We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit. */ os_thread_exit(NULL); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index f19b29d347b..8a4c0bec1e1 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -138,6 +138,7 @@ fil_space_crypt_cleanup() /*=====================*/ { os_event_free(fil_crypt_throttle_sleep_event); + fil_crypt_throttle_sleep_event = NULL; mutex_free(&fil_crypt_key_mutex); mutex_free(&crypt_stat_mutex); } @@ -2543,7 +2544,9 @@ fil_crypt_threads_cleanup() } ut_a(!srv_n_fil_crypt_threads_started); os_event_free(fil_crypt_event); + fil_crypt_event = NULL; os_event_free(fil_crypt_threads_event); + fil_crypt_threads_event = NULL; mutex_free(&fil_crypt_threads_mutex); fil_crypt_threads_inited = false; } diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 704e88ff646..934350f9efb 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -3252,12 +3252,6 @@ logs_empty_and_mark_files_at_shutdown(void) ib_logf(IB_LOG_LEVEL_INFO, "Starting shutdown..."); - while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) { - /* we should wait until rollback after recovery end - for slow shutdown */ - os_thread_sleep(100000); - } - /* Wait until the master thread and all other operations are idle: our algorithm only works if the server is idle at shutdown */ @@ -3306,6 +3300,8 @@ loop: thread_name = "lock_wait_timeout_thread"; } else if (srv_buf_dump_thread_active) { thread_name = "buf_dump_thread"; + } else if (srv_fast_shutdown != 2 && trx_rollback_or_clean_is_active) { + thread_name = "rollback of recovered transactions"; } else { thread_name = NULL; } @@ -3360,6 +3356,11 @@ wait_suspend_loop: } } + if (buf_flush_event) { + os_event_free(buf_flush_event); + buf_flush_event = NULL; + } + if (log_scrub_thread_active) { ut_ad(!srv_read_only_mode); os_event_set(log_scrub_event); @@ -3730,11 +3731,11 @@ log_shutdown(void) if (!srv_read_only_mode && srv_scrub_log) { os_event_free(log_scrub_event); + log_scrub_event = NULL; } #ifdef UNIV_LOG_ARCHIVE rw_lock_free(&log_sys->archive_lock); - os_event_create(); #endif /* UNIV_LOG_ARCHIVE */ #ifdef UNIV_LOG_DEBUG diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a6ddde05039..a02b522b116 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -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, 2017, MariaDB Corporation Ab. All Rights Reserved. +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 @@ -464,7 +464,7 @@ UNIV_INTERN const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]; UNIV_INTERN time_t srv_last_monitor_time; -UNIV_INTERN ib_mutex_t srv_innodb_monitor_mutex; +static ib_mutex_t srv_innodb_monitor_mutex; /* Mutex for locking srv_monitor_file. Not created if srv_read_only_mode */ UNIV_INTERN ib_mutex_t srv_monitor_file_mutex; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 58117859de8..6fe2c2a0f2a 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -3185,7 +3185,7 @@ innobase_shutdown_for_mysql(void) sync_close(); srv_free(); - /* 4. Free the os_conc_mutex and all os_events and os_mutexes */ + /* 4. Free all os_events and os_mutexes */ os_sync_free(); diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 0c90a45c6c6..0ef0d90b9cd 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -741,9 +741,9 @@ trx_rollback_or_clean_recovered( } if (all) { - fprintf(stderr, - "InnoDB: Starting in background the rollback" - " of uncommitted transactions\n"); + ib_logf(IB_LOG_LEVEL_INFO, + "Starting in background the rollback" + " of recovered transactions"); } /* Note: For XA recovered transactions, we rely on MySQL to @@ -763,6 +763,12 @@ trx_rollback_or_clean_recovered( assert_trx_in_rw_list(trx); + if (srv_shutdown_state != SRV_SHUTDOWN_NONE + && srv_fast_shutdown != 0) { + all = FALSE; + break; + } + /* If this function does a cleanup or rollback then it will release the trx_sys->mutex, therefore we need to reacquire it before retrying the loop. */ @@ -780,10 +786,8 @@ trx_rollback_or_clean_recovered( } while (trx != NULL); if (all) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Rollback of non-prepared" - " transactions completed\n"); + ib_logf(IB_LOG_LEVEL_INFO, + "Rollback of non-prepared transactions completed"); } } diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index eaa7da4f144..45cc9684290 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -138,6 +138,7 @@ fil_space_crypt_cleanup() /*=====================*/ { os_event_free(fil_crypt_throttle_sleep_event); + fil_crypt_throttle_sleep_event = NULL; mutex_free(&fil_crypt_key_mutex); mutex_free(&crypt_stat_mutex); } @@ -2542,7 +2543,9 @@ fil_crypt_threads_cleanup() } ut_a(!srv_n_fil_crypt_threads_started); os_event_free(fil_crypt_event); + fil_crypt_event = NULL; os_event_free(fil_crypt_threads_event); + fil_crypt_threads_event = NULL; mutex_free(&fil_crypt_threads_mutex); fil_crypt_threads_inited = false; } diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 4c654f5272d..25c8ed06981 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -3570,12 +3570,6 @@ logs_empty_and_mark_files_at_shutdown(void) if (log_disable_checkpoint_active) log_enable_checkpoint(); - while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) { - /* we should wait until rollback after recovery end - for slow shutdown */ - os_thread_sleep(100000); - } - /* Wait until the master thread and all other operations are idle: our algorithm only works if the server is idle at shutdown */ @@ -3624,6 +3618,8 @@ loop: thread_name = "lock_wait_timeout_thread"; } else if (srv_buf_dump_thread_active) { thread_name = "buf_dump_thread"; + } else if (srv_fast_shutdown != 2 && trx_rollback_or_clean_is_active) { + thread_name = "rollback of recovered transactions"; } else { thread_name = NULL; } @@ -4085,6 +4081,7 @@ log_shutdown(void) if (!srv_read_only_mode && srv_scrub_log) { os_event_free(log_scrub_event); + log_scrub_event = NULL; } #ifdef UNIV_LOG_ARCHIVE diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 5389b7e9bc4..838b2a6c94b 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -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, 2017, MariaDB Corporation Ab. All Rights Reserved. +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 @@ -604,7 +604,7 @@ UNIV_INTERN const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]; UNIV_INTERN time_t srv_last_monitor_time; -UNIV_INTERN ib_mutex_t srv_innodb_monitor_mutex; +static ib_mutex_t srv_innodb_monitor_mutex; /* Mutex for locking srv_monitor_file. Not created if srv_read_only_mode */ UNIV_INTERN ib_mutex_t srv_monitor_file_mutex; @@ -1284,16 +1284,22 @@ srv_free(void) os_event_free(srv_sys->sys_threads[i].event); os_event_free(srv_error_event); + srv_error_event = NULL; os_event_free(srv_monitor_event); + srv_monitor_event = NULL; os_event_free(srv_buf_dump_event); + srv_buf_dump_event = NULL; os_event_free(srv_checkpoint_completed_event); + srv_checkpoint_completed_event = NULL; os_event_free(srv_redo_log_tracked_event); + srv_redo_log_tracked_event = NULL; mutex_free(&srv_sys->mutex); mutex_free(&srv_sys->tasks_mutex); } #ifdef WITH_INNODB_DISALLOW_WRITES os_event_free(srv_allow_writes_event); + srv_allow_writes_event = NULL; #endif /* WITH_INNODB_DISALLOW_WRITES */ #ifndef HAVE_ATOMIC_BUILTINS diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index ee1497b209f..d228743d300 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -753,9 +753,9 @@ trx_rollback_or_clean_recovered( } if (all) { - fprintf(stderr, - "InnoDB: Starting in background the rollback" - " of uncommitted transactions\n"); + ib_logf(IB_LOG_LEVEL_INFO, + "Starting in background the rollback" + " of recovered transactions"); } /* Note: For XA recovered transactions, we rely on MySQL to @@ -775,6 +775,12 @@ trx_rollback_or_clean_recovered( assert_trx_in_rw_list(trx); + if (srv_shutdown_state != SRV_SHUTDOWN_NONE + && srv_fast_shutdown != 0) { + all = FALSE; + break; + } + /* If this function does a cleanup or rollback then it will release the trx_sys->mutex, therefore we need to reacquire it before retrying the loop. */ @@ -792,10 +798,8 @@ trx_rollback_or_clean_recovered( } while (trx != NULL); if (all) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Rollback of non-prepared" - " transactions completed\n"); + ib_logf(IB_LOG_LEVEL_INFO, + "Rollback of non-prepared transactions completed"); } } |