diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-18 09:11:38 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-18 12:34:49 +0200 |
commit | 3d466b3c9b704e48bdffb9ed84852b9f3720b22b (patch) | |
tree | 419643642043e78abf2481b21556ca958dca72b4 | |
parent | f381e019b602951586e47458eb884924c0945e12 (diff) | |
download | mariadb-git-bb-10.2-MDEV-23752.tar.gz |
MDEV-23752 SHOW EXPLAIN FOR thd waits for sleepbb-10.2-MDEV-23752
call check_killed() periodically during sleep()
-rw-r--r-- | mysql-test/r/processlist_notembedded.result | 13 | ||||
-rw-r--r-- | mysql-test/t/processlist_notembedded.test | 18 | ||||
-rw-r--r-- | sql/item_func.cc | 3 |
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/r/processlist_notembedded.result b/mysql-test/r/processlist_notembedded.result index 6231abb6550..a57a0203c47 100644 --- a/mysql-test/r/processlist_notembedded.result +++ b/mysql-test/r/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/t/processlist_notembedded.test b/mysql-test/t/processlist_notembedded.test index 6f269a816fc..3b1915eca64 100644 --- a/mysql-test/t/processlist_notembedded.test +++ b/mysql-test/t/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 9d588ce0eb1..98169c2c534 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4059,7 +4059,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()) break; } /* Otherwise, propagate status to the caller. */ |