From 643319a7fb1e273797c2a1e46d76cfac0fa1da8f Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 May 2025 11:22:58 +0300 Subject: [PATCH] MDEV-36465 MDEV-33813 Regression, Queries in 'Waiting for someone to free space' state will not automatically retry IO and hang forever MDEV-33813 caused a regressing in that when a disk got full when writing to a MyISAM or Aria table the MariaDB connection would, instead of doing a retry after 60 seconds, hang until the query was killed. Fixed by changing mysql_coind_wait() top mysql_cond_timedwait() Author: Thomas Stangner --- sql/sql_class.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index da8120abaab..62d1cb068c3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -8509,16 +8509,19 @@ void mariadb_sleep_for_space(unsigned int seconds) { THD *thd= current_thd; PSI_stage_info old_stage; + struct timespec abstime; if (!thd) { sleep(seconds); return; } - mysql_mutex_lock(&thd->LOCK_wakeup_ready); + set_timespec(abstime, seconds); + mysql_mutex_lock(&thd->LOCK_wakeup_ready); thd->ENTER_COND(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready, &stage_waiting_for_disk_space, &old_stage); if (!thd->killed) - mysql_cond_wait(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready); + mysql_cond_timedwait(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready, + &abstime); thd->EXIT_COND(&old_stage); return; }