2487
2487
/**********************************************************************//**
2488
Check whether any background thread is active.
2489
@return FALSE if all are are suspended or have exited. */
2488
Check whether any background thread is active. If so return the thread
2490
@return ULINT_UNDEFINED if all are suspended or have exited, thread
2491
type if any are still active. */
2492
srv_is_any_background_thread_active(void)
2493
/*=====================================*/
2494
srv_get_active_thread_type(void)
2495
/*============================*/
2498
ibool ret = ULINT_UNDEFINED;
2498
2500
mutex_enter(&kernel_mutex);
2500
2502
for (i = 0; i <= SRV_MASTER; ++i) {
2501
2503
if (srv_n_threads_active[i] != 0) {
2514
/*********************************************************************//**
2515
This function prints progress message every 60 seconds during server
2516
shutdown, for any activities that master thread is pending on. */
2519
srv_shutdown_print_master_pending(
2520
/*==============================*/
2521
ib_time_t* last_print_time, /*!< last time the function
2522
print the message */
2523
ulint n_tables_to_drop, /*!< number of tables to
2525
ulint n_bytes_merged, /*!< number of change buffer
2527
ulint n_pages_flushed) /*!< number of pages flushed */
2529
ib_time_t current_time;
2530
double time_elapsed;
2532
current_time = ut_time();
2533
time_elapsed = ut_difftime(current_time, *last_print_time);
2535
if (time_elapsed > 60) {
2536
*last_print_time = ut_time();
2538
if (n_tables_to_drop) {
2539
ut_print_timestamp(stderr);
2540
fprintf(stderr, " InnoDB: Waiting for "
2541
"%lu table(s) to be dropped\n",
2542
(ulong) n_tables_to_drop);
2545
/* Check change buffer merge, we only wait for change buffer
2546
merge if it is a slow shutdown */
2547
if (!srv_fast_shutdown && n_bytes_merged) {
2548
ut_print_timestamp(stderr);
2549
fprintf(stderr, " InnoDB: Waiting for change "
2550
"buffer merge to complete\n"
2551
" InnoDB: number of bytes of change buffer "
2552
"just merged: %lu\n",
2556
if (n_pages_flushed) {
2557
ut_print_timestamp(stderr);
2558
fprintf(stderr, " InnoDB: Waiting for "
2559
"%lu pages to be flushed\n",
2560
(ulong) n_pages_flushed);
2512
2565
/*******************************************************************//**
2513
2566
Tells the InnoDB server that there has been activity in the database
2514
2567
and wakes up the master thread if it is suspended (not sleeping). Used
2664
2717
ulint n_pend_ios;
2665
2718
ulint next_itr_time;
2720
ib_time_t last_print_time;
2668
2722
#ifdef UNIV_DEBUG_THREAD_CREATION
2669
2723
fprintf(stderr, "Master thread starts, id %lu\n",
2686
2740
mutex_exit(&kernel_mutex);
2742
last_print_time = ut_time();
2689
2744
/*****************************************************************/
2690
2745
/* ---- When there is database activity by users, we cycle in this
3031
3086
n_bytes_archived = 0;
3088
/* Print progress message every 60 seconds during shutdown */
3089
if (srv_shutdown_state > 0 && srv_print_verbose_log) {
3090
srv_shutdown_print_master_pending(&last_print_time,
3033
3096
/* Keep looping in the background loop if still work to do */
3035
3098
if (srv_fast_shutdown && srv_shutdown_state > 0) {