fix: detect silent replication partitions
Merged
RE
2mo ago+890+890+012345678901234567890123456789-6-6-0123456789
Summary
- Add configurable replication heartbeats (
--heartbeat-period, default 5s) before opening the binlog dump. - Add a bounded Connector/C read timeout (
--read-timeout, default 60s) so a silent network partition fails the replication stream instead of serving a frozen GTID set. - Enforce positive values, the 3x heartbeat relationship, and the Connector/C signed-millisecond upper bound (
INT_MAX / 1000). - Preserve the existing supervisor restart path and improve replication error diagnostics.
Verification
test_replication_timeouts-t: 28/28test_mariadb_gtid-t: 16/16- Live MySQL 8.0: heartbeat 3/3, startup 2/2, replication-failure shutdown 3/3
- Direct frozen-socket probe: reader exits within the configured timeout with the underlying lost-connection error
Fixes #48.
Summary by cubic
Fixes a silent network partition leaving the binlog reader alive and serving a frozen GTID set forever.
The reader now asks MySQL for replication heartbeats before opening the binlog stream and applies a read timeout to the replication connection, so a dead link fails the stream instead of blocking indefinitely, and the existing supervisor restart path takes over. Error reporting now falls back to the connector message when the replication error is empty, which is how a read timeout surfaces.
- Adds
--heartbeat-period(default 5s) and--read-timeout(default 60s); both must be positive, the read timeout at least three heartbeat periods and at most 2147483s, matching Connector/C's signed-millisecond limit. - Adds a live TAP test proving an idle stream survives beyond the read timeout thanks to heartbeats.
- Adds design and implementation-plan docs, including the MariaDB GTID reader spec that documents the snapshot fallback rule: a non-empty fifth column is parsed, and
@@gtid_binlog_pos(which may be empty) is used only when that column is missing or empty.
Fixes #48.
Summary by CodeRabbit
- New Features
- Added configurable replication heartbeat and read-timeout options, defaulting to 5 and 60 seconds. The reader sends heartbeat statements and applies the configured read timeout when connecting to the replication stream.
- Bug Fixes
- Invalid timeout settings are rejected at startup. Read failures now report clearer error details.
- Documentation
- Documented the options, defaults, validation limits, and reader behavior after read failures.