On 21 October 2018, routine maintenance on network equipment cut one of GitHub's data centres off from the rest of its network for 43 seconds. GitHub's automated database failover reacted exactly as it was configured to, and the result was 24 hours and 11 minutes of degraded service: stale pages, paused webhooks, and no GitHub Pages builds.
Nothing crashed and no software had a bug in the usual sense. Every component did its job. The incident is worth studying because it shows what a network partition does to a replicated database, and why the repair takes so much longer than the fault.
What broke for users
GitHub stores Git repositories in one system and almost everything else in MySQL: issues, pull requests, comments, authentication, background job state. This incident was about the MySQL side.
For about a day, users saw information that was out of date or inconsistent. For most of the incident GitHub could not deliver webhook events or build and publish GitHub Pages sites. GitHub's report says that no user data was lost in the end, although a few seconds of database writes had to be reconciled by hand afterwards.
How GitHub's MySQL was set up
Four months before the incident, GitHub published a detailed description of its MySQL high availability design. Three parts of it matter here.
One primary per cluster. Each MySQL cluster has a single primary that accepts writes and many replicas that copy its changes and serve reads. GitHub's incident report says the clusters ranged from hundreds of gigabytes to nearly five terabytes, each with up to dozens of read replicas.
Orchestrator decides who is primary. Orchestrator is the tool GitHub uses to watch MySQL topologies and run automated failover. Several Orchestrator nodes run in different sites and agree among themselves using the Raft consensus algorithm. Only the Raft leader may perform a failover. The design post says nodes were placed so that no single data centre held a majority, which lets the surviving sites act if one site disappears.
Replication across the country is not synchronous. GitHub used MySQL semi-synchronous replication: the primary does not acknowledge a commit until at least one replica has received the change. But the design post says semi-sync was enabled on replicas in the same data centre as the primary. A write could therefore be acknowledged to the user once a nearby replica had it, before any copy reached the other coast.
The same post was open about a gap. It said that if a data centre holding a primary became isolated, applications inside it could still write to that primary, which might leave inconsistent state once the network returned.

The 43 seconds
At 22:52 UTC, maintenance work to replace failing 100G optical equipment caused a loss of connectivity between GitHub's US East Coast network hub and its primary US East Coast data centre. The link came back 43 seconds later.
In that window the Orchestrator nodes saw the following. The leader, which was in the East Coast data centre, could no longer reach a majority of its peers, so under Raft it gave up leadership. The Orchestrator nodes in the West Coast data centre and in an East Coast public cloud site could still reach each other. Together they formed a quorum and elected a new leader.
From the new leader's point of view, every MySQL primary in the East Coast data centre was unreachable. That is what a dead primary looks like, and Orchestrator's job is to replace dead primaries. It began promoting West Coast replicas to primary, cluster after cluster.
When the link was restored, the application tier immediately began sending writes to the new primaries on the West Coast.
Why GitHub could not simply switch back
The obvious move is to point everything back at the East Coast. Two facts made that unsafe.
First, the old East Coast primaries held a short burst of writes that had never been replicated to the West Coast. GitHub describes this as a few seconds of writes. On one of its busiest clusters, that was 954 writes.
Second, the new West Coast primaries had been accepting live writes since the failover. By the time the database team was assessing options, that amounted to nearly 40 minutes of traffic.
So each side had data the other lacked. MySQL replication is a single ordered stream of changes from one primary. A replica can only follow a primary whose history is an extension of its own. Here the two histories shared a common past and then forked, a state usually called split brain. Neither server could be made a replica of the other without throwing some writes away.
GitHub chose to keep the West Coast history as the truth, rebuild the East Coast from it, and deal with the East-only writes separately. In its own words, the strategy was to "prioritize data integrity over site usability and time to recovery".
That choice had an immediate cost. The application servers were on the East Coast and were built on the assumption that their database was in the same building. With primaries on the West Coast, most database calls now made a cross-country round trip, and GitHub says its applications could not cope with that latency. The service was up but unusable for many users.
The long recovery
All times are UTC, from GitHub's report.
| When | What happened |
|---|---|
| 21 Oct, 22:52 | Connectivity is lost for 43 seconds. Orchestrator fails clusters over to the West Coast. |
| 22:54 | Monitoring alerts begin. By 23:02 engineers see topologies containing only West Coast servers. |
| 23:07 | Deployment tooling is locked. Status goes to yellow at 23:09 and red at 23:13. |
| 23:19 | Webhook delivery and Pages builds are paused to avoid putting more data at risk. |
| 22 Oct, 00:05 | A plan is formed: restore East Coast servers from backups, synchronise them, fail back, then process queued jobs. |
| 06:51 | Several clusters are restored in the East and replicating from the West. Larger ones are still restoring. |
| 11:12 | All primaries are back on the East Coast. Many read replicas are still hours behind. |
| 13:15 | Near peak traffic, replication lag is growing. Extra read replicas in the public cloud come online to spread the load. |
| 16:24 | Replicas are in sync. GitHub fails over to the original topology. |
| 16:45 | Processing of the backlog begins: over five million webhook events and 80,000 Pages builds. |
| 23:03 | Backlog cleared. Status returns to green. |
Three things made this slow.
Restoring terabytes takes hours. The East Coast servers could not rejoin as they were, so they were rebuilt from backups. GitHub took backups every four hours, but they were stored remotely in a public cloud blob store. Transferring multiple terabytes, then decompressing, checksumming and loading them, took many hours. GitHub tested restores daily, so the duration was no surprise. What was new was needing to rebuild whole clusters at once.
Replication lag did not shrink in a straight line. At 06:51 GitHub estimated two more hours, by extending the catch-up rate it was observing. But catch-up followed a decay curve, and write load rose as Europe and then the US started their working day. After the primaries moved back east at 11:12, dozens of replicas were still hours behind. Because reads were spread over a large pool, any request might land on a stale replica, which is why users saw inconsistent data.

The backlog had its own hazards. When queued webhooks were finally processed, about 200,000 payloads had outlived an internal time-to-live and were dropped. GitHub paused, raised the limit and continued. It kept the status at red until the whole queue was done.
Why the safeguards did not catch it, and what changed
Orchestrator did not malfunction. GitHub wrote that its actions matched its configuration. The configuration allowed something the applications could not support: a primary on the opposite coast from the application tier.
Each layer was reasonable on its own. Raft correctly moved leadership to the side with a majority. Failover correctly replaced primaries that the majority could not reach. Local semi-sync correctly kept commits fast. The combination had never been exercised, because GitHub had not previously seen an internal partition of this kind. A failover built for a dead data centre fired for a 43-second blip, and by the time the blip ended the damage was done.
What GitHub said it changed:
- No cross-region promotion. Orchestrator's configuration was adjusted to stop it promoting primaries across regional boundaries.
- Reconciling the stranded writes. GitHub captured the MySQL binary logs holding the East-only writes and analysed which could be reconciled automatically and which needed contact with users.
- Better status reporting. Green, yellow and red could not express that some parts worked and others did not. GitHub sped up a move to per-component status.
- Multiple active data centres. A project already under way, to serve traffic from several sites in an active/active/active design and tolerate the loss of one facility, was given more urgency.
- Testing failure on purpose. GitHub committed to validating failure scenarios before they happen, with investment in fault injection and chaos engineering tooling.
The computer science underneath
Asynchronous replication and lost commits. A primary can wait for replicas before acknowledging a write, or not. Waiting for a distant replica makes every write slower. Not waiting means a failover can strand acknowledged writes. The lesson on replication and failover walks through that timeline, and explains why an old primary must be fenced off before a new one takes over.
Quorums and leader election. Raft guarantees there is at most one leader among the Orchestrator nodes, because a leader needs a majority. Consensus and leader election covers why. The subtle point here is that consensus protected the Orchestrator nodes' own state. It did not protect the MySQL data, which was replicated by a different, weaker mechanism.
Partitions force a choice. During a partition a system must either refuse some requests or risk inconsistency. Afterwards GitHub chose consistency at a heavy cost in availability. CAP and consistency models gives the vocabulary, including the latency trade-off that made a West Coast primary impractical.
Backups and restore time. A backup is only as useful as the time it takes to restore. Backups, point-in-time recovery and planning for disaster explains recovery time objectives and why a history can fork. And chaos engineering and game days describes the practice GitHub adopted afterwards.
What an interviewer could ask from this
What is split brain? Two nodes both act as the primary and accept different writes, so their histories diverge. It usually follows a partition in which the old primary was not stopped before a new one was promoted.
Orchestrator used Raft. Why was there still divergence? Raft made the Orchestrator nodes agree on who should be primary. It did not make MySQL writes wait for a majority. Data moved between coasts by asynchronous replication, so acknowledged writes could exist on only one side.
Why not fail back to the East Coast straight away? The West Coast had already accepted writes. Failing back would have discarded them, or mixed two incompatible histories.
Why not wait for the remote replica on every commit? Every write would then pay a cross-country round trip, and a slow link would stall all writes. That is a latency and availability cost paid all the time to cover a rare event.
How would you stop a short network blip from triggering a failover? Restrict automatic promotion to the same region, require the failure to persist for longer before acting across regions, and make a cross-region failover a human decision.
Why did users see stale data after the primaries moved back? Reads went to a pool of replicas, and many were hours behind while they replayed the backlog of changes.
Takeaways
- A partition lasting seconds can create a data divergence that takes a day to repair.
- Consensus among the failover controllers does not make the database itself consistent. Look at how the data is replicated.
- Automated failover needs to know what the application can tolerate, such as how far away a primary may be.
- Backups set a floor on recovery time. Measure the restore of a whole cluster, including the transfer.
- GitHub chose correct data over a quick return to service, and said so plainly.












