Bug #69394 Wasted work in NdbRestarter::waitNodesState()
Submitted: 4 Jun 2013 0:24 Modified: 10 Jun 2013 14:12
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:24] 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.

In method "waitNodesState()" in NdbRestarter.cpp, the loop on line 391 should 
break immediately after "waitMore" is set to false. All the iterations after 
"waitMore" is set to false do not perform any useful work, at best they just
set "waitMore" again to false.

How to repeat:
Once NdbRestarter::waitNodesState() is executed.

Suggested fix:
=== modified file 'storage/ndb/test/src/NdbRestarter.cpp'
--- storage/ndb/test/src/NdbRestarter.cpp	2013-02-26 06:21:48 +0000
+++ storage/ndb/test/src/NdbRestarter.cpp	2013-06-04 00:23:36 +0000
@@ -392,6 +392,7 @@
 	  if (ndbNodes[n].node_status != NDB_MGM_NODE_STATUS_STARTED &&
 	      ndbNodes[n].node_status != NDB_MGM_NODE_STATUS_STARTING)
 	    waitMore = false;
+	    break;
 
 	}
       }
[4 Jun 2013 0:24] Po-Chun Chang
Suggested patch

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

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

Thank you for the report and contribution.

Thanks,
Umesh
[10 Jun 2013 14:12] 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:36] Jon Stephens
Documented in the NDB 7.0.39, 7.1.28, 7.2.14, and 7.3.3 changelogs as follows:

        In a number of cases found in various locations in the MySQL Cluster
        codebase, unnecessary iterations were performed; this was caused by
        failing to break out of a repeating control structure after a test
        condition had been met. This community-contributed fix removes the
        unneeded repetitions by supplying the missing breaks.

Closed.
[17 Jun 2013 11:38] Jon Stephens
For documentation, see BUG#69393.