Databases 5 min read

Analysis of MySQL Bug #89126: Table Definition Cache Crash and Configuration Recommendations

This article examines MySQL bug #89126, explains how creating many tables can overflow the InnoDB table definition cache and cause crashes, illustrates the underlying mechanism with diagrams, and provides configuration advice to prevent the issue.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Analysis of MySQL Bug #89126: Table Definition Cache Crash and Configuration Recommendations

The article is part of the "Illustrated MySQL" series produced by the Aikesheng R&D team, aiming to deliver high‑quality technical content.

Bug description : MySQL Bug #89126 occurs when a database with many tables executes create table , leading to a crash due to exhaustion of the InnoDB table definition cache.

Phenomenon : Creating a large number of tables fills the table definition cache; subsequent create table ... statements have a certain probability of causing MySQL to crash, as shown in the stack trace image.

Principle diagram (viewable in landscape mode) illustrates the sequence:

Step 1 – create table ... inserts a new table definition into the cache and holds a reference, but the code releases the definition.

Step 2 – InnoDB performs cache reclamation and frees the already‑released table definition.

Step 3 – A subsequent create table ... uses the reference to the now‑freed definition, accessing reclaimed memory and causing a crash.

Fix – Change the behavior in step 1 to not release the table definition; this fix has not yet been accepted by the MySQL upstream.

Related knowledge points :

Table definition cache (table cache): InnoDB caches table definitions to reduce I/O pressure.

The cache maintains two data structures: a hash for fast lookup and an LRU (Least Recently Used) list for reclamation.

Cache reclamation runs periodically with two strategies – busy‑time and idle‑time – to minimize impact.

The cache can temporarily exceed its configured size, a design tied to the reclamation schedule.

The cache size limit is controlled by the table_definition_cache variable; the minimum is 400, and the default is calculated as min(400+table_open_cache/2,2000) .

Configuration suggestion : Unless you have tens of thousands of tables, set table_definition_cache slightly larger than the number of tables so that the cache can hold all definitions.

Further reading :

Bug description: https://bugs.mysql.com/bug.php?id=89126

MySQL official documentation on opening and releasing table definitions: https://dev.mysql.com/doc/refman/5.7/en/table-cache.html

performanceInnoDBMySQLbugDatabase ConfigurationTable Cache
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.