Replication Management
Scope
This page describes MygramDB's own replication lifecycle. It does not manage MySQL promotion or replica topology. MygramDB reads from the endpoint in its startup configuration; changing that endpoint requires a configuration change and restart.
Coordination around maintenance
DUMP SAVE, DUMP LOAD, scheduled dumps, and SYNC coordinate with the single binlog reader. Where a dump operation needs a consistent position, it pauses and drains a running reader, then attempts to restart that reader when the operation ends. A reader that was already manually stopped remains stopped. A successful dump restore whose reader cannot restart leaves replication stopped and readiness false. A pause during a long dump can increase lag behind MySQL.
| Operation | Replication behavior | Reader impact |
|---|---|---|
DUMP SAVE | Pauses the reader for a consistent GTID, then resumes it | Search stays available; lag can grow while saving |
DUMP LOAD | Pauses the reader, replaces the state, then resumes from the dump's GTID | Restored data is swapped in atomically |
SYNC | Drains the shared reader, builds one table aside, then restarts | Restarts from the drained position |
OPTIMIZE | Holds the shared maintenance slot | Run it apart from dumps and SYNC |
In every case a reader that was already stopped by hand stays stopped. DUMP SAVE is refused with 6029 until every configured table has completed its initial load. After DUMP LOAD, readiness also requires replication to be available. One reader serves every configured table, which is why SYNC restarts from the position it drained to.
The long-running operations share one slot. A new request while another is active fails as busy; wait for the active operation to reach a terminal status.
Startup restore follows the same handoff. With replication enabled, dump.load_on_startup: true requires replication.start_from: snapshot; latest and gtid=... are rejected because they would ignore the dump's GTID. A missing or incompatible startup dump falls back to the normal MySQL initial snapshot. If the reader cannot start after a successful restore, MygramDB keeps serving the restored data with replication stopped and readiness false.
If replication starts but cannot catch up after restoring a startup dump, MygramDB stops the reader and starts in not_ready with the restored data available. It does not abort startup; inspect the replication error before directing traffic to the instance.
Source endpoint changes
mysql.host and mysql.port are immutable runtime variables. SET returns an immutable-variable error. To change sources, edit the configuration, validate it with mygramdb -t <config>, and restart.
An automatic reconnect stays on the configured endpoint. If that endpoint resolves to a MySQL server with a different source UUID, MygramDB rejects it instead of following it. Investigate the promotion or endpoint change, update the configuration when appropriate, and restart against the intended source.
Error 1236 alone does not mean that the required GTIDs were purged. MygramDB directs recovery to SYNC only when the source confirms that position was purged; other 1236 failures, including a replica ahead of the source, an oversized packet, or a corrupt binlog, stop with 2008 and the source message. MariaDB REPLICATION START refuses a purged position before starting.
Readiness while replication is paused
Temporary maintenance pauses do not by themselves mean the reader has failed. /health/ready and INFO account for the operation in progress. They remain not ready for an active SYNC or dump load, for uninitialized data, and for a replication reader that is neither running nor starting once no coordinated pause applies.
After a successful DUMP LOAD, restored tables count as initialized even if restarting replication fails; the data is present, but readiness remains false until replication is available. Use the health reason and replication error to decide whether to repair the MySQL connection, credentials, GTID history, or schema.
Operator checklist
- Before maintenance, check
/health/ready,INFO, and the activeSYNCor dump status. - Run one long operation at a time.
- After it completes, confirm replication is running and readiness is
ready. - For a source move, change configuration and restart; never issue runtime endpoint
SETcommands. - If replication stopped on error
2017, follow the special recovery in Replication.