Bug #106956 The critical area of the pq_mutex in the trx_serialisation can be optimized
Submitted: 8 Apr 2022 9:16 Modified: 22 Apr 2022 2:13
Reporter: sibeier huang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[8 Apr 2022 9:16] sibeier huang
Description:
The purge_sys->pq_mutex protected area in the function's trx_serialisation_number_get exceeds what it must have. You really only need to perform the unlocking of the trx_sys_serialisation_mutex in it, just like the previous version.

The current problem is to put the function trx_add_to_serialisation_list in the protection of purge_sys->pq_mutex.

How to repeat:
Just read the code.

Suggested fix:
Move the extra parts out of the purge_sys->pq_mutex critical area just like the patch below.
[8 Apr 2022 9:21] sibeier huang
pq_mutex critical area optimization patches

Attachment: 8_0_28_wo_opt.patch (application/octet-stream, text), 1.58 KiB.

[8 Apr 2022 13:17] MySQL Verification Team
Hi Mr. huang,

Thank you for your performance improvement patch.

We have analysed carefully the entire code and we accept your patch as a valid one. We also concluded that it is not related only to Linux and ARM CPU, which is why we changed those categories.

Verified as reported.

Thanks again for your patch.
[8 Apr 2022 13:36] MySQL Verification Team
Thank you very much for your patch contribution, we appreciate it!

In order for us to continue the process of reviewing your contribution to MySQL, please send us a signed copy of the Oracle Contributor Agreement (OCA) as outlined in https://oca.opensource.oracle.com

Signing an OCA needs to be done only once and it's valid for all other Oracle governed Open Source projects as well.

Getting a signed/approved OCA on file will help us facilitate your contribution - this one, and others in the future.  

Please let me know, if you have any questions.

Thank you for your interest in MySQL.
[22 Apr 2022 2:13] sibeier huang
I have signed the oca agreement. By the way, in which version will this patch be incorporated?
[26 Apr 2022 11:29] Runchen Xu
A patch for this bug.

Attachment: 8028_srv_cpu_usage.patch (application/octet-stream, text), 880 bytes.

[26 Apr 2022 11:35] Runchen Xu
Sorry, I uploaded the patch under the wrong link, can someone help remove it?
[27 Apr 2022 13:26] MySQL Verification Team
Hi Mr. huang,

Sorry, but we do not have privileges for the removal of those files. They are removed automatically after several weeks.

Just post us the filename and its full path, once you have uploaded it correctly.

Thanks.