Bug #110673 Optimize the garbage_collect of group_replication
Submitted: 13 Apr 2023 0:42 Modified: 1 Oct 2024 20:40
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S3 (Non-critical)
Version:all, 8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: garbage collection, group replicaiton

[13 Apr 2023 0:42] Fangxin Flou
Description:
In the current garbage_collect logic, for each key "is_subset_not_equals" will be called, this is not required as a Gtid_set_ref value may contains many keys, just once is required.

  Certification_info::iterator it = certification_info.begin();
  stable_gtid_set_lock->wrlock();
  while (it != certification_info.end()) {
    if (it->second->is_subset_not_equals(stable_gtid_set)) { /* very hot here */
      if (it->second->unlink() == 0) delete it->second;
      certification_info.erase(it++);
    } else
      ++it;
  }

How to repeat:
N/A

Suggested fix:
We could add a gc_version flag to Gtid_set_ref to avoid extra calls of "is_subset_not_equals".
[13 Apr 2023 0:43] Fangxin Flou
Patch of LOCK_status optimization for global statistics summary

Attachment: temp.log (application/octet-stream, text), 2.55 KiB.

[13 Apr 2023 0:45] Fangxin Flou
Patch of Optimize the garbage_collect of group_replication

Attachment: temp.log (application/octet-stream, text), 2.55 KiB.

[13 Apr 2023 6:59] MySQL Verification Team
Hello Fangxin Flou,

Thank you for the report and feedback.

Thanks,
Umesh
[1 Oct 2024 20:40] Jon Stephens
Documented fix as follows in the MySQL 8.0.41, 8.4.4, and 9.2.0 changelogs:

    Improved garbage collection in Group Replication by eliminating
    non-essential calls to is_subset_not_equals().

Closed.