diff --git a/sql/rpl_context.cc b/sql/rpl_context.cc index 496ce8407761..63618c5cf5b9 100644 --- a/sql/rpl_context.cc +++ b/sql/rpl_context.cc @@ -62,6 +62,9 @@ inline bool Session_consistency_gtids_ctx::shall_collect(const THD *thd) { m_curr_session_track_gtids == SESSION_TRACK_GTIDS_ALL_GTIDS) && /* if there is no listener/tracker, then there is no reason to collect */ m_listener != nullptr && + /* No need to track GTIDs for system threads to avoid performance issues + like replication lag */ + thd->system_thread == NON_SYSTEM_THREAD && /* ROLLBACK statements may end up calling trans_commit_stmt */ thd->lex->sql_command != SQLCOM_ROLLBACK && thd->lex->sql_command != SQLCOM_ROLLBACK_TO_SAVEPOINT;