Percona-Lab / pacemaker-replication-agents

Repository of the Percona Pacemaker resource agents
ISC License
79 stars 55 forks source link

mysqlbinlog is slow for agent purposes #65

Open dotmanila opened 7 years ago

dotmanila commented 7 years ago

For example:

[root@mysql tmp]# time mysqlbinlog -vvv --base64-output=decode-rows mysqld-relay-bin.001185 | grep 'Xid =' -A2 | grep -v '\-\-' | tail -n 186 | egrep 'Xid|\# at [0-9]{2,10}' | tac | grep -A2 Xid |grep '# at ' | tail -n 1 | rev | cut -d' ' -f1 | rev
422883242

real    0m19.517s
user    0m23.235s
sys 0m5.289s

This can cause monitor call to timeout - we need something like MHA binlog parser but the agent is written in Shell, so we might need another solution - perhaps one in python.

sorcky commented 5 years ago

We encounter the same issue. Easiest solution is to write python/C "helper" to implement that slow loop, which calculates md5sum for each transaction. But even C implementation takes about 5 sec to scan 1G binlog