diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-05 16:51:26 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-05 16:51:26 +0300 |
commit | 680463a8d991389f4ea5942e87764137c55c0eb4 (patch) | |
tree | 427f8946aa9085c7f6346e1047144995cb7c459e /storage/innobase/srv/srv0srv.cc | |
parent | 05693cf2149f8792863a32325090e789015286fc (diff) | |
parent | efc70da5fd0459ff44153529d13651741cc32bc4 (diff) | |
download | mariadb-git-680463a8d991389f4ea5942e87764137c55c0eb4.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/srv/srv0srv.cc')
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 5a38ce4908e..03dd9f246ac 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1287,7 +1287,8 @@ srv_printf_innodb_monitor( ibuf_print(file); #ifdef BTR_CUR_HASH_ADAPT - for (ulint i = 0; i < btr_ahi_parts; ++i) { + btr_search_x_lock_all(); + for (ulint i = 0; i < btr_ahi_parts && btr_search_enabled; ++i) { const hash_table_t* table = btr_search_sys->hash_tables[i]; ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); @@ -1311,6 +1312,7 @@ srv_printf_innodb_monitor( ", node heap has " ULINTPF " buffer(s)\n", table->n_cells, heap->base.count - !heap->free_block); } + btr_search_x_unlock_all(); fprintf(file, "%.2f hash searches/s, %.2f non-hash searches/s\n", @@ -1752,7 +1754,7 @@ loop: srv_refresh_innodb_monitor_stats(); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { goto exit_func; } @@ -1864,7 +1866,7 @@ loop: os_event_wait_time_low(srv_error_event, 1000000, sig_count); - if (srv_shutdown_state == SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { goto loop; } @@ -2152,7 +2154,7 @@ srv_master_do_active_tasks(void) ut_d(srv_master_do_disabled_loop()); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2177,7 +2179,7 @@ srv_master_do_active_tasks(void) /* Now see if various tasks that are performed at defined intervals need to be performed. */ - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2202,7 +2204,7 @@ srv_master_do_active_tasks(void) early and often to avoid those situations. */ DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2245,7 +2247,7 @@ srv_master_do_idle_tasks(void) ut_d(srv_master_do_disabled_loop()); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2261,7 +2263,7 @@ srv_master_do_idle_tasks(void) MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2289,7 +2291,7 @@ srv_master_do_idle_tasks(void) early and often to avoid those situations. */ DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;); - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) { return; } @@ -2387,8 +2389,7 @@ DECLARE_THREAD(srv_master_thread)( ut_a(slot == srv_sys.sys_threads); loop: - while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { - + while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { srv_master_sleep(); MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP); @@ -2403,6 +2404,7 @@ loop: switch (srv_shutdown_state) { case SRV_SHUTDOWN_NONE: + case SRV_SHUTDOWN_INITIATED: break; case SRV_SHUTDOWN_FLUSH_PHASE: case SRV_SHUTDOWN_LAST_PHASE: @@ -2433,34 +2435,33 @@ loop: /** @return whether purge should exit due to shutdown */ static bool srv_purge_should_exit() { - ut_ad(srv_shutdown_state == SRV_SHUTDOWN_NONE - || srv_shutdown_state == SRV_SHUTDOWN_CLEANUP); - - if (srv_undo_sources) { - return(false); - } - if (srv_fast_shutdown) { - return(true); - } - /* Slow shutdown was requested. */ - ulint history_size = trx_sys.history_size(); - - if (history_size) { + ut_ad(srv_shutdown_state <= SRV_SHUTDOWN_CLEANUP); + + if (srv_undo_sources) + return false; + + if (srv_fast_shutdown) + return true; + + /* Slow shutdown was requested. */ + if (const ulint history_size= trx_sys.history_size()) + { + static time_t progress_time; + time_t now= time(NULL); + if (now - progress_time >= 15) + { + progress_time= now; #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY - static time_t progress_time; - time_t now = time(NULL); - if (now - progress_time >= 15) { - progress_time = now; - service_manager_extend_timeout( - INNODB_EXTEND_TIMEOUT_INTERVAL, - "InnoDB: to purge " ULINTPF " transactions", - history_size); - } + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "InnoDB: to purge %zu transactions", + history_size); + ib::info() << "to purge " << history_size << " transactions"; #endif - return false; - } + } + return false; + } - return !trx_sys.any_active_transactions(); + return !trx_sys.any_active_transactions(); } /*********************************************************************//** |