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

📄 ndbtransaction.cpp

📁 mysql-5.0.22.tar.gz源码包
💻 CPP
📖 第 1 页 / 共 5 页
字号:
Return Value:  Return 0 : receiveTC_COMMITREF was successful.               Return -1: In all other case.Parameters:    aSignal: The signal object pointer.Remark:        ******************************************************************************/int			NdbTransaction::receiveTC_COMMITREF(NdbApiSignal* aSignal){  const TcCommitRef * ref = CAST_CONSTPTR(TcCommitRef, aSignal->getDataPtr());  if(checkState_TransId(&ref->transId1)){    setOperationErrorCodeAbort(ref->errorCode);    theCommitStatus = Aborted;    theCompletionStatus = CompletedFailure;    theReturnStatus = ReturnFailure;    return 0;  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }  return -1;}//NdbTransaction::receiveTC_COMMITREF()/******************************************************************************int  receiveTCROLLBACKCONF(NdbApiSignal* aSignal);Return Value:  Return 0 : receiveTCROLLBACKCONF was successful.               Return -1: In all other case.Parameters:    aSignal: The signal object pointer.Remark:        ******************************************************************************/int			NdbTransaction::receiveTCROLLBACKCONF(NdbApiSignal* aSignal){  if(checkState_TransId(aSignal->getDataPtr() + 1)){    theCommitStatus = Aborted;    theCompletionStatus = CompletedSuccess;    return 0;  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }  return -1;}//NdbTransaction::receiveTCROLLBACKCONF()/*******************************************************************************int  receiveTCROLLBACKREF(NdbApiSignal* aSignal);Return Value:  Return 0 : receiveTCROLLBACKREF was successful.               Return -1: In all other case.Parameters:    aSignal: The signal object pointer.Remark:        *******************************************************************************/int			NdbTransaction::receiveTCROLLBACKREF(NdbApiSignal* aSignal){  if(checkState_TransId(aSignal->getDataPtr() + 1)){    setOperationErrorCodeAbort(aSignal->readData(4));    theCommitStatus = Aborted;    theCompletionStatus = CompletedFailure;    theReturnStatus = ReturnFailure;    return 0;  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }  return -1;}//NdbTransaction::receiveTCROLLBACKREF()/*****************************************************************************int receiveTCROLLBACKREP( NdbApiSignal* aSignal)Return Value:   Return 0 : send was succesful.                Return -1: In all other case.   Parameters:     aSignal: the signal object that contains the                 TCROLLBACKREP signal from TC.Remark:         Handles the reception of the ROLLBACKREP signal.*****************************************************************************/intNdbTransaction::receiveTCROLLBACKREP( NdbApiSignal* aSignal){  /****************************************************************************Check that we are expecting signals from this transaction and that it doesn'tbelong to a transaction already completed. Simply ignore messages from other transactions.  ****************************************************************************/  if(checkState_TransId(aSignal->getDataPtr() + 1)){    theError.code = aSignal->readData(4);// Override any previous errors    /**********************************************************************/    /*	A serious error has occured. This could be due to deadlock or */    /*	lack of resources or simply a programming error in NDB. This  */    /*	transaction will be aborted. Actually it has already been     */    /*	and we only need to report completion and return with the     */    /*	error code to the application.				      */    /**********************************************************************/    theCompletionStatus = CompletedFailure;    theCommitStatus = Aborted;    theReturnStatus = ReturnFailure;    return 0;  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }  return -1;}//NdbTransaction::receiveTCROLLBACKREP()/*******************************************************************************int  receiveTCKEYCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);Return Value:  Return 0 : receiveTCKEYCONF was successful.               Return -1: In all other case.Parameters:    aSignal: The signal object pointer.Remark:        *******************************************************************************/int			NdbTransaction::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength){  NdbReceiver* tOp;  const Uint32 tTemp = keyConf->confInfo;  /***************************************************************************Check that we are expecting signals from this transaction and that itdoesn't belong to a transaction already completed. Simply ignore messagesfrom other transactions.  ***************************************************************************/  if(checkState_TransId(&keyConf->transId1)){    const Uint32 tNoOfOperations = TcKeyConf::getNoOfOperations(tTemp);    const Uint32 tCommitFlag = TcKeyConf::getCommitFlag(tTemp);    const Uint32* tPtr = (Uint32 *)&keyConf->operations[0];    Uint32 tNoComp = theNoOfOpCompleted;    for (Uint32 i = 0; i < tNoOfOperations ; i++) {      tOp = theNdb->void2rec(theNdb->int2void(*tPtr++));      const Uint32 tAttrInfoLen = *tPtr++;      if (tOp && tOp->checkMagicNumber()) {	Uint32 done = tOp->execTCOPCONF(tAttrInfoLen);	if(tAttrInfoLen > TcKeyConf::SimpleReadBit){	  Uint32 node = tAttrInfoLen & (~TcKeyConf::SimpleReadBit);	  NdbNodeBitmask::set(m_db_nodes, node);	  if(NdbNodeBitmask::get(m_failed_db_nodes, node) && !done)	  {	    done = 1;	    tOp->setErrorCode(4119);	    theCompletionStatus = CompletedFailure;	    theReturnStatus = NdbTransaction::ReturnFailure;	  }	    	}	tNoComp += done;      } else { 	return -1;      }//if    }//for    Uint32 tNoSent = theNoOfOpSent;    theNoOfOpCompleted = tNoComp;    Uint32 tGCI    = keyConf->gci;    if (tCommitFlag == 1) {      theCommitStatus = Committed;      theGlobalCheckpointId = tGCI;    } else if ((tNoComp >= tNoSent) &&               (theLastExecOpInList->theCommitIndicator == 1)){      if (m_abortOption == AO_IgnoreError && theError.code != 0){	/**	 * There's always a TCKEYCONF when using IgnoreError	 */	return -1;      }/**********************************************************************/// We sent the transaction with Commit flag set and received a CONF with// no Commit flag set. This is clearly an anomaly./**********************************************************************/      theError.code = 4011;      theCompletionStatus = CompletedFailure;      theReturnStatus = NdbTransaction::ReturnFailure;      theCommitStatus = Aborted;      return 0;    }//if    if (tNoComp >= tNoSent) {      return 0;	// No more operations to wait for    }//if     // Not completed the reception yet.  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }    return -1;}//NdbTransaction::receiveTCKEYCONF()/*****************************************************************************int receiveTCKEY_FAILCONF( NdbApiSignal* aSignal)Return Value:   Return 0 : receive was completed.                Return -1: In all other case.   Parameters:     aSignal: the signal object that contains the                 TCKEY_FAILCONF signal from TC.Remark:         Handles the reception of the TCKEY_FAILCONF signal.*****************************************************************************/intNdbTransaction::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf){  NdbOperation*	tOp;  /*    Check that we are expecting signals from this transaction and that it     doesn't belong  to a transaction already completed. Simply ignore     messages from other transactions.  */  if(checkState_TransId(&failConf->transId1)){    /*      A node failure of the TC node occured. The transaction has      been committed.    */    theCommitStatus = Committed;    tOp = theFirstExecOpInList;    while (tOp != NULL) {      /*       * Check if the transaction expected read values...       * If it did some of them might have gotten lost even if we succeeded       * in committing the transaction.       */      switch(tOp->theOperationType){      case NdbOperation::UpdateRequest:      case NdbOperation::InsertRequest:      case NdbOperation::DeleteRequest:      case NdbOperation::WriteRequest:	tOp = tOp->next();	break;      case NdbOperation::ReadRequest:      case NdbOperation::ReadExclusive:      case NdbOperation::OpenScanRequest:      case NdbOperation::OpenRangeScanRequest:	theCompletionStatus = CompletedFailure;	theReturnStatus = NdbTransaction::ReturnFailure;	setOperationErrorCodeAbort(4115);	tOp = NULL;	break;      case NdbOperation::NotDefined:      case NdbOperation::NotDefined2:	assert(false);	break;      }//if    }//while       theReleaseOnClose = true;    return 0;  } else {#ifdef VM_TRACE    ndbout_c("Recevied TCKEY_FAILCONF wo/ operation");#endif  }  return -1;}//NdbTransaction::receiveTCKEY_FAILCONF()/*************************************************************************int receiveTCKEY_FAILREF( NdbApiSignal* aSignal)Return Value:   Return 0 : receive was completed.                Return -1: In all other case.   Parameters:     aSignal: the signal object that contains the                 TCKEY_FAILREF signal from TC.Remark:         Handles the reception of the TCKEY_FAILREF signal.**************************************************************************/intNdbTransaction::receiveTCKEY_FAILREF(NdbApiSignal* aSignal){  /*    Check that we are expecting signals from this transaction and    that it doesn't belong to a transaction already    completed. Simply ignore messages from other transactions.  */  if(checkState_TransId(aSignal->getDataPtr()+1)){    /*      We received an indication of that this transaction was aborted due to a      node failure.    */    if (theSendStatus == NdbTransaction::sendTC_ROLLBACK) {      /*	We were in the process of sending a rollback anyways. We will	report it as a success.      */      theCompletionStatus = NdbTransaction::CompletedSuccess;    } else {      theReturnStatus = NdbTransaction::ReturnFailure;      theCompletionStatus = NdbTransaction::CompletedFailure;      theError.code = 4031;    }//if    theReleaseOnClose = true;    theCommitStatus = NdbTransaction::Aborted;    return 0;  } else {#ifdef VM_TRACE    ndbout_c("Recevied TCKEY_FAILREF wo/ operation");#endif  }  return -1;}//NdbTransaction::receiveTCKEY_FAILREF()/******************************************************************************int  receiveTCINDXCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);Return Value:  Return 0 : receiveTCINDXCONF was successful.               Return -1: In all other case.Parameters:    aSignal: The signal object pointer.Remark:        ******************************************************************************/int			NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf, 				 Uint32 aDataLength){  if(checkState_TransId(&indxConf->transId1)){    const Uint32 tTemp = indxConf->confInfo;    const Uint32 tNoOfOperations = TcIndxConf::getNoOfOperations(tTemp);    const Uint32 tCommitFlag = TcKeyConf::getCommitFlag(tTemp);        const Uint32* tPtr = (Uint32 *)&indxConf->operations[0];    Uint32 tNoComp = theNoOfOpCompleted;    for (Uint32 i = 0; i < tNoOfOperations ; i++) {      NdbReceiver* tOp = theNdb->void2rec(theNdb->int2void(*tPtr));      tPtr++;      const Uint32 tAttrInfoLen = *tPtr;      tPtr++;      if (tOp && tOp->checkMagicNumber()) {	tNoComp += tOp->execTCOPCONF(tAttrInfoLen);      } else {	return -1;      }//if    }//for    Uint32 tNoSent = theNoOfOpSent;    Uint32 tGCI    = indxConf->gci;    theNoOfOpCompleted = tNoComp;    if (tCommitFlag == 1) {      theCommitStatus = Committed;      theGlobalCheckpointId = tGCI;    } else if ((tNoComp >= tNoSent) &&               (theLastExecOpInList->theCommitIndicator == 1)){      /**********************************************************************/      // We sent the transaction with Commit flag set and received a CONF with      // no Commit flag set. This is clearly an anomaly.      /**********************************************************************/      theError.code = 4011;      theCompletionStatus = NdbTransaction::CompletedFailure;      theCommitStatus = NdbTransaction::Aborted;      theReturnStatus = NdbTransaction::ReturnFailure;      return 0;    }//if    if (tNoComp >= tNoSent) {      return 0;	// No more operations to wait for    }//if     // Not completed the reception yet.  } else {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif  }  return -1;}//NdbTransaction::receiveTCINDXCONF()/*****************************************************************************int receiveTCINDXREF( NdbApiSignal* aSignal)Return Value:   Return 0 : send was succesful.                Return -1: In all other case.   Parameters:     aSignal: the signal object that contains the                 TCINDXREF signal from TC.Remark:         Handles the reception of the TCINDXREF signal.*****************************************************************************/intNdbTransaction::receiveTCINDXREF( NdbApiSignal* aSignal){  if(checkState_TransId(aSignal->getDataPtr()+1)){    theError.code = aSignal->readData(4);	// Override any previous errors    /**********************************************************************/    /*	A serious error has occured. This could be due to deadlock or */    /*	lack of resources or simply a programming error in NDB. This  */    /*	transaction will be aborted. Actually it has

⌨️ 快捷键说明

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