Skip to content
2025 Kaufland e-commerce · Software & data / Platform

Automated validation and repair for CDC data

A tool that compares MySQL and BigQuery tables, shows their health in a dashboard, and triggers the right fix when they drift apart.

Context
Kaufland e-commerce, data platform
Role
Data Engineer, drove the initiative
When
2025

The situation

We replicate more than 800 MySQL tables to BigQuery with CDC, and about 3 new tables are added every week. Most of the time it works fine. But from time to time, a BigQuery table drifts from its source due: some records are missing, or records that were deleted in MySQL still exist in BigQuery.

This happens when the connector loses its position in the MySQL binlog, after an outage for example, or when the binlog files were already purged. The connector then restarts from the latest position, and a snapshot is needed to recover the missing data. The snapshot brings back the missing records, but not the deletes, since they were part of the skipped binlog files. Overall this a rare event, but we want to make sure that if it ever happens, we have an immediate solution for it.

Before the tool, we only found out when someone noticed and reported it. Then a data engineer had to check the table and fix it by hand.

What I built

The tool is based on Google’s open-source Data Validation Tool, and it has two parts.

The scanner

The scanner runs as scheduled tasks, one per source database. It reads the CDC configuration to know which MySQL table goes to which BigQuery table, then compares them, using ID- and timestamp-based checks with thresholds.

The results are saved in BigQuery, and a dashboard shows the health of each source database.

The remediator

When the scanner finds a table out of sync, it saves it to a MySQL table with the advised fix:

We used a MySQL table, not Kafka, to pass the requests between the scanner and the connector monitor. The scheduler already talks to MySQL, so it was the simplest option, and it can move to Kafka later if needed.