MDEV-17003 service_manager_extend_timeout() being called too often

buf_dump(): Only generate the output when shutdown is in progress.

log_write_up_to(): Only generate the output before actually writing
to the redo log files.

srv_purge_should_exit(): Rate-limit the output, and instead of
displaying the work done, indicate the work that remains to be done
until the completion of the slow shutdown.
This commit is contained in:
Marko Mäkelä 2018-08-21 11:56:50 +03:00
parent b4210f3640
commit 45dbd47026
6 changed files with 40 additions and 22 deletions

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2017, 2018, 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
@ -334,7 +334,7 @@ buf_dump(
i + 1, srv_buf_pool_instances,
j + 1, n_pages);
}
if ( (j % 1024) == 0) {
if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool "
ULINTPF "/" ULINTPF ", "

View file

@ -1443,12 +1443,6 @@ log_write_up_to(
return;
}
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"log write up to: " LSN_PF,
lsn);
}
loop:
ut_ad(++loop_count < 100);
@ -1561,6 +1555,13 @@ loop:
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free;
if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB log write: "
LSN_PF "," LSN_PF,
log_sys->write_lsn, lsn);
}
group = UT_LIST_GET_FIRST(log_sys->log_groups);
/* Do the write to the log files */

View file

@ -2542,9 +2542,17 @@ srv_purge_should_exit(ulint n_purged)
}
/* Slow shutdown was requested. */
if (n_purged) {
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB " ULINTPF " pages purged", n_purged);
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
static ib_time_t progress_time;
ib_time_t time = ut_time();
if (time - progress_time >= 15) {
progress_time = time;
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB: to purge " ULINTPF " transactions",
trx_sys->rseg_history_len);
}
#endif
/* The previous round still did some work. */
return(false);
}

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2017, 2018, 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
@ -334,7 +334,7 @@ buf_dump(
i + 1, srv_buf_pool_instances,
j + 1, n_pages);
}
if ( (j % 1024) == 0) {
if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool "
ULINTPF "/" ULINTPF ", "

View file

@ -1561,12 +1561,6 @@ log_write_up_to(
return;
}
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"log write up to: " LSN_PF,
lsn);
}
loop:
ut_ad(++loop_count < 100);
@ -1679,6 +1673,13 @@ loop:
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free;
if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB log write: "
LSN_PF "," LSN_PF,
log_sys->write_lsn, lsn);
}
group = UT_LIST_GET_FIRST(log_sys->log_groups);
/* Do the write to the log files */

View file

@ -3236,9 +3236,17 @@ srv_purge_should_exit(ulint n_purged)
}
/* Slow shutdown was requested. */
if (n_purged) {
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB " ULINTPF " pages purged", n_purged);
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
static ib_time_t progress_time;
ib_time_t time = ut_time();
if (time - progress_time >= 15) {
progress_time = time;
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB: to purge " ULINTPF " transactions",
trx_sys->rseg_history_len);
}
#endif
/* The previous round still did some work. */
return(false);
}