FlexCDC is a change data capture utility for MySQL 5.1
Q: What is a change data capture (CDC) utility?
A change data capture utility detects row changes in the database, and takes some action on them such as writing them to a log file or log table.
Q: Why does Flexviews need a CDC utility?
In order to incrementally update views, Flexviews needs to know the specific details of each row change made in the database. FlexCDC reads MySQL binary logs, which record those row changes.
Q: Does FlexCDC replace MySQL replication?
While FlexCDC could be used as the basis for a custom replication system, it is used by Flexviews to record "old" and "new" images of rows when they change. These old and new versions are used in the view refresh process. I suggest that you create a dedicated slave server on which to run Flexviews, and that you use binlog_format=row and log_slave_updates=1 on this machine. You can use statement based replication, or a MySQL 5.0 master in this scenario, and the dedicated MySQL slave database will write the binary log in ROW format.
How it works
- FlexCDC invokes mysqlbinlog in an external process with the commandline options '--base64-output=decode-rows -v'. This instructs the utility to present RBR base64 entries as an easily readable SBR notation.
- mysqlbinlog connects to MySQL and asks for binary logs. The output from mysqlbinlog is captured by FlexCDC and processed further.
- Instead of applying the actual changes, FlexCDC records the changes into log tables. FlexCDC assigns a unique monotonically increasing transaction id to each set of changes. FlexCDC inserts each set changes into one or more table changelogs (one per changed table) in a single transaction.