Commit 9dc10d58 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.0 into 10.1

parents 68be011c 032678ad
/*****************************************************************************
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);
......
......@@ -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;
}
......
......@@ -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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
}
}
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
......
......@@ -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;
......
......@@ -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();
......
/*****************************************************************************
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");
}
}
......
......@@ -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;
}
......
......@@ -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 @@ logs_empty_and_mark_files_at_shutdown(void)
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
......
......@@ -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
......
/*****************************************************************************
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");
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment