Overview
A travel platform fed bookings from Amazon RDS for MySQL into Kafka with the Debezium MySQL connector. During a planned Kafka Connect upgrade the connector was stopped for several hours. When it started again, the binlog position it needed no longer existed, and the schema history topic had also lost records. The only way back was a full re-snapshot of a large bookings database.
Challenge
RDS for MySQL purges binary logs quickly unless retention is set explicitly, and the Debezium connector needs the binlog from its last committed position. The schema history topic had been created with default retention, so it was trimmed on a schedule. The team found out about both at the same moment, with downstream search and pricing services stale until the snapshot finished.
Environment
Amazon RDS for MySQL 8.0 with row-based binlog; Kafka Connect on Kubernetes on AWS; Debezium MySQL connector; a Kafka cluster with default topic settings; downstream consumers building search and pricing views.
Approach
AceMQ took over as the escalation path for the pipeline. The first job was to make the next outage survivable: retention at the database and on the history topic, and an alert on connector state. The second was to replace the full re-snapshot with a path that backfills only what is missing, and to document when each recovery mode is safe.
Solution
- Set RDS binlog retention to cover the longest planned and unplanned outage and added an alert on the oldest binlog age against connector lag
- Recreated the schema history topic with one partition, no deletion and a replication factor matching the other Connect topics
- Added heartbeats and alerts on connector status and on time since the last event
- Introduced incremental snapshots with a signalling table so a table can be backfilled without stopping streaming
- Documented the snapshot and recovery modes, including why schema-only recovery is unsafe if the schema changed while the connector was stopped
- Rehearsed a Connect upgrade in staging, including a connector stopped for longer than usual, before the next production change
Outcome
The next Kafka Connect upgrade ran with the connector stopped for hours and resumed from its saved position with no snapshot. A backfill of one table now takes a signal rather than an outage, and the team no longer needs to escalate routine connector restarts.