--- /root/mysql-8.0.30/sql/log.cc 2022-07-07 05:36:34.000000000 +0800 +++ /root/mysql-8.0.30_new/sql/log.cc 2023-11-29 03:51:41.914345437 +0800 @@ -1295,6 +1295,9 @@ bool Query_logger::slow_log_write(THD *t /* do not log slow queries from replication threads */ if (thd->slave_thread && !opt_log_slow_replica_statements) return false; + /*when binlog_format=MIXED is set, or that are logged when binlog_format=ROW is set, are not added to the replica's slow query log, even if log_slow_replica_statements is enabled.*/ + if (thd->slave_thread && opt_log_slow_replica_statements && (thd->current_stmt_binlog_format == BINLOG_FORMAT_MIXED ||thd->current_stmt_binlog_format == BINLOG_FORMAT_ROW) ) return false; + /* fill in user_host value: the format is "%s[%s] @ %s [%s]" */ char user_host_buff[MAX_USER_HOST_SIZE + 1]; Security_context *sctx = thd->security_context();