Bug #28614 ha_create_table() requires LOCK_open mutex to be held for some engines
Submitted: 23 May 2007 10:44 Modified: 18 Nov 2010 20:58
Reporter: Dmitry Lenev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Locking Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[23 May 2007 10:44] Dmitry Lenev
Description:
For some engines (e.g. NDB cluster) ha_create_table() requires LOCK_open to be owned before calling it. AFAIU this requirement is imposed by the fact that ha_create_table() for such tables ultimately calls assign_new_table_id() (see bug #19513 for stack trace proving that). There are several reasons why this requirement is not a good thing and should be removed long-term:
 - requirement to have LOCK_open for calling ha_create_table() 
   decreases concurrency. It should be enough to have an exclusive
   name-lock on table being created.
 - LOCK_open is actually detail of table-cache's implementation and its
   use should be avoided outside of its functions as much as possible.
 - It complicates things for federated handler. See bug #25679
   "Denial-of-Service against entire server if FEDERATED engine
    is compiled"

See also bug #18950 and bug #23667.

How to repeat:
Inspect code implementing CREATE TABLE and CREATE TABLE LIKE.
[18 Nov 2010 20:58] Dmitry Lenev
Hello!

This issue was fixed in 5.5.6 version of server by the patch that has fixed bug #41158. I will close this report as a Duplicate of this bug since problem reported in both of them are related and were fixed in the same patch.