-
Stored routine DDL statements use statement-based replication regardless of the current binlog format. The problem here was that if a DDL statement failed during metadata lock acquisition or opening of mysql.proc, the binlog format would not be reset before returning. So the following DDL or DML statements are binlogged with a wrong binlog format, which causes the slave to stop. The problem can be resolved by grabbing an exclusive MDL lock firstly instead of clearing the current binlog format. So that the binlog format will not be affected when the lock grab returns directly with an error. The same way is taken to open a proc table for update.
fa28ba8b