~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
1772
1772
{
1773
1773
  jamEntry();
1774
1774
  Uint32 errorCode = signal->theData[1];
1775
 
  if (errorCode == StartPermRef::ZNODE_ALREADY_STARTING_ERROR) {
 
1775
  if (errorCode == StartPermRef::ZNODE_ALREADY_STARTING_ERROR ||
 
1776
      errorCode == StartPermRef::ZNODE_START_DISALLOWED_ERROR) {
1776
1777
    jam();
1777
1778
    /*-----------------------------------------------------------------------*/
1778
1779
    // The master was busy adding another node. We will wait for a second and
2122
2123
  TstartNode_or_blockref = signal->theData[0];
2123
2124
  TsendNodeId = signal->theData[1];
2124
2125
 
2125
 
  if (TstartNode_or_blockref == clocallqhblockref) {
2126
 
    jam();
2127
 
    /*-----------------------------------------------------------------------*/
2128
 
    // THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK. 
2129
 
    // WE WILL NOW SEND INCLUDE TO THE TC BLOCK.
2130
 
    /*-----------------------------------------------------------------------*/
2131
 
    signal->theData[0] = reference();
2132
 
    signal->theData[1] = c_nodeStartSlave.nodeId;
2133
 
    sendSignal(clocaltcblockref, GSN_INCL_NODEREQ, signal, 2, JBB);
2134
 
    return;
2135
 
  }//if
2136
 
  if (TstartNode_or_blockref == clocaltcblockref) {
2137
 
    jam();
2138
 
    /*----------------------------------------------------------------------*/
2139
 
    // THIS SIGNAL CAME FROM THE LOCAL LQH BLOCK. 
2140
 
    // WE WILL NOW SEND INCLUDE TO THE DICT BLOCK.
2141
 
    /*----------------------------------------------------------------------*/
2142
 
    signal->theData[0] = reference();
2143
 
    signal->theData[1] = c_nodeStartSlave.nodeId;
2144
 
    sendSignal(cdictblockref, GSN_INCL_NODEREQ, signal, 2, JBB);
2145
 
    return;
2146
 
  }//if
2147
 
  if (TstartNode_or_blockref == cdictblockref) {
2148
 
    jam();
2149
 
    /*-----------------------------------------------------------------------*/
2150
 
    // THIS SIGNAL CAME FROM THE LOCAL DICT BLOCK. WE WILL NOW SEND CONF TO THE
2151
 
    // BACKUP.
2152
 
    /*-----------------------------------------------------------------------*/
2153
 
    signal->theData[0] = reference();
2154
 
    signal->theData[1] = c_nodeStartSlave.nodeId;
2155
 
    sendSignal(BACKUP_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
2156
 
    
2157
 
    // Suma will not send response to this for now, later...
2158
 
    sendSignal(SUMA_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
2159
 
    return;
2160
 
  }//if
2161
 
  if (TstartNode_or_blockref == numberToRef(BACKUP, getOwnNodeId())){
2162
 
    jam();
2163
 
    signal->theData[0] = c_nodeStartSlave.nodeId;
2164
 
    signal->theData[1] = cownNodeId;
2165
 
    sendSignal(cmasterdihref, GSN_INCL_NODECONF, signal, 2, JBB);
2166
 
    c_nodeStartSlave.nodeId = 0;
2167
 
    return;
 
2126
  Uint32 blocklist[6];
 
2127
  blocklist[0] = clocallqhblockref;
 
2128
  blocklist[1] = clocaltcblockref;
 
2129
  blocklist[2] = cdictblockref;
 
2130
  blocklist[3] = numberToRef(BACKUP, getOwnNodeId());
 
2131
  blocklist[4] = numberToRef(SUMA, getOwnNodeId());
 
2132
  blocklist[5] = 0;
 
2133
  
 
2134
  for (Uint32 i = 0; blocklist[i] != 0; i++)
 
2135
  {
 
2136
    if (TstartNode_or_blockref == blocklist[i])
 
2137
    {
 
2138
      jam();
 
2139
      if (getNodeStatus(c_nodeStartSlave.nodeId) == NodeRecord::ALIVE && 
 
2140
          blocklist[i+1] != 0)
 
2141
      {
 
2142
        /**
 
2143
         * Send to next in block list
 
2144
         */
 
2145
        jam();
 
2146
        signal->theData[0] = reference();
 
2147
        signal->theData[1] = c_nodeStartSlave.nodeId;
 
2148
        sendSignal(blocklist[i+1], GSN_INCL_NODEREQ, signal, 2, JBB);
 
2149
        return;
 
2150
      }
 
2151
      else
 
2152
      {
 
2153
        /**
 
2154
         * All done, reply to master
 
2155
         */
 
2156
        jam();
 
2157
        signal->theData[0] = c_nodeStartSlave.nodeId;
 
2158
        signal->theData[1] = cownNodeId;
 
2159
        sendSignal(cmasterdihref, GSN_INCL_NODECONF, signal, 2, JBB);
 
2160
        
 
2161
        c_nodeStartSlave.nodeId = 0;
 
2162
        return;
 
2163
      }
 
2164
    }
2168
2165
  }
2169
2166
  
2170
2167
  ndbrequire(cmasterdihref = reference());
2283
2280
    StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0];
2284
2281
    ref->startingNodeId = startNode;
2285
2282
    ref->sendingNodeId = cownNodeId;
2286
 
    ref->errorCode = ZNODE_START_DISALLOWED_ERROR;
 
2283
    ref->errorCode = StartPermRef::ZNODE_START_DISALLOWED_ERROR;
2287
2284
    sendSignal(cmasterdihref, GSN_START_INFOREF, signal, 
2288
2285
               StartInfoRef::SignalLength, JBB);
2289
2286
    return;
5096
5093
  } else {
5097
5094
    ndbrequire(failedNodePtr.p->nodeStatus == NodeRecord::DYING);
5098
5095
  }//if
 
5096
 
 
5097
  if (ERROR_INSERTED(7181))
 
5098
  {
 
5099
    ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
 
5100
    CLEAR_ERROR_INSERT_VALUE;
 
5101
    signal->theData[0] = c_error_7181_ref;
 
5102
    signal->theData[1] = coldgcp;
 
5103
    execGCP_TCFINISHED(signal);
 
5104
  }
 
5105
  
5099
5106
  MasterGCPConf::State gcpState;
5100
5107
  switch (cgcpParticipantState) {
5101
5108
  case GCP_PARTICIPANT_READY:
5162
5169
    masterGCPConf->lcpActive[i] = SYSFILE->lcpActive[i];
5163
5170
  sendSignal(newMasterBlockref, GSN_MASTER_GCPCONF, signal, 
5164
5171
             MasterGCPConf::SignalLength, JBB);
 
5172
 
 
5173
  if (ERROR_INSERTED(7182))
 
5174
  {
 
5175
    ndbout_c("execGCP_TCFINISHED in MASTER_GCPREQ");
 
5176
    CLEAR_ERROR_INSERT_VALUE;
 
5177
    signal->theData[0] = c_error_7181_ref;
 
5178
    signal->theData[1] = coldgcp;
 
5179
    execGCP_TCFINISHED(signal);
 
5180
  }
5165
5181
}//Dbdih::execMASTER_GCPREQ()
5166
5182
 
5167
5183
void Dbdih::execMASTER_GCPCONF(Signal* signal) 
7923
7939
  } else if (cmasterState == MASTER_TAKE_OVER_GCP) {
7924
7940
    jam();
7925
7941
    //-------------------------------------------------------------
7926
 
    // We are currently taking over as master. We will delay the
7927
 
    // signal until we have completed the take over gcp handling.
 
7942
    // We are currently taking over as master. Ignore
 
7943
    // signal in this case since we will discover it in reception of 
 
7944
    // MASTER_GCPCONF.
7928
7945
    //-------------------------------------------------------------
7929
 
    sendSignalWithDelay(reference(), GSN_GCP_NODEFINISH, signal, 20, 3);
7930
7946
    return;
7931
7947
  } else {
7932
7948
    ndbrequire(cmasterState == MASTER_ACTIVE);
8061
8077
  cgckptflag = false;
8062
8078
  emptyverificbuffer(signal, true);
8063
8079
  cgcpParticipantState = GCP_PARTICIPANT_COMMIT_RECEIVED;
 
8080
  signal->theData[0] = calcDihBlockRef(masterNodeId);
8064
8081
  signal->theData[1] = coldgcp;
8065
8082
  sendSignal(clocaltcblockref, GSN_GCP_NOMORETRANS, signal, 2, JBB);
8066
8083
  return;
8070
8087
{
8071
8088
  jamEntry();
8072
8089
  CRASH_INSERTION(7007);
 
8090
  Uint32 retRef = signal->theData[0];
8073
8091
  Uint32 gci = signal->theData[1];
8074
8092
  ndbrequire(gci == coldgcp);
8075
8093
 
 
8094
  if (ERROR_INSERTED(7181) || ERROR_INSERTED(7182))
 
8095
  {
 
8096
    c_error_7181_ref = retRef; // Save ref
 
8097
    ndbout_c("killing %d", refToNode(cmasterdihref));
 
8098
    signal->theData[0] = 9999;
 
8099
    sendSignal(numberToRef(CMVMI, refToNode(cmasterdihref)),
 
8100
               GSN_NDB_TAMPER, signal, 1, JBB);
 
8101
    return;
 
8102
  }
 
8103
 
8076
8104
  cgcpParticipantState = GCP_PARTICIPANT_TC_FINISHED;
8077
8105
  signal->theData[0] = cownNodeId;
8078
8106
  signal->theData[1] = coldgcp;
8079
8107
  signal->theData[2] = cfailurenr;
8080
 
  sendSignal(cmasterdihref, GSN_GCP_NODEFINISH, signal, 3, JBB);
 
8108
  sendSignal(retRef, GSN_GCP_NODEFINISH, signal, 3, JBB);
8081
8109
}//Dbdih::execGCP_TCFINISHED()
8082
8110
 
8083
8111
/*****************************************************************************/