• gkodinov/kgeorge@magare.gmz's avatar
    Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked · f93607d2
    gkodinov/kgeorge@magare.gmz authored
      LOCK TABLES takes a list of tables to lock. It may lock several 
      tables successfully and then encounter a tables that it can't lock, 
      e.g. because it's locked. In such case it needs to undo the locks on
      the already locked tables. And it does that. But it has also notified
      the relevant table storage engine handlers that they should lock.
      The only reliable way to ensure that the table handlers will give up
      their locks is to end the transaction. This is what UNLOCK TABLE 
      does : it ends the transaction if there were locked tables by LOCK 
      tables.
      It is possible to end the transaction when the lock fails in 
      LOCK TABLES because LOCK TABLES ends the transaction at its start 
      already. 
      Fixed by ending (again) the transaction when LOCK TABLES fails to
      lock a table.
    f93607d2
sql_parse.cc 230 KB