summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-04-10 08:40:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-04-10 08:55:21 +0300
commitf932d3f879b6bfa4014cdbb8240b2e5a16c3e491 (patch)
tree5d9f261ced7e9ecb16a2dc27a00de0c6f4690dcb
parent8eff803a1bc9999fdf88607539f7b0af53cacbfa (diff)
downloadmariadb-git-f932d3f879b6bfa4014cdbb8240b2e5a16c3e491.tar.gz
MDEV-14705: Extend timeout for waiting for transactions
If innodb_fast_shutdown<2, all transactions of active connections will be rolled back on shutdown. This can take a long time, and the systemd shutdown timeout should be extended during the wait. logs_empty_and_mark_files_at_shutdown(): Extend the timeout when waiting for other threads to complete.
-rw-r--r--storage/innobase/log/log0log.cc16
-rw-r--r--storage/xtradb/log/log0log.cc16
2 files changed, 22 insertions, 10 deletions
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 9f0e129e320..112ab80dc83 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -3244,7 +3244,9 @@ loop:
os_event_set(lock_sys->timeout_event);
os_event_set(dict_stats_event);
}
- os_thread_sleep(100000);
+#define COUNT_INTERVAL 600
+#define CHECK_INTERVAL 100000
+ os_thread_sleep(CHECK_INTERVAL);
count++;
@@ -3256,7 +3258,10 @@ loop:
if (ulint total_trx = srv_was_started && !srv_read_only_mode
&& srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
? trx_sys_any_active_transactions() : 0) {
- if (srv_print_verbose_log && count > 600) {
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %lu active transactions to finish");
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for %lu active transactions to finish",
(ulong) total_trx);
@@ -3291,7 +3296,10 @@ loop:
if (thread_name) {
ut_ad(!srv_read_only_mode);
wait_suspend_loop:
- if (srv_print_verbose_log && count > 600) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %s to exit", thread_name);
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for %s to exit", thread_name);
count = 0;
@@ -3327,8 +3335,6 @@ wait_suspend_loop:
before proceeding further. */
count = 0;
-#define COUNT_INTERVAL 600
-#define CHECK_INTERVAL 100000
service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
"Waiting for page cleaner");
while (buf_page_cleaner_is_active) {
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 1ec2831f3e2..d25d15111d1 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -3560,7 +3560,9 @@ loop:
os_event_set(lock_sys->timeout_event);
os_event_set(dict_stats_event);
}
- os_thread_sleep(100000);
+#define COUNT_INTERVAL 600
+#define CHECK_INTERVAL 100000
+ os_thread_sleep(CHECK_INTERVAL);
count++;
@@ -3572,7 +3574,10 @@ loop:
if (ulint total_trx = srv_was_started && !srv_read_only_mode
&& srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
? trx_sys_any_active_transactions() : 0) {
- if (srv_print_verbose_log && count > 600) {
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %lu active transactions to finish");
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for %lu active transactions to finish",
(ulong) total_trx);
@@ -3607,7 +3612,10 @@ loop:
if (thread_name) {
ut_ad(!srv_read_only_mode);
wait_suspend_loop:
- if (srv_print_verbose_log && count > 600) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %s to exit", thread_name);
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for %s to exit", thread_name);
count = 0;
@@ -3643,8 +3651,6 @@ wait_suspend_loop:
before proceeding further. */
count = 0;
-#define COUNT_INTERVAL 600
-#define CHECK_INTERVAL 100000
service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
"Waiting for page cleaner");
os_rmb;