IL-0569 DeNA · 2026-06-11 (published)database
After an MHA master failover, one of three MySQL replicas failed with a malformed binlog error and could not catch up
DeNA uses MHA, a MySQL high-availability tool that restores a correct replication topology with minimal downtime and data loss when a master fails. MySQL 5.7.9, released in 2015, changed mysqlbinlog to fix an error with GTID_MODE enabled (Bug #76887, Bug #20980932): when mysqlbinlog reads a Format_description_event (FDE), the metadata event at the start of a binlog, that the slave thread wrote into a relay log, it now prints only the comment # This Format_description_event appears in a relay log and was generated by the slave thread. and returns. A relay log starts with two FDEs, the slave's own and then the master's, and mysqlbinlog 5.7.8 still printed a BINLOG section for both.
During a failover MHA brings replicas up to date by joining log pieces in the order i1 (relay log received by a replica but not yet executed), i2 (relay log that one replica received and another did not) and X (binlog left on the old master that no replica received), and applies them through mysqlbinlog. The relay log always comes first, and MHA takes only the first FDE of the first file, which since 5.7.9 is no longer printed, so mysqlbinlog reaches a data update event before any usable FDE and fails. The error needs a replica on MySQL 5.7.9 or later and, during an MHA failover, either another replica that has read further into the old master's binlog (Read_Master_Log_Pos) or unexecuted relay log on this replica (Read_Master_Log_Pos different from Exec_Master_Log_Pos). That only happens when a master stops suddenly in the middle of transferring binlogs under real load, so the gap between MHA and the MySQL version stayed unnoticed for a long time and occurred only once in DeNA's environment.
When it did, the failover itself succeeded, but one of three replicas could not be brought up to date and then failed on later relay logs as well. The other instances were not affected, so removing this replica from service kept the impact on production small. The investigation happened some years before the article.
- Severity
- –
- Scope
- One of three replicas of the failed master could not apply data and was removed from service; the automatic failover kept the game service running
- Users affected
- –
- Region
- –
- Time to detect
- –
- Time to resolve
- –
Symptoms
On the event day of a global game, with close to 1000 rps per MySQL instance even after sharding and replication, a master instance stopped because of a host failure. MHA failed over automatically as usual and the service kept running, but one of the three replicas hit a replication error and could no longer follow the latest data.
The replica's error came from the data update step that MHA runs during failover, which could not read the relay log it had assembled: ERROR: malformed binlog: it does not contain any Format_description_log_event. I now found a Update_rows event, which is not safe to process without a Format_description_log_event. Because this one instance never received the latest data from the old master, the relay logs it later received from the new master also hit data inconsistency and could not be applied.
The investigation had to go from the data inconsistency in production to the MHA source code, and from there to the MySQL source code and the binlog format specification.
Symptom Replication lag
Root cause
Root cause Breaking change in an upgrade
- Trigger
- Under heavy load on a game event day, a MySQL master instance stopped because of a host failure, and MHA started an automatic failover.
Detection
–
Remediation
- Removed the replica that could not apply data from service
Action items
–
Lessons
MHA had not followed a mysqlbinlog change in MySQL 5.7.9, so under specific conditions bringing replicas up to date during failover failed. Running MySQL at large scale means meeting rare events like this, which only show when a master stops suddenly under load.
Sources
References
Related cases
IL-0308Most RevenueCat backend systems failed after cutover to a new Aurora PostgreSQL 14 cluster as queries became very slowRevenueCat · 2022same root cause · shared Database replication, Database
IL-0572About 10 million Pub/Sub messages backed up and Merpay accounting data was not written to Cloud Spanner for over a dayMercari · 2026same root cause · shared Database
IL-0304Intercom's US region was fully down for 71 minutes when its Vitess VTGates dropped all routes to the database shardsIntercom · 2026same root cause · shared Database
IL-0316Railway's control plane slowed and deployments stopped after a PgBouncer version jump used abnormal CPU and memoryRailway · 2025same root cause · shared Database
IL-0498Clerk's Postgres database had load spikes every 15 minutes and requests failed and slowed intermittently for four daysClerk · 2025same root cause · shared Database
IL-0444Reader connections to Repro's Aurora MySQL cluster were cut with Lost connection errors every time ALTER TABLE ranRepro · 2024same root cause · shared Database
IL-0117A scheduled maintenance and an ingress upgrade on OpenAI's user-facing clusters caused a networking control plane regression that briefly broke the data plane, and the services that restarted then overwhelmed a backend persistence store with a heavy first-start queryOpenAI · 2024same root cause · shared Database
IL-0314Daily's newly upgraded Aurora MySQL database deadlocked on meeting-event queries and its call servers kept restartingDaily · 2023same root cause · shared Database
IL-0294CircleCI Docker and machine jobs stalled for nearly 12 hours after a VM cleanup queue lost all its RabbitMQ consumersCircleCI · 2021same root cause · shared Database
IL-0372Heroku apps could not connect to about 1% of hobby-tier Postgres databases after the databases' host names changedHeroku · 2021same root cause · shared Database
Check your cluster for this
For AI tools and scripts
- This case as JSON: https://incidentlib-api.benchlet.com/cases/IL-0569
- The cases most like it: https://incidentlib-api.benchlet.com/cases/IL-0569/similar
- MCP server (Streamable HTTP, no key):
https://incidentlib-mcp.benchlet.com/mcp
The API needs no key. The MCP server offers search_incidents, get_incident, list_incidents, get_topic and vocab; both are explained on API and MCP.