NotesSystem

MySQL

Also: MySQL Replication · InnoDB

The open-source relational database behind much of the web. Its replication is a leader (source) streaming a row-based binary log to replicas, asynchronous by default.

Design choices

  • Leader-Based Replication: one source, many replicas; MySQL 8 renamed master/slave to source/replica.
  • Replication Log: the binary log, row-based by default; binlog_format is deprecated, so row format is the future. Statement mode marks nondeterministic statements (RAND(), UUID()) unsafe.
  • Positions: global transaction IDs (GTIDs) let a replica find its place on a new source after Failover.
  • Synchronous vs Asynchronous Replication: asynchronous by default. Semisynchronous replication waits for one replica (by default) after syncing the binlog and before the engine commits (AFTER_SYNC), and falls back to asynchronous after a 10 s timeout.
  • Group Replication / InnoDB Cluster: a consensus-based option for automatic, majority-backed primary election.

Notable trade-offs

  • With classic replication, failover is external (Orchestrator, cloud managed services), so its correctness depends on tooling: GitHub's 2012 and 2018 incidents were both failover stories.
  • Async replication means some acknowledged writes can be lost on failover unless semisync (and its silent fallback) is managed.