Browse Source

MDEV-14705: Speed up InnoDB shutdown

Suggested by Marko on github pr #576

buf_all_freed only needs to be called once, not 3 times.

buf_all_freed will always return TRUE if it returns.
It will crash if any page was not flushed so its effectively
an assert anyway.

The following calls are likely redundant and could be removed:

		fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
		fil_flush_file_spaces(FIL_TYPE_LOG);
pull/694/head
Daniel Black 8 years ago
committed by Marko Mäkelä
parent
commit
e7f4e61f6e
  1. 23
      storage/innobase/log/log0log.cc
  2. 23
      storage/xtradb/log/log0log.cc

23
storage/innobase/log/log0log.cc

@ -3441,23 +3441,6 @@ wait_suspend_loop:
mutex_exit(&log_sys->mutex);
fil_flush_file_spaces(FIL_TABLESPACE);
fil_flush_file_spaces(FIL_LOG);
/* The call fil_write_flushed_lsn_to_data_files() will
bypass the buffer pool: therefore it is essential that
the buffer pool has been completely flushed to disk! */
if (!buf_all_freed()) {
if (srv_print_verbose_log && count > 600) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for dirty buffer pages"
" to be flushed");
count = 0;
}
goto loop;
}
} else {
lsn = srv_start_lsn;
}
@ -3468,8 +3451,7 @@ wait_suspend_loop:
srv_thread_type type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);
bool freed = buf_all_freed();
ut_a(freed);
buf_all_freed();
ut_a(lsn == log_sys->lsn);
@ -3499,9 +3481,6 @@ wait_suspend_loop:
type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);
freed = buf_all_freed();
ut_a(freed);
ut_a(lsn == log_sys->lsn);
}

23
storage/xtradb/log/log0log.cc

@ -3758,23 +3758,6 @@ wait_suspend_loop:
mutex_exit(&log_sys->mutex);
fil_flush_file_spaces(FIL_TABLESPACE);
fil_flush_file_spaces(FIL_LOG);
/* The call fil_write_flushed_lsn_to_data_files() will
bypass the buffer pool: therefore it is essential that
the buffer pool has been completely flushed to disk! */
if (!buf_all_freed()) {
if (srv_print_verbose_log && count > 600) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for dirty buffer pages"
" to be flushed");
count = 0;
}
goto loop;
}
} else {
lsn = srv_start_lsn;
}
@ -3791,8 +3774,7 @@ wait_suspend_loop:
srv_thread_type type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);
bool freed = buf_all_freed();
ut_a(freed);
buf_all_freed();
ut_a(lsn == log_sys->lsn);
ut_ad(srv_force_recovery >= SRV_FORCE_NO_LOG_REDO
@ -3824,9 +3806,6 @@ wait_suspend_loop:
type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);
freed = buf_all_freed();
ut_a(freed);
ut_a(lsn == log_sys->lsn);
}

Loading…
Cancel
Save