I recently installed two identical default installations of MySQL 5.7 under Ubuntu Server 16.04, and configured them to do a binary log replication. Until now this has been working fine, but suddenly the replication stops continuing and the slave query thread runs at 100% CPU without doing any work.
After some searching I found that the slave status tells that it is way behind master. Using mysqlbinlog on the binlog file indicated by Relay_Master_Log_File and position Exec_Master_Log_Pos, I found out that the statement executed at this position is:
SET @@SESSION.GTID_NEXT= 'ANONYMOUS';
Somehow the slave hangs when trying to execute this statement, sending the CPU load to 100% (which is how I discovered the situation in the first place).
Except by having the slave skip that statement using SET GLOBAL sql_slave_skip_counter=1
it is unclear to me what is the actual cause of this issue, and how I should solve this.
Any help would be really appreciated!