Bug #69392 Wasted work in waitForThreads()
Submitted: 4 Jun 2013 0:05 Modified: 10 Jun 2013 14:10
Reporter: Po-Chun Chang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S5 (Performance)
Version:5.6, 5.7 OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: patch, performance

[4 Jun 2013 0:05] Po-Chun Chang
Description:
The problem appears in version 5.6 and in the revision 5216 in
version 5.7.  I attached a simple one-line patch (patch.diff) that
fixes it.  This problem is similar to the already verified MySQL
#69207.

In method "waitForThreads()" in flexHammer.cpp, the loop on line 163 should 
break immediately after "cont" is set to 1. All the iterations after 
"cont" is set to 1 do not perform any useful work, at best they just
set "cont" again to 1.

There are two other similar problems at "flexBench.cpp" and "flexAsync.cpp",
in the functions with identical names (waitForThreads()).
I attached two more patches (patch2.diff, patch3.diff) for them.

How to repeat:
Once waitForThreads() is executed.

Suggested fix:
=== modified file 'storage/ndb/test/ndbapi/flexHammer.cpp'
--- storage/ndb/test/ndbapi/flexHammer.cpp	2013-02-26 05:45:28 +0000
+++ storage/ndb/test/ndbapi/flexHammer.cpp	2013-06-03 23:55:13 +0000
@@ -166,6 +166,7 @@
     for (int i = 0; i < tNoOfThreads ; i++) {
       if (threadArrayP[i].threadReady == 0) {
 	cont = 1;
+	break;
       } // if
     } // for
   } // while
[4 Jun 2013 0:06] Po-Chun Chang
Suggested patch for flexHammer.cpp

Attachment: patch.diff (text/plain), 376 bytes.

[4 Jun 2013 0:06] Po-Chun Chang
Suggested patch for flexBench.cpp

Attachment: patch2.diff (text/plain), 355 bytes.

[4 Jun 2013 0:07] Po-Chun Chang
Suggested patch for flexAsync.cpp

Attachment: patch3.diff (text/plain), 399 bytes.

[4 Jun 2013 6:23] MySQL Verification Team
Hello Po-Chun,

Thank you for the report and contribution.

Thanks,
Umesh
[10 Jun 2013 14:10] Magnus Blåudd
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Fixed from MySQL Cluster 7.0.39 and upwards
[17 Jun 2013 11:38] Jon Stephens
For documentation, see BUG#69393.