Skip to content
Permalink
Browse files
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);
  • Loading branch information
grooverdan authored and dr-m committed Apr 6, 2018
1 parent 76ec37f commit e7f4e61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
@@ -3441,23 +3441,6 @@ logs_empty_and_mark_files_at_shutdown(void)

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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);

freed = buf_all_freed();
ut_a(freed);

ut_a(lsn == log_sys->lsn);
}

@@ -3758,23 +3758,6 @@ logs_empty_and_mark_files_at_shutdown(void)

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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
type = srv_get_active_thread_type();
ut_a(type == SRV_NONE);

freed = buf_all_freed();
ut_a(freed);

ut_a(lsn == log_sys->lsn);
}

0 comments on commit e7f4e61

Please sign in to comment.