Bug #70848 Reduce the work inside critical section in my_fopen() and my_register_filename()

Submitted: 7 Nov 2013 3:22 Modified: 18 Nov 2013 15:51
Reporter: Po-Chun Chang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S5 (Performance)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: patch, performance

[7 Nov 2013 3:22] Po-Chun Chang
Description:
Hi,

The optimization chance appears in the latest revision 6313 in version 5.7.
I have attached two simple patches that enables it.

The function my_strdup() in mysys/my_fopen.c:my_fopen() will not use and
change the shared variables. Therefore it could be executed before the 
critical section defined by THR_LOCK_open, which reduces the work in the
critical section.

Similar optimization also appears in mysys/my_open.c:my_register_filename(),
in which the function my_strdup() could be executed before critical section
defined by THR_LOCK_open.

How to repeat:
Once my_fopen() or my_register_filename() executes.

Suggested fix:
Move the my_strdup() calls outside the critical section.
[7 Nov 2013 3:23] Po-Chun Chang
Suggested patch for my_fopen()

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: patch1.diff (text/plain), 680 bytes.

[7 Nov 2013 3:23] Po-Chun Chang
Suggested patch for my_register_filename()

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: patch2.diff (text/plain), 621 bytes.

[7 Nov 2013 12:19] MySQL Verification Team
Thank you for the bug report and contribution.
[11 Nov 2013 20:14] David Stokes
The following contributions were processed by development:

* Contribution 20732 in bug 17757953 (Oracle) / 70848 (MySQL)
* Contribution 20733 in bug 17757953 (Oracle) / 70848 (MySQL)
[18 Nov 2013 15:51] Paul DuBois
Noted in 5.7.4 changelog.

Overhead was reduced within critical sections of the my_fopen() and 
my_register_filename() mysys functions. Thanks to Po-Chun Chang for
the patch.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.