MySQL Forums
Forum List  »  NDB clusters

Re: A question about the source code for the developers
Posted by: Mikael Ronström
Date: April 14, 2016 04:37PM

Hi David,
Sorry for not being faster in responding, heavily into 7.5
development right now. But you certainly found code which
is incorrect, this much is obvious.

What you have found is dead code which should be removed.
While going through the code I did however find some
suspicious code in this area which I will investigate a
bit further.

Here is what is going on and why it works:
DBLQH is the controller of the Local Data Manager.
Each update of a record is done in 3 phases
1) Prepare phase (normally through LQHKEYREQ)
2) Commit phase
3) Complete phase

The commit phase is handled differently in primary
replica and backup replicas. In primary replicas
the commit code is executed in the commit phase.
In backup replicas it is executed in the complete
phase. The activeCreat equal to AC_NR_COPY means
that the local copy is in the synchronisation phase
of a node restart. In this case we also perform
the commit handling in the commit phase.

So explained in the code below:

David Smith Wrote:
> Hi,I am currently reviewing the source code of
> DblqhMain.cpp and have found the following piece
> of code that I don't understand:
> if (seqNoReplica == 0 || activeCreat ==
> Fragrecord::AC_NR_COPY)
> {
> jam();
> commitReplyLab(signal);

This is primary replica OR a new fragment in the copy phase.
We are in the commit phase.

> return;
> }//if
> if (seqNoReplica == 0)
> {
> jam();

Primary replicas are not in the complete phase
when coming here (seqNoReplica means we come
here as primary replica).

> completeTransLastLab(signal);
> }
> inside the function Dblqh::tupcommit_conf(Signal*
> signal,
> TcConnectionrec * tcPtrP,
> Fragrecord * regFragptr)
> 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.
> Could the developer please explain what is going
> on here? I have seen similar construct in
> DbtcMain.cpp too, so it seems I have missed
> something...The version I am using is gpl-7.4.10

Thx for checking the code so carefully, I will make
sure that the dead code is removed. I will also
check the code around this, often there is a fire
when there is smoke, I did saw some interesting
things to investigate :)

Rgrds Mikael Ronström

> Thanks,
> David

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

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.