diff --git a/sql/lock.cc b/sql/lock.cc index 6f1dd0669ee..08c109a17ab 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -197,6 +197,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } else if (rc == 1) /* aborted */ { + /* + reset_lock_data is required here. If thr_multi_lock fails it + resets lock type for tables, which were locked before (and + including) one that caused error. Lock type for other tables + preserved. + */ + reset_lock_data(sql_lock); thd->some_tables_deleted=1; // Try again sql_lock->lock_count= 0; // Locks are already freed }