Bug #74844 killed_state save in ndbcluster_binlog retry at shutdown doesn't need to be vola
Submitted: 13 Nov 2014 22:39 Modified: 20 Mar 2015 15:26
Reporter: Stewart Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.7.5 OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 2014 22:39] Stewart Smith
Description:
--- mysql-5.7.5-m15.orig/sql/ha_ndbcluster_binlog.cc
+++ mysql-5.7.5-m15/sql/ha_ndbcluster_binlog.cc
@@ -7585,7 +7585,7 @@ restart_cluster_failure:
               {
                 DBUG_PRINT("error", ("Failed to write to ndb_binlog_index at shu
                 mysql_mutex_lock(&thd->LOCK_thd_data);
-                volatile THD::killed_state killed= thd->killed;
+                THD::killed_state killed= thd->killed;
                 /* We are cleaning up, allow for flushing last epoch */
                 thd->killed= THD::NOT_KILLED;
                 /* also clear error from last failing write */

The volatile keyword doesn't win us anything here, it will just prevent any optimizations and force loads/stores to local variable. At least in this case volatile isn't actively harmful, just not needed

How to repeat:
code analysis

Suggested fix:
apply my patch (attached)
[13 Nov 2014 22:40] Stewart Smith
remove volatile in ndbcluster_binlog codepath

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

Contribution: volatile-ndb-killed.patch (text/x-patch), 746 bytes.

[14 Nov 2014 12:55] MySQL Verification Team
Hello Stewart,

Thank you for the report and contribution.

Thanks,
Umesh
[20 Mar 2015 15:26] Jon Stephens
Fixed in trunk-cluster, currently known as NDB 7.5.0. This is an internal change only and not visible to users, so no changelog entry is required. Thanks for your contribution! 

Closed.