| Bug #113038 | Contribution by Tencent: mi->data_lock not release if heartbeat event mismatch | ||
|---|---|---|---|
| Submitted: | 10 Nov 2023 7:26 | Modified: | 10 Nov 2023 8:35 |
| Reporter: | yewei Xu (OCA) | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
| Version: | 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[10 Nov 2023 8:35]
MySQL Verification Team
Hello Yewei Xu, Thank you for the report and contribution. Please ensure to re-send the patch via "Contribution" tab otherwise we would not be able to accept it. Thank you. regards, Umesh

Description: mi->data_lock will not release if slave receive replication heartbeat event with mismatched filename or position in function heartbeat_queue_event. How to repeat: review code Suggested fix: diff --git a/sql/rpl_replica.cc b/sql/rpl_replica.cc index 57dfb700ea5..c0d3c3b4b4c 100644 --- a/sql/rpl_replica.cc +++ b/sql/rpl_replica.cc @@ -7526,6 +7526,7 @@ int heartbeat_queue_event(bool is_valid, Master_info *&mi, mi->report(ERROR_LEVEL, ER_REPLICA_HEARTBEAT_FAILURE, ER_THD(current_thd, ER_REPLICA_HEARTBEAT_FAILURE), oss.str().c_str()); + mysql_mutex_unlock(&mi->data_lock); return 1; } else if (mi->get_master_log_pos() > position) { std::ostringstream oss; @@ -7536,6 +7537,7 @@ int heartbeat_queue_event(bool is_valid, Master_info *&mi, mi->report(ERROR_LEVEL, ER_REPLICA_HEARTBEAT_FAILURE, ER_THD(current_thd, ER_REPLICA_HEARTBEAT_FAILURE), oss.str().c_str()); + mysql_mutex_unlock(&mi->data_lock); return 1; } /*