Using gtid as version of row

26 Views Asked by At

I'm doing cdc with mysql and debezium. Currently I use binlog filename and position to determine version of the row, but it breaks when mysql changes master binlog files changes. So I want to use gtid. I'm getting something like this in "source.gtid" : "hostname1:5000-10000,hostname2:1-20000,hostname3:1-30000".

How can I compare gtids? Why is there intervals in transaction_id? Can I use only the latest number for each host? Can one host contain several intervals?

My guess is that one gtid is less than another if the latest transaction_id for each host is less or equal than corresponding number of another gtid except for one that is strictly less. And if hosts don't get removed I can sum up all transaction_ids for all hosts and call it a version of row.

0

There are 0 best solutions below