Commit 45dbd470 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent b4210f36
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -334,7 +334,7 @@ buf_dump( ...@@ -334,7 +334,7 @@ buf_dump(
i + 1, srv_buf_pool_instances, i + 1, srv_buf_pool_instances,
j + 1, n_pages); j + 1, n_pages);
} }
if ( (j % 1024) == 0) { if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool " "Dumping buffer pool "
ULINTPF "/" ULINTPF ", " ULINTPF "/" ULINTPF ", "
......
...@@ -1443,12 +1443,6 @@ log_write_up_to( ...@@ -1443,12 +1443,6 @@ log_write_up_to(
return; return;
} }
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"log write up to: " LSN_PF,
lsn);
}
loop: loop:
ut_ad(++loop_count < 100); ut_ad(++loop_count < 100);
...@@ -1561,6 +1555,13 @@ log_write_up_to( ...@@ -1561,6 +1555,13 @@ log_write_up_to(
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE; log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free; 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); group = UT_LIST_GET_FIRST(log_sys->log_groups);
/* Do the write to the log files */ /* Do the write to the log files */
......
...@@ -2542,9 +2542,17 @@ srv_purge_should_exit(ulint n_purged) ...@@ -2542,9 +2542,17 @@ srv_purge_should_exit(ulint n_purged)
} }
/* Slow shutdown was requested. */ /* Slow shutdown was requested. */
if (n_purged) { if (n_purged) {
service_manager_extend_timeout( #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
INNODB_EXTEND_TIMEOUT_INTERVAL, static ib_time_t progress_time;
"InnoDB " ULINTPF " pages purged", n_purged); 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. */ /* The previous round still did some work. */
return(false); return(false);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -334,7 +334,7 @@ buf_dump( ...@@ -334,7 +334,7 @@ buf_dump(
i + 1, srv_buf_pool_instances, i + 1, srv_buf_pool_instances,
j + 1, n_pages); j + 1, n_pages);
} }
if ( (j % 1024) == 0) { if (SHUTTING_DOWN() && !(j % 1024)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Dumping buffer pool " "Dumping buffer pool "
ULINTPF "/" ULINTPF ", " ULINTPF "/" ULINTPF ", "
......
...@@ -1561,12 +1561,6 @@ log_write_up_to( ...@@ -1561,12 +1561,6 @@ log_write_up_to(
return; return;
} }
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"log write up to: " LSN_PF,
lsn);
}
loop: loop:
ut_ad(++loop_count < 100); ut_ad(++loop_count < 100);
...@@ -1679,6 +1673,13 @@ log_write_up_to( ...@@ -1679,6 +1673,13 @@ log_write_up_to(
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE; log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free; 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); group = UT_LIST_GET_FIRST(log_sys->log_groups);
/* Do the write to the log files */ /* Do the write to the log files */
......
...@@ -3236,9 +3236,17 @@ srv_purge_should_exit(ulint n_purged) ...@@ -3236,9 +3236,17 @@ srv_purge_should_exit(ulint n_purged)
} }
/* Slow shutdown was requested. */ /* Slow shutdown was requested. */
if (n_purged) { if (n_purged) {
service_manager_extend_timeout( #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
INNODB_EXTEND_TIMEOUT_INTERVAL, static ib_time_t progress_time;
"InnoDB " ULINTPF " pages purged", n_purged); 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. */ /* The previous round still did some work. */
return(false); return(false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment