LLM WikiAccess-protected knowledge portal

WIKI

BTS — Binlog Transfer System Quality Improvement (CDC)

AI Summary Purpose Capture durable knowledge about the batch oriented binlog CDC system that delivers database changes from distribution DBs to customer on premise DBs, plus later event level CDC design and PoC work. Key points Production d

경로ai/wiki/projects/bts.md
카테고리Project
태그#binlog #bts #cdc #data-pipeline #infra #mysql #portfolio #project #projects #wiki

# BTS — Binlog Transfer System Quality Improvement (CDC)

AI Summary

Purpose:

delivers database changes from distribution DBs to customer on-premise DBs, plus later event-level CDC design and PoC work.

Key points:

ROW-format binlog files, a Python/FastAPI download server serves raw files whose header is XOR-scrambled, and the customer-side Go Updater parses and applies their change events.

ParseFile, klauspost/compress/zstd for MySQL 8.4 compressed Transaction_payload, and go-sql-driver for parameterized SQL apply.

path. Event-level offset/checkpoint, retry queue, and DLQ belong to later design or PoC work and must not be presented as confirmed production behavior.

process, direct JSON file output, no Kafka needed) over Debezium+Kafka (more scalable but heavier), Canal (weak file output), and a raw mysqlbinlog parser.

DELETE, and DDL JSON events. It also confirms that the generic real-time CDC proposal was later deprecated; Maxwell and Kafka must not be described as the production path.

Transaction_payload events) is NOT supported by Maxwell. This blocked Maxwell, so the team built a custom Python CDC Collector instead.

zstandard, but it is not present in the verified production repository and must not be used as production resume evidence until its repository and rollout are confirmed.

system and completed deployment-scenario review. The technical-support team, not Hyunwook, deploys and operates it in approximately ten customer environments. Hyunwook receives operating issues, reproduces them, improves the implementation, and provides technical support.

databases receive binlog changes in batches, so real-time streaming was not the required delivery model.

batches, with files split when they exceed roughly 5 MB.

idempotent UPSERTs. The public v4 description records truncation error 110 as skip-and-advance, so end-to-end “no omissions” must not be claimed without a reconciliation or reprocessing path.

Relevant when:

selection, MySQL 8.4 compatibility, or the customer Updater.

Do not read full document unless:

retry/checkpoint design.

Linked documents:

Open Questions

design/PoC remain unknown. Production evidence should use the verified Go Updater path instead.

implemented or still proposed. Needs confirmation.

deployed.

Until confirmed, describe it as a known consistency boundary rather than as lossless processing.

Details

Confirmed production state and ownership boundary (2026-07-16)

day-to-day operation to the technical-support team.

environments.

and supports the technical-support team.

environments.

binlog changes in batches. Do not describe this as a real-time Kafka/Flink streaming platform.

raw binlog files with an XOR-scrambled header are served by the Python/FastAPI download server; the customer-side Go Updater performs offline row-event parsing, ZSTD Transaction_payload decompression, and parameterized SQL apply.

Problem

Binlog Shipping treats a binlog file as the unit of work. One file holds many events, so a single failing event blocks the whole file and forces a full re-download/re-import. There is no event-level checkpoint, so recovery position is unclear, and per-customer batch schedules add operational complexity.

CDC evaluation

CDC parses the binlog into structured per-row change events (insert/update/ delete) with metadata (schema, binlog position, timestamp), allowing event-level retry and offset-based checkpoints.

Tool comparison outcome:

JSON file output, low memory, simple ops. Best match for a file-based, pull-style delivery model rather than real-time streaming.

infra and higher operational complexity.

rejected.

rejected initially.

Confluence evidence adds two important boundaries:

flexibility, HA/scale, supported databases, and architectural complexity.

DDL, but identified no official MySQL sink. The later real-time proposal was marked deprecated, so these PoC benefits are not production claims.

Decisive constraint (MySQL 8.4)

binlog_transaction_compression wraps events in ZSTD-compressed Transaction_payload events. Maxwell does not support this → Maxwell rejected. The team pivoted to a custom Python CDC Collector.

Custom Python CDC Collector (design/PoC, not verified production)

then recursively parse the internal WRITE/UPDATE/DELETE row events.

SHOW BINARY LOG STATUS. DB connection + position lookup is separated from stream init to bypass library internals.

binlog_position, in-transaction offset, and total_row_count. On restart, open the stream at saved (file, pos) and skip offset events to resume exactly.

number within the current binlog file (reset to 1 on file rotation); offset = event order within a transaction block (reset to 0 per transaction); file_sequence = output filename sequence (reset to 0 on file rotation). On MySQL rotation, flush+close the current output file and reset.

count, offset, type (upsert/delete), table, schema, ts, rows.

Customer-side event-level redesign (proposed)

with Upsert (INSERT → REPLACE/ON DUPLICATE to fix INSERT-conflict issues).

Queue. A cdc_checkpoint table tracks source_file/source_offset with a UNIQUE key to prevent duplicate import and to resume from last offset.

Why this matters (durable lesson)

CDC tool selection must verify source-DB feature compatibility first: MySQL 8.4 ZSTD binlog compression silently breaks Maxwell. A thin custom collector on pymysqlreplication + zstandard is a viable fallback when off

연결 문서