Bug #39939 DROP TABLE/DISCARD TABLESPACE takes long time in buf_LRU_invalidate_tablespace()
Submitted: 8 Oct 2008 18:38 Modified: 19 Jun 2010 17:39
Reporter: Inaam Rana Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.x OS:Any
Assigned to: Inaam Rana CPU Architecture:Any

[8 Oct 2008 18:38] Inaam Rana
Description:
buf_LRU_invalidate_tablespace() works inefficiently if the table we are dropping is a large one, has many pages in the buffer pools and many of those pages have pointers in adaptive hash index. In such circumstances the buf_LRU_invalidate_tablepsace() degenerates to O(n^2) where n is the size of buffer pool in pages. This can give the 'illusion' of a hang. It is not a real hang as things are moving though at an agonizingly slow pace.

How to repeat:
Have a large table with a large buffer pool such that table has many adaptive hash index entries. Adaptive hash index entries are used by InnoDB to make selects more efficient.

Suggested fix:
Redesign the buf_LRU_invalidate_tablespace() to drop adaptive hash index entries in batches instead of doing it one by one.
[9 Oct 2008 10:10] Domas Mituzas
Just to make clear - this can cause InnoDB crashes due to long semaphore waits, so it isn't just "hang".
[12 Mar 2009 21:44] Paul DuBois
Noted in 5.0.79, 5.1.31, 6.0.10 changelogs.

For an InnoDB table, DROP TABLE or ALTER TABLE ... DISCARD TABLESPACE
could take a long time or cause a server crash.
[5 May 2010 15:09] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[6 May 2010 16:51] Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[28 May 2010 6:10] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:38] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 7:06] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[29 May 2010 15:35] Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[17 Jun 2010 12:15] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:02] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:42] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[29 Nov 2010 8:57] Marko Mäkelä
The merge of this fix to InnoDB Plugin and later introduced Bug #58549.