diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-18 09:11:38 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-18 09:11:38 +0200 |
commit | 8996fca8e2dcd9c2c7b8adfbfb65d102ca590877 (patch) | |
tree | 9c7f29730dbb0299b328fc7ac1671e8959a22f78 | |
parent | 46fab5b32a84a1ffd181dd16b5cd63958faf010b (diff) | |
download | mariadb-git-bb-10.6-MDEV-23752.tar.gz |
MDEV-23752 SHOW EXPLAIN FOR thd waits for sleepbb-10.6-MDEV-23752
call check_killed() periodically during sleep()
-rw-r--r-- | mysql-test/main/processlist_notembedded.result | 13 | ||||
-rw-r--r-- | mysql-test/main/processlist_notembedded.test | 18 | ||||
-rw-r--r-- | sql/item_func.cc | 3 |
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/main/processlist_notembedded.result b/mysql-test/main/processlist_notembedded.result index b622fdf32b9..ab4d3f4d265 100644 --- a/mysql-test/main/processlist_notembedded.result +++ b/mysql-test/main/processlist_notembedded.result @@ -14,3 +14,16 @@ disconnect con1; connection default; SET DEBUG_SYNC = 'RESET'; End of 5.5 tests +# +# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep +# +connect con1,localhost,root,,; +select sleep(100000);; +connection default; +SHOW EXPLAIN FOR con_id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select sleep(100000) +KILL QUERY con_id; +# End of 10.6 tests diff --git a/mysql-test/main/processlist_notembedded.test b/mysql-test/main/processlist_notembedded.test index 6f269a816fc..3b1915eca64 100644 --- a/mysql-test/main/processlist_notembedded.test +++ b/mysql-test/main/processlist_notembedded.test @@ -40,3 +40,21 @@ SET DEBUG_SYNC = 'RESET'; source include/wait_until_count_sessions.inc; --echo End of 5.5 tests + +--echo # +--echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep +--echo # + +--connect (con1,localhost,root,,) +--let $con_id = `SELECT CONNECTION_ID()` +--send select sleep(100000); + +--connection default + +--replace_result $con_id con_id +eval SHOW EXPLAIN FOR $con_id; + +--replace_result $con_id con_id +eval KILL QUERY $con_id; + +--echo # End of 10.6 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 8a75d2c9946..8d00aac3463 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4020,7 +4020,8 @@ int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex) if (error == ETIMEDOUT || error == ETIME) { /* Return error if timed out or connection is broken. */ - if (!cmp_timespec(timeout, m_abs_timeout) || !m_thd->is_connected()) + if (!cmp_timespec(timeout, m_abs_timeout) || !m_thd->is_connected() || + m_thd->check_killed(TRUE)) break; } /* Otherwise, propagate status to the caller. */ |