diff options
author | unknown <monty@mashka.mysql.fi> | 2002-12-13 16:36:08 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-12-13 16:36:08 +0200 |
commit | 8277893cffbb9e0d951025b2da85a627d730a9ce (patch) | |
tree | 287d42fa13c834e8692c6b685ee904fe07ead8b3 /sql/sql_parse.cc | |
parent | d2bae465344fcc81bb6fca940ed2025da7b52798 (diff) | |
parent | 446f23568ac12b5a26dabd63ec8fde5ffbd4c53e (diff) | |
download | mariadb-git-8277893cffbb9e0d951025b2da85a627d730a9ce.tar.gz |
Merge patch for LOCK TABLES and SLAVE STOP
configure.in:
merge with 4.0
scripts/mysqld_safe.sh:
Don't apply patch from 3.23
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bb26826b620..ea9c331af8f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1630,6 +1630,24 @@ mysql_execute_command(void) break; } case SQLCOM_SLAVE_STOP: + /* + If the client thread has locked tables, a deadlock is possible. + Assume that + - the client thread does LOCK TABLE t READ. + - then the master updates t. + - then the SQL slave thread wants to update t, + so it waits for the client thread because t is locked by it. + - then the client thread does SLAVE STOP. + SLAVE STOP waits for the SQL slave thread to terminate its + update t, which waits for the client thread because t is locked by it. + To prevent that, refuse SLAVE STOP if the + client thread has locked tables + */ + if (thd->locked_tables || thd->active_transaction()) + { + send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION); + break; + } { LOCK_ACTIVE_MI; stop_slave(thd,active_mi,1/* net report*/); |