diff options
author | unknown <monty@mashka.mysql.fi> | 2002-12-13 16:03:59 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-12-13 16:03:59 +0200 |
commit | 446f23568ac12b5a26dabd63ec8fde5ffbd4c53e (patch) | |
tree | ab2e873402dab3821d2e248a3d7c3aa14e2966b2 | |
parent | 726f29f7e55d815e95bf56cb4b194302fa0c85f7 (diff) | |
parent | f84ce68116187295429174721214b809f8ef10dd (diff) | |
download | mariadb-git-446f23568ac12b5a26dabd63ec8fde5ffbd4c53e.tar.gz |
Merge work:/home/bk/mysql into mashka.mysql.fi:/home/my/mysql-3.23
-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 ddbc34b2c7e..f26be7f47e0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1376,6 +1376,24 @@ mysql_execute_command(void) start_slave(thd); 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; + } stop_slave(thd); break; |