From 1479273cdbbca57675f3c8295ebcacc768d125d5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 30 Nov 2017 13:37:59 +1100 Subject: MDEV-14705: slow innodb startup/shutdown can exceed systemd timeout Use systemd EXTEND_TIMEOUT_USEC to advise systemd of progress Move towards progress measures rather than pure time based measures. Progress reporting at numberious shutdown/startup locations incuding: * For innodb_fast_shutdown=0 trx_roll_must_shutdown() for rolling back incomplete transactions. * For merging the change buffer (in srv_shutdown(bool ibuf_merge)) * For purging history, srv_do_purge Thanks Marko for feedback and suggestions. --- storage/xtradb/srv/srv0srv.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'storage/xtradb/srv') diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index f431c47de4d..b53948d9371 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -86,6 +86,12 @@ ibool innobase_get_slow_log(); in the server */ UNIV_INTERN ulint srv_activity_count = 0; +#include + +#ifdef WITH_WSREP +extern int wsrep_debug; +extern int wsrep_trx_is_aborting(void *thd_ptr); +#endif /* The following is the maximum allowed duration of a lock wait. */ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; @@ -3435,6 +3441,10 @@ srv_do_purge( *n_total_purged += n_pages_purged; + if (n_pages_purged > 0) { + service_manager_extend_timeout( + INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); + } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); -- cgit v1.2.1 From 3498a656c90a579ab0bb26a3566c14474b5ad6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Apr 2018 12:25:41 +0300 Subject: MDEV-14705: Follow-up fixes buf_flush_remove(): Disable the output for now, because we certainly do not want this after every page flush on shutdown. It must be rate-limited somehow. There already is a timeout extension for waiting the page cleaner to exit in logs_empty_and_mark_files_at_shutdown(). log_write_up_to(): Use correct format. srv_purge_should_exit(): Move the timeout extension to the appropriate place, from one of the callers. --- storage/xtradb/srv/srv0srv.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'storage/xtradb/srv') diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index b53948d9371..31e87095934 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -3236,6 +3236,9 @@ 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); /* The previous round still did some work. */ return(false); } @@ -3440,11 +3443,6 @@ srv_do_purge( (++count % TRX_SYS_N_RSEGS) == 0); *n_total_purged += n_pages_purged; - - if (n_pages_purged > 0) { - service_manager_extend_timeout( - INNODB_EXTEND_TIMEOUT_INTERVAL, "Innodb %d pages purged", n_pages_purged); - } } while (!srv_purge_should_exit(n_pages_purged) && n_pages_purged > 0 && purge_sys->state == PURGE_STATE_RUN); -- cgit v1.2.1