Bug #80900 execution paths that are never reached in the source code
Submitted: 30 Mar 2016 7:04 Modified: 4 Apr 2016 12:00
Reporter: David Smith Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S5 (Performance)
Version:Mysql-cluster-gpl-7.4.10 OS:Any
Assigned to: CPU Architecture:Any

[30 Mar 2016 7:04] David Smith
Description:
In DblqhMain.cpp,function Dblqh::tupcommit_conf(Signal* signal, 
TcConnectionrec * tcPtrP, 
Fragrecord * regFragptr) 

there is the following snippet of code:

if (seqNoReplica == 0 || activeCreat == Fragrecord::AC_NR_COPY) 
{ 
jam(); 
commitReplyLab(signal); 
return; 
}//if 
if (seqNoReplica == 0) 
{ 
jam(); 
completeTransLastLab(signal); 
} 

It seems the second 'if' never gets a chance to be executed unless the '||' operator in the first 'if' is not the regular Logical OR, but an overloaded operator defined by MySQL Cluster. I can't find such an definition in the file though.

There is a similar construct in Dblqh::commitReqLab(Signal* signal, Uint32 gci_hi, Uint32 gci_lo), the following is the snippet that puzzles me:

if (regTcPtr->seqNoReplica == 0 ||
      regTcPtr->activeCreat == Fragrecord::AC_NR_COPY) {
    jam();
    localCommitLab(signal);
    return;
  }//if
  commitReplyLab(signal);

Again the condition seqNoReplica == 0 is captured in the 'if' before the commitReplyLab() function call, but inside the code of commitReplyLab(signal), there is the following snippet:

    if (regTcPtr->seqNoReplica == 0) {
      jam();
      sendCommittedTc(signal, clientBlockref);
      return;
    } else {
      jam();
      sendCommitLqh(signal, clientBlockref);
      return;
    }//if

So the if (regTcPtr->seqNoReplica == 0) part is never executed. But this snippet basically says if we are at the primary replica, send the committed signal to TC; if we are not, ask the remaining replicas to commit. If my previous description of the meaning of the code is correct, then there is a problem: an important part of the commit logic is never executed.

I first ask this question in the forum, and Jon Stephens thinks I should file a bug report, so I am here...

And the following is the original post:http://forums.mysql.com/read.php?25,643918,643918#msg-643918

How to repeat:
 just read the code
[31 Mar 2016 8:58] Jon Stephens
Looks like some dead code to me, too.
[4 Apr 2016 12:00] MySQL Verification Team
thanks

kind regards
Bogdan Kecman