Commit f932d3f8 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 8eff803a
......@@ -3244,7 +3244,9 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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) {
......
......@@ -3560,7 +3560,9 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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 @@ logs_empty_and_mark_files_at_shutdown(void)
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;
......
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