The idea is as old as Replication is:
How do you know which is the most current slave.
You can use the Master_Binlog_Pos to guess what is
most up to date, but which transaction does this binlog position
match ?
With the proxy you can add a global transaction ID to your setup, if you let the inject some information into the stream.
The idea is simple and is documented in various places.
Create a MEMORY table which is replicated with a
single UNSIGNED BIGINT and increment it at the end
of each transaction.
CREATE TABLE trx (
trx_id BIGINT UNSIGNED NOT NULL
) ENGINE=memory;
INSERT INTO trx VALUES ( 0 );
When ever you commit a transaction UPDATE the
trx_id field:
UPDATE trx SET trx_id = trx_id + 1
Usecases:
- identify which slave is most current and …