• unknown's avatar
    Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked · 6a1657ae
    unknown 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.
    
    
    mysql-test/r/innodb_mysql.result:
      Bug #29154: test case
    mysql-test/t/innodb_mysql.test:
      Bug #29154: test case
    sql/sql_parse.cc:
      Bug #29154: end the trasaction at a failing 
      LOCK TABLES so the handler can free its locks.
    6a1657ae
innodb_mysql.result 22.5 KB