Zhihui Cloud MySQL Online Schema Change: Automated Safe Large-Table Alterations
Zhihui Cloud's MySQL online schema change platform automates safe large-table alterations through a six-step workflow—audit, dry-run, tool selection, controlled execution, runtime protection, and verification—supporting direct DDL, pt-osc, and gh-ost with real-time guards for MDL locks, replication lag, load, and disk space.
Reading font

Why Large-Table Schema Changes Need Online Execution
Schema changes—adding columns, indexes, modifying types, converting charsets—are routine but risky on production tables carrying live traffic. Direct DDL can cause MDL lock waits, replication lag, rapid disk consumption, and increased instance load. Tools like gh-ost and pt-online-schema-change (pt-osc) enable online changes, yet tool selection, parameter tuning, monitoring, exception handling, and result verification still demand extensive manual expertise.
End-to-End Workflow: From SQL Submission to Verified Result
The platform codifies operational experience into six automated stages:
Audit first: Parse SQL, check change rules and runtime risks.
Dry-run first: Validate statement and schema compatibility in an isolated test environment (10-second timeout).
Auto routing: Match SQL and instance conditions to the optimal execution path.
Controlled execution: Dynamically throttle online copy tasks based on runtime state.
Continuous protection: Monitor MDL locks, replication lag, instance load, and disk space.
Result confirmation: Verify final schema, clean up temporary objects, and report via ticket.
The platform covers four operation types—create, alter, drop, truncate—each with specific submission checks and post-execution confirmations (see table below).
Three Execution Paths: How the Platform Chooses
The backend offers three routes: direct DDL, pt-osc, and gh-ost. Routing logic:
Direct DDL: Preferred when MySQL version, SQL type, and schema meet native online rules (Instant, In-place, or Copy algorithm). Still watches MDL and resource overhead.
gh-ost: Chosen when ROW binlog format and same-city deployment conditions are satisfied. Uses binlog to capture and replay changes asynchronously, enabling fine-grained copy/replay control and coordinated cutover.
pt-osc: Fallback when gh-ost conditions aren't met but pre-checks allow online copy. Relies on triggers on the original table to sync writes; requires attention to triggers, foreign keys, unique keys, and disk space.
Runtime Protections: Keeping Tasks Aligned with Business Health
MDL lock wait: Continuous detection before and during execution; tiered wait by table size. On block, task retains wait state and ownership; exceeds threshold → terminate and clean up.
Replication lag: Real-time monitoring; default pause copy when lag > 60 seconds. Resume automatically when lag recovers. Only the tool's copy action pauses; business traffic and existing replication continue.
Instance load: Watch connections and active threads. On threshold, pause copy or reduce batch size up to 50% ; ramp up when load drops. Pre-check flags queries running > 10 seconds to avoid resource contention.
Disk space: Pre-check requires free space ≥ 2× table size. During run, scan all nodes every 2 minutes . At > 85% usage or insufficient space, trigger binlog cleanup to relieve pressure from temporary data and logs.
Scheduled Changes: Avoiding Business Peaks
Business stability is top priority. If the platform detects sustained high concurrency or long queries with no suitable window, the task actively yields. For planned low-traffic windows, users can specify a start time; the platform launches the job at the appointed time.
Conclusion
Zhihui Cloud Online Schema Change turns a high-risk manual process into a governed platform capability: every change is validated first, protected during execution, and confirmed afterward. DBAs' experience becomes reusable platform rules; developers submit intent; operators gain clear visibility.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.