MDEV-7299 Assertion `m_status == DA_ERROR || m_status == DA_OK' fails on concurrent execution of DDL, queries from I_S, and KILL QUERY
Fix MDL to report an error when a wait was killed, but preserve the old documented behavior of GET_LOCK() where killing it is not an error. Also remove race conditions in main.create_or_replace test
This commit is contained in:
parent
c75eec8e0d
commit
73ebabd2ee
@ -436,7 +436,9 @@ CREATE OR REPLACE TEMPORARY TABLE tmp LIKE t1;
|
|||||||
LOCK TABLE t1 WRITE;
|
LOCK TABLE t1 WRITE;
|
||||||
CREATE OR REPLACE TABLE t1 LIKE tmp;
|
CREATE OR REPLACE TABLE t1 LIKE tmp;
|
||||||
KILL QUERY con_id;
|
KILL QUERY con_id;
|
||||||
|
ERROR 70100: Query execution was interrupted
|
||||||
CREATE OR REPLACE TABLE t1 (a int);
|
CREATE OR REPLACE TABLE t1 (a int);
|
||||||
KILL QUERY con_id;
|
KILL QUERY con_id;
|
||||||
|
ERROR 70100: Query execution was interrupted
|
||||||
drop table t1;
|
drop table t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
|
@ -346,20 +346,26 @@ LOCK TABLE t1 WRITE;
|
|||||||
--let $con_id = `SELECT CONNECTION_ID()`
|
--let $con_id = `SELECT CONNECTION_ID()`
|
||||||
--send CREATE OR REPLACE TABLE t1 LIKE tmp
|
--send CREATE OR REPLACE TABLE t1 LIKE tmp
|
||||||
--connection default
|
--connection default
|
||||||
|
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
|
||||||
|
WHERE state= 'Waiting for table metadata lock';
|
||||||
|
--source include/wait_condition.inc
|
||||||
--replace_result $con_id con_id
|
--replace_result $con_id con_id
|
||||||
--eval KILL QUERY $con_id
|
--eval KILL QUERY $con_id
|
||||||
|
|
||||||
--connection con1
|
--connection con1
|
||||||
--error 0,ER_QUERY_INTERRUPTED
|
--error ER_QUERY_INTERRUPTED
|
||||||
--reap
|
--reap
|
||||||
--send CREATE OR REPLACE TABLE t1 (a int)
|
--send CREATE OR REPLACE TABLE t1 (a int)
|
||||||
|
|
||||||
--connection default
|
--connection default
|
||||||
|
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
|
||||||
|
WHERE state= 'Waiting for table metadata lock';
|
||||||
|
--source include/wait_condition.inc
|
||||||
--replace_result $con_id con_id
|
--replace_result $con_id con_id
|
||||||
--eval KILL QUERY $con_id
|
--eval KILL QUERY $con_id
|
||||||
|
|
||||||
--connection con1
|
--connection con1
|
||||||
--error 0,ER_QUERY_INTERRUPTED
|
--error ER_QUERY_INTERRUPTED
|
||||||
--reap
|
--reap
|
||||||
--disconnect con1
|
--disconnect con1
|
||||||
--connection default
|
--connection default
|
||||||
|
@ -4179,9 +4179,10 @@ void mysql_ull_set_explicit_lock_duration(THD *thd)
|
|||||||
When MDL detects a lock wait timeout, it pushes
|
When MDL detects a lock wait timeout, it pushes
|
||||||
an error into the statement diagnostics area.
|
an error into the statement diagnostics area.
|
||||||
For GET_LOCK(), lock wait timeout is not an error,
|
For GET_LOCK(), lock wait timeout is not an error,
|
||||||
but a special return value (0). NULL is returned in
|
but a special return value (0).
|
||||||
case of error.
|
Similarly, killing get_lock wait is not an error either,
|
||||||
Capture and suppress lock wait timeout.
|
but a return value NULL.
|
||||||
|
Capture and suppress lock wait timeouts and kills.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Lock_wait_timeout_handler: public Internal_error_handler
|
class Lock_wait_timeout_handler: public Internal_error_handler
|
||||||
@ -4200,7 +4201,7 @@ public:
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Lock_wait_timeout_handler::
|
Lock_wait_timeout_handler::
|
||||||
handle_condition(THD * /* thd */, uint sql_errno,
|
handle_condition(THD *thd, uint sql_errno,
|
||||||
const char * /* sqlstate */,
|
const char * /* sqlstate */,
|
||||||
Sql_condition::enum_warning_level /* level */,
|
Sql_condition::enum_warning_level /* level */,
|
||||||
const char *message,
|
const char *message,
|
||||||
@ -4211,6 +4212,9 @@ handle_condition(THD * /* thd */, uint sql_errno,
|
|||||||
m_lock_wait_timeout= true;
|
m_lock_wait_timeout= true;
|
||||||
return true; /* condition handled */
|
return true; /* condition handled */
|
||||||
}
|
}
|
||||||
|
if (thd->is_killed())
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2413,6 +2413,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
|
|||||||
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
|
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
|
||||||
break;
|
break;
|
||||||
case MDL_wait::KILLED:
|
case MDL_wait::KILLED:
|
||||||
|
get_thd()->send_kill_message();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user