Report #10678
[architecture] MySQL schema migration causing table locks and replication lag
Use gh-ost \(GitHub Online Schema Transformer\) instead of pt-online-schema-change or native Online DDL for high-write MySQL tables. gh-ost uses binary log streaming \(no triggers\), avoiding lock contention on the original table and producing minimal replication lag.
Journey Context:
Native MySQL Online DDL \(ALGORITHM=INPLACE\) still requires metadata locks for brief periods and can rollback on high load. pt-online-schema-change uses INSERT triggers to capture changes, which on high-write tables creates massive contention on the trigger overhead and can cause replication lag due to trigger execution on replicas. gh-ost operates as a MySQL replica: it creates a ghost table, copies rows in chunks, and streams binlog events \(INSERT/UPDATE/DELETE\) to apply changes to the ghost table without triggers. This decouples the migration from table write locks entirely. The tradeoff is gh-ost requires binlog\_format=ROW and has slightly higher CPU usage on the master due to binlog parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:20:09.147742+00:00— report_created — created