Bug #56841 show table status is not serialized relative create/drop table
Submitted: 17 Sep 2010 14:02 Modified: 17 Sep 2010 16:26
Reporter: Jonas Oreland Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Jonas Oreland CPU Architecture:Any

[17 Sep 2010 14:02] Jonas Oreland
Description:
When distributing create/drop table
  (i.e using several mysqld's attached to a cluster)
  LOCK_OPEN which protects mysqld's internal table list
  was released...so that queries/DML statements would not
  be blocked.

However, to make sure that other DDL is not executed simultaneous
  a global schema lock is used (implemented as a row-lock in ndb)

This means that all code path's that can modify state of internal table list
  needs to also acquire the global schema lock.

This was not true for "show table status"
 

How to repeat:
thread 1
while true
  create table t1;
  drop table t1;

thread 2:
while true
  show table status

Then after a while thread 1 will get an error on create table, "table already exists"

Suggested fix:
make sure "show table status" acquires global schema lock
[17 Sep 2010 14:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/118486

3297 Jonas Oreland	2010-09-17
      ndb - bug#56841 - serialize show table status relative create/drop table
[17 Sep 2010 14:47] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.47-ndb-7.0.19 (revid:jonas@mysql.com-20100917144451-l5l9ea7qotpab3t3) (version source revid:jonas@mysql.com-20100917144451-l5l9ea7qotpab3t3) (merge vers: 5.1.47-ndb-7.0.19) (pib:21)
[17 Sep 2010 14:48] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.47-ndb-6.3.38 (revid:jonas@mysql.com-20100917140117-r434x23i2qm4n0ta) (version source revid:jonas@mysql.com-20100917140117-r434x23i2qm4n0ta) (merge vers: 5.1.47-ndb-6.3.38) (pib:21)
[17 Sep 2010 14:49] Jonas Oreland
pushed to 6.3.38, 7.0.19 and 7.1.8
[17 Sep 2010 16:26] Jon Stephens
Documented bugfix in the NDB-6.3.38, 7.0.19, and 7.1.8 changelogs, as follows:

        When distributing CREATE TABLE and DROP TABLE operations among
        several SQL nodes attached to a MySQL Cluster. the LOCK_OPEN
        protecting the mysqld process internal table list is released so
        that other queries or DML statements are not blocked. However,
        to make sure that other DDL is not executed simultaneously, a
        global schema lock (implemented as a row-level lock by NDB) is
        used, such that all operations that can modify the state of the
        mysqld internal table list also need to acquire this global
        schema lock. However, the SHOW TABLE STATUS statement did not
        acquire this lock.

Closed.
[29 Sep 2010 10:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/119379

3288 Martin Skold	2010-09-29 [merge]
      Merge
      removed:
        cluster_change_hist.txt
      modified:
        mysql-test/collections/default.experimental
        mysql-test/suite/ndb/r/ndb_database.result
        mysql-test/suite/ndb/t/ndb_database.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
        sql/ha_ndbcluster_binlog.cc
        sql/handler.cc
        sql/handler.h
        sql/sql_show.cc
        sql/sql_table.cc
        storage/ndb/include/kernel/GlobalSignalNumbers.h
        storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp
        storage/ndb/include/mgmapi/mgmapi.h
        storage/ndb/include/ndbapi/NdbDictionary.hpp
        storage/ndb/src/kernel/blocks/ERROR_codes.txt
        storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
        storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
        storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
        storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
        storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
        storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp
        storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
        storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
        storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
        storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
        storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
        storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
        storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
        storage/ndb/src/kernel/blocks/ndbfs/VoidFs.cpp
        storage/ndb/src/kernel/blocks/suma/Suma.cpp
        storage/ndb/src/kernel/blocks/suma/Suma.hpp
        storage/ndb/src/kernel/main.cpp
        storage/ndb/src/ndbapi/DictCache.cpp
        storage/ndb/src/ndbapi/DictCache.hpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/test/include/NdbRestarter.hpp
        storage/ndb/test/ndbapi/testIndex.cpp
        storage/ndb/test/ndbapi/testRestartGci.cpp
        storage/ndb/test/ndbapi/testSystemRestart.cpp
        storage/ndb/test/run-test/daily-basic-tests.txt
        storage/ndb/test/src/NdbRestarter.cpp