⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ndbcntrmain.cpp

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 CPP
📖 第 1 页 / 共 5 页
字号:
  jamEntry();  systemErrorLab(signal, __LINE__);  return;}//Ndbcntr::execTCROLLBACKREP()void Ndbcntr::execTCRELEASEREF(Signal* signal) {  jamEntry();  systemErrorLab(signal, __LINE__);  return;}//Ndbcntr::execTCRELEASEREF()void Ndbcntr::execTCSEIZEREF(Signal* signal) {  jamEntry();  systemErrorLab(signal, __LINE__);  return;}//Ndbcntr::execTCSEIZEREF()/*---------------------------------------------------------------------------*//*INITIALIZE VARIABLES AND RECORDS                                           *//*---------------------------------------------------------------------------*/void Ndbcntr::initData(Signal* signal) {  c_start.reset();  cmasterNodeId = 0;  cnoStartNodes = 0;  cnoWaitrep = 0;}//Ndbcntr::initData()/*---------------------------------------------------------------------------*//*RESET VARIABLES USED DURING THE START                                      *//*---------------------------------------------------------------------------*/void Ndbcntr::resetStartVariables(Signal* signal) {  cnoStartNodes = 0;  cnoWaitrep6 = cnoWaitrep7 = 0;}//Ndbcntr::resetStartVariables()/*---------------------------------------------------------------------------*/// SEND THE SIGNAL// INPUT                  CNDB_BLOCKS_COUNT/*---------------------------------------------------------------------------*/void Ndbcntr::sendNdbSttor(Signal* signal) {  NdbBlocksRecPtr ndbBlocksPtr;  ndbBlocksPtr.i = cndbBlocksCount;  ptrCheckGuard(ndbBlocksPtr, ZSIZE_NDB_BLOCKS_REC, ndbBlocksRec);  NdbSttor * const req = (NdbSttor*)signal->getDataPtrSend();  req->senderRef = reference();  req->nodeId = getOwnNodeId();  req->internalStartPhase = cinternalStartphase;  req->typeOfStart = ctypeOfStart;  req->masterNodeId = cmasterNodeId;    for (int i = 0; i < 16; i++) {    // Garbage    req->config[i] = 0x88776655;    //cfgBlockPtr.p->cfgData[i];  }    //#define MAX_STARTPHASE 2#ifdef TRACE_STTOR  ndbout_c("sending NDB_STTOR(%d) to %s",	   cinternalStartphase, 	   getBlockName( refToBlock(ndbBlocksPtr.p->blockref)));#endif  sendSignal(ndbBlocksPtr.p->blockref, GSN_NDB_STTOR, signal, 22, JBB);  cndbBlocksCount++;}//Ndbcntr::sendNdbSttor()/*---------------------------------------------------------------------------*/// JUST SEND THE SIGNAL/*---------------------------------------------------------------------------*/void Ndbcntr::sendSttorry(Signal* signal) {  signal->theData[3] = ZSTART_PHASE_1;  signal->theData[4] = ZSTART_PHASE_2;  signal->theData[5] = ZSTART_PHASE_3;  signal->theData[6] = ZSTART_PHASE_4;  signal->theData[7] = ZSTART_PHASE_5;  signal->theData[8] = ZSTART_PHASE_6;  // skip simulated phase 7  signal->theData[9] = ZSTART_PHASE_8;  signal->theData[10] = ZSTART_PHASE_9;  signal->theData[11] = ZSTART_PHASE_END;  sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 12, JBB);}//Ndbcntr::sendSttorry()voidNdbcntr::execDUMP_STATE_ORD(Signal* signal){  DumpStateOrd * const & dumpState = (DumpStateOrd *)&signal->theData[0];  if(signal->theData[0] == 13){    infoEvent("Cntr: cstartPhase = %d, cinternalStartphase = %d, block = %d", 	      cstartPhase, cinternalStartphase, cndbBlocksCount);    infoEvent("Cntr: cmasterNodeId = %d", cmasterNodeId);  }  if (dumpState->args[0] == DumpStateOrd::NdbcntrTestStopOnError){    if (theConfiguration.stopOnError() == true)      ((Configuration&)theConfiguration).stopOnError(false);        const BlockReference tblockref = calcNdbCntrBlockRef(getOwnNodeId());          SystemError * const sysErr = (SystemError*)&signal->theData[0];    sysErr->errorCode = SystemError::TestStopOnError;    sysErr->errorRef = reference();    sendSignal(tblockref, GSN_SYSTEM_ERROR, signal, 	       SystemError::SignalLength, JBA);  }}//Ndbcntr::execDUMP_STATE_ORD()void Ndbcntr::execSET_VAR_REQ(Signal* signal) {#if 0  SetVarReq* const setVarReq = (SetVarReq*)&signal->theData[0];  ConfigParamId var = setVarReq->variable();  switch (var) {  case TimeToWaitAlive:    // Valid only during start so value not set.    sendSignal(CMVMI_REF, GSN_SET_VAR_CONF, signal, 1, JBB);    break;  default:    sendSignal(CMVMI_REF, GSN_SET_VAR_REF, signal, 1, JBB);  }// switch#endif}//Ndbcntr::execSET_VAR_REQ()void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{  NodeStateRep * const stateRep = (NodeStateRep *)&signal->theData[0];  stateRep->nodeState = newState;  stateRep->nodeState.masterNodeId = cmasterNodeId;  stateRep->nodeState.setNodeGroup(c_nodeGroup);    for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){    sendSignal(ALL_BLOCKS[i].Ref, GSN_NODE_STATE_REP, signal,	       NodeStateRep::SignalLength, JBB);  }}voidNdbcntr::execRESUME_REQ(Signal* signal){  //ResumeReq * const req = (ResumeReq *)&signal->theData[0];  //ResumeRef * const ref = (ResumeRef *)&signal->theData[0];    jamEntry();  signal->theData[0] = NDB_LE_SingleUser;  signal->theData[1] = 2;  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);  //Uint32 senderData = req->senderData;  //BlockReference senderRef = req->senderRef;  NodeState newState(NodeState::SL_STARTED);		    updateNodeState(signal, newState);  c_stopRec.stopReq.senderRef=0;}voidNdbcntr::execSTOP_REQ(Signal* signal){  StopReq * const req = (StopReq *)&signal->theData[0];  StopRef * const ref = (StopRef *)&signal->theData[0];  Uint32 singleuser  = req->singleuser;  jamEntry();  Uint32 senderData = req->senderData;  BlockReference senderRef = req->senderRef;  bool abort = StopReq::getStopAbort(req->requestInfo);  if(getNodeState().startLevel < NodeState::SL_STARTED ||      abort && !singleuser){    /**     * Node is not started yet     *     * So stop it quickly     */    jam();    const Uint32 reqInfo = req->requestInfo;    if(StopReq::getPerformRestart(reqInfo)){      jam();      StartOrd * startOrd = (StartOrd *)&signal->theData[0];      startOrd->restartInfo = reqInfo;      sendSignal(CMVMI_REF, GSN_START_ORD, signal, 1, JBA);    } else {      jam();      sendSignal(CMVMI_REF, GSN_STOP_ORD, signal, 1, JBA);    }    return;  }  if(c_stopRec.stopReq.senderRef != 0 ||     (cmasterNodeId == getOwnNodeId() && !c_start.m_starting.isclear()))  {    /**     * Requested a system shutdown     */    if(!singleuser && StopReq::getSystemStop(req->requestInfo)){      jam();      sendSignalWithDelay(reference(), GSN_STOP_REQ, signal, 100,			  StopReq::SignalLength);      return;    }    /**     * Requested a node shutdown     */    if(c_stopRec.stopReq.senderRef &&       StopReq::getSystemStop(c_stopRec.stopReq.requestInfo))      ref->errorCode = StopRef::SystemShutdownInProgress;    else      ref->errorCode = StopRef::NodeShutdownInProgress;    ref->senderData = senderData;    sendSignal(senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);    return;  }    c_stopRec.stopReq = * req;  c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();    if(!singleuser) {    if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo)) {      jam();      if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){	((Configuration&)theConfiguration).stopOnError(false);      }    }    if(!c_stopRec.checkNodeFail(signal)){      jam();      return;    }    signal->theData[0] = NDB_LE_NDBStopStarted;    signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;    sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);  }  else  {    signal->theData[0] = NDB_LE_SingleUser;    signal->theData[1] = 0;    sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);  }  NodeState newState(NodeState::SL_STOPPING_1, 		     StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));     if(singleuser) {     newState.setSingleUser(true);     newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);   }  updateNodeState(signal, newState);  signal->theData[0] = ZSHUTDOWN;  sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);}voidNdbcntr::StopRecord::checkTimeout(Signal* signal){  jamEntry();  if(!cntr.getNodeState().getSingleUserMode())    if(!checkNodeFail(signal)){      jam();      return;    }  switch(cntr.getNodeState().startLevel){  case NodeState::SL_STOPPING_1:    checkApiTimeout(signal);    break;  case NodeState::SL_STOPPING_2:    checkTcTimeout(signal);    break;  case NodeState::SL_STOPPING_3:    checkLqhTimeout_1(signal);    break;  case NodeState::SL_STOPPING_4:    checkLqhTimeout_2(signal);    break;  case NodeState::SL_SINGLEUSER:    break;  default:    ndbrequire(false);  }}boolNdbcntr::StopRecord::checkNodeFail(Signal* signal){  jam();  if(StopReq::getSystemStop(stopReq.requestInfo)){    jam();    return true;  }  /**   * Check if I can survive me stopping   */  NodeBitmask ndbMask;   ndbMask.assign(cntr.c_startedNodes);  ndbMask.clear(cntr.getOwnNodeId());    CheckNodeGroups* sd = (CheckNodeGroups*)&signal->theData[0];  sd->blockRef = cntr.reference();  sd->requestType = CheckNodeGroups::Direct | CheckNodeGroups::ArbitCheck;  sd->mask = ndbMask;  cntr.EXECUTE_DIRECT(DBDIH, GSN_CHECKNODEGROUPSREQ, signal, 		      CheckNodeGroups::SignalLength);  jamEntry();  switch (sd->output) {  case CheckNodeGroups::Win:  case CheckNodeGroups::Partitioning:    return true;    break;  }    StopRef * const ref = (StopRef *)&signal->theData[0];        ref->senderData = stopReq.senderData;  ref->errorCode = StopRef::NodeShutdownWouldCauseSystemCrash;    const BlockReference bref = stopReq.senderRef;  cntr.sendSignal(bref, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);    stopReq.senderRef = 0;  if (cntr.getNodeState().startLevel != NodeState::SL_SINGLEUSER)  {    NodeState newState(NodeState::SL_STARTED);     cntr.updateNodeState(signal, newState);  }  signal->theData[0] = NDB_LE_NDBStopAborted;  cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 1, JBB);    return false;}voidNdbcntr::StopRecord::checkApiTimeout(Signal* signal){  const Int32 timeout = stopReq.apiTimeout;   const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;  const NDB_TICKS now = NdbTick_CurrentMillisecond();  if((timeout >= 0 && now >= alarm)){    // || checkWithApiInSomeMagicWay)    jam();    NodeState newState(NodeState::SL_STOPPING_2, 		       StopReq::getSystemStop(stopReq.requestInfo));    if(stopReq.singleuser) {      newState.setSingleUser(true);      newState.setSingleUserApi(stopReq.singleUserApi);    }    cntr.updateNodeState(signal, newState);    stopInitiatedTime = now;  }  signal->theData[0] = ZSHUTDOWN;  cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);}voidNdbcntr::StopRecord::checkTcTimeout(Signal* signal){  const Int32 timeout = stopReq.transactionTimeout;  const NDB_TICKS alarm = stopInitiatedTime + (NDB_TICKS)timeout;  const NDB_TICKS now = NdbTick_CurrentMillisecond();  if((timeout >= 0 && now >= alarm)){    // || checkWithTcInSomeMagicWay)    jam();    if(stopReq.getSystemStop(stopReq.requestInfo)  || stopReq.singleuser){      jam();      if(stopReq.singleuser) 	{	  jam();	   AbortAllReq * req = (AbortAllReq*)&signal->theData[0];	   req->senderRef = cntr.reference();	   req->senderData = 12;	   cntr.sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal, 		      AbortAllReq::SignalLength, JBB);	}       else	{	  WaitGCPReq * req = (WaitGCPReq*)&signal->theData[0];	  req->senderRef = cntr.reference();	  req->senderData = 12;	  req->requestType = WaitGCPReq::CompleteForceStart;	  cntr.sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal, 			  WaitGCPReq::SignalLength, JBB);	}    } else {      jam();      StopPermReq * req = (StopPermReq*)&signal->theData[0];      req->senderRef = cntr.reference();      req->senderData = 12;      cntr.sendSignal(DBDIH_REF, GSN_STOP_PERM_REQ, signal, 		      StopPermReq::SignalLength, JBB);    }    return;  }   signal->theData[0] = ZSHUTDOWN;  cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);}void Ndbcntr::execSTOP_PERM_REF(Signal* signal){  //StopPermRef* const ref = (StopPermRef*)&signal->theData[0];  jamEntry();  signal->theData[0] = ZSHUTDOWN;  sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);}void Ndbcntr::execSTOP_PERM_CONF(Signal* signal){  jamEntry();    AbortAllReq * req = (AbortAllReq*)&signal->theData[0];  req->senderRef = reference();  req->senderData = 12;  sendSignal(DBTC_REF, GSN_ABORT_ALL_REQ, signal, 	     AbortAllReq::SignalLength, JBB);}void Ndbcntr::execABORT_ALL_CONF(Signal* signal){  jamEntry();  if(c_stopRec.stopReq.singleuser) {    jam();    NodeState newState(NodeState::SL_SINGLEUSER);        newState.setSingleUser(true);    newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);    updateNodeState(signal, newState);        c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();    StopConf * const stopConf = (StopConf *)&signal->theData[0];    stopConf->senderData = c_stopRec.stopReq.senderData;    stopConf->nodeState  = (Uint32) NodeState::SL_SINGLEUSER;    sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);    c_stopRec.stopReq.senderRef = 0; // the command is done    signal->theData[0] = NDB_LE_SingleUser;    signal->theData[1] = 1;    signal->theData[2] = c_stopRec.stopReq.singleUserApi;    sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);  }  else     {      jam();      NodeState newState(Nod

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -