We are using a Galera cluster for MySQL 5.6.
We have been using python mysql replication client (https://github.com/noplay/python-mysql-replication) to keep track of all changes to DB mainly for debugging. This used to work fine. We got data that looked like following:
=== UpdateRowsEvent ===
Date: 2012-10-07T15:03:17
Event size: 45
Read bytes: 11
Table: test.test4
Affected columns: 3
Changed rows: 1
Affected columns: 3
Values:
--
* data : Hello => World
* id : 1 => 1
* data2 : World => Hello
Recently we changed the cluster configuration. We have added the following two parameters (based on the advice here https://severalnines.com/blog/how-set-asynchronous-replication-galera-cluster-standalone-mysql-server-gtid):
gtid_mode=ON
log_slave_updates=1
enforce_gtid_consistency
The cluster is still working correctly (although we have not been able to set up an asynchronous slave yet). But the behavior of the python replication client has changed. Now we are not getting any values in the events like earlier. This is all we get now:
=== UpdateRowsEvent ===
Date: 2019-07-15T13:01:22
Log position: 1384
Event size: 369
Read bytes: 23
Table: db.table
Affected columns: 42
Changed rows: 0
Affected columns: 42
Values:
()
"Changed rows" always remains 0. Most likely change to GTID mode affected the client. Is it still possible to get human readable values like earlier ?
The code to monitor replication events is as follows:
with open('../secrets.json') as f:
data = json.load(f)
mysql_settings = {'host': data['mysql']['ip'], 'port': data['mysql']['port'], \
'user': data['mysql']['user'], 'passwd': data['mysql']['password']}
stream = BinLogStreamReader(connection_settings = mysql_settings, server_id = 100,
log_file = "mysql-bin.001231", log_pos = 214, resume_stream = True)
for binlogevent in stream:
binlogevent.dump()
stream.close()
Finally we found a solution. It was pretty simple in the end. The user needs to have replication client, replication slave and read access to all the databases. Strangely the script does not give any error to that effect.