📄 ndblist.cpp
字号:
}/***************************************************************************void releaseNdbLabel(NdbLabel* aNdbLabel);Parameters: NdbLabel: The NdbLabel object.Remark: Add a NdbLabel object into the Label idlelist.***************************************************************************/voidNdb::releaseNdbLabel(NdbLabel* aNdbLabel){ theImpl->theLabelList.release(aNdbLabel);}/***************************************************************************void releaseNdbScanRec(NdbScanReceiver* aNdbScanRec);Parameters: aNdbScanRec: The NdbScanReceiver object.Remark: Add a NdbScanReceiver object into the Scan idlelist.***************************************************************************/voidNdb::releaseNdbScanRec(NdbReceiver* aNdbScanRec){ theImpl->theScanList.release(aNdbScanRec);}/***************************************************************************void releaseNdbSubroutine(NdbSubroutine* aNdbSubroutine);Parameters: NdbSubroutine: The NdbSubroutine object.Remark: Add a NdbSubroutine object into theSubroutine idlelist.***************************************************************************/voidNdb::releaseNdbSubroutine(NdbSubroutine* aNdbSubroutine){ theImpl->theSubroutineList.release(aNdbSubroutine);}/***************************************************************************void releaseOperation(NdbOperation* anOperation);Parameters: anOperation : The released NdbOperation object.Remark: Add a NdbOperation object into the signal idlelist.***************************************************************************/voidNdb::releaseOperation(NdbOperation* anOperation){ if(anOperation->m_tcReqGSN == GSN_TCKEYREQ){ anOperation->theNdbCon = NULL; anOperation->theMagicNumber = 0xFE11D0; theImpl->theOpIdleList.release(anOperation); } else { assert(anOperation->m_tcReqGSN == GSN_TCINDXREQ); anOperation->theNdbCon = NULL; anOperation->theMagicNumber = 0xFE11D1; theImpl->theIndexOpIdleList.release((NdbIndexOperation*)anOperation); }}/***************************************************************************void releaseScanOperation(NdbScanOperation* aScanOperation);Parameters: aScanOperation : The released NdbScanOperation object.Remark: Add a NdbScanOperation object into the signal idlelist.***************************************************************************/voidNdb::releaseScanOperation(NdbIndexScanOperation* aScanOperation){ DBUG_ENTER("Ndb::releaseScanOperation"); DBUG_PRINT("enter", ("op=%x", (UintPtr)aScanOperation));#ifdef ndb_release_check_dup { NdbIndexScanOperation* tOp = theScanOpIdleList; while (tOp != NULL) { assert(tOp != aScanOperation); tOp = (NdbIndexScanOperation*)tOp->theNext; } }#endif aScanOperation->theNdbCon = NULL; aScanOperation->theMagicNumber = 0xFE11D2; theImpl->theScanOpIdleList.release(aScanOperation); DBUG_VOID_RETURN;}/***************************************************************************void releaseRecAttr(NdbRecAttr* aRecAttr);Parameters: aRecAttr : The released NdbRecAttr object.Remark: Add a NdbRecAttr object into the RecAtt idlelist.***************************************************************************/voidNdb::releaseRecAttr(NdbRecAttr* aRecAttr){ aRecAttr->release(); theImpl->theRecAttrIdleList.release(aRecAttr);}/***************************************************************************void releaseSignal(NdbApiSignal* aSignal);Parameters: aSignal : The released NdbApiSignal object.Remark: Add a NdbApiSignal object into the signal idlelist.***************************************************************************/voidNdb::releaseSignal(NdbApiSignal* aSignal){#if defined VM_TRACE // Check that signal is not null assert(aSignal != NULL);#if 0 // Check that signal is not already in list NdbApiSignal* tmp = theSignalIdleList; while (tmp != NULL){ assert(tmp != aSignal); tmp = tmp->next(); }#endif#endif#ifdef POORMANSPURIFY creleaseSignals++;#endif theImpl->theSignalIdleList.release(aSignal);}voidNdb::releaseSignalsInList(NdbApiSignal** pList){ NdbApiSignal* tmp; while (*pList != NULL){ tmp = *pList; *pList = (*pList)->next(); releaseSignal(tmp); }}voidNdb::releaseNdbBlob(NdbBlob* aBlob){ aBlob->release(); theImpl->theNdbBlobIdleList.release(aBlob);}/****************************************************************************int releaseConnectToNdb(NdbTransaction* aConnectConnection);Return Value: -1 if error Parameters: aConnectConnection : Seized schema connection to DBTCRemark: Release and disconnect from DBTC a connection and seize it to theConIdleList.*****************************************************************************/voidNdb::releaseConnectToNdb(NdbTransaction* a_con) { DBUG_ENTER("Ndb::releaseConnectToNdb"); NdbApiSignal tSignal(theMyRef); int tConPtr;// I need to close the connection irrespective of whether I// manage to reach NDB or not. if (a_con == NULL) DBUG_VOID_RETURN; Uint32 node_id = a_con->getConnectedNodeId(); Uint32 conn_seq = a_con->theNodeSequence; tSignal.setSignal(GSN_TCRELEASEREQ); tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1); tSignal.setData(theMyRef, 2); tSignal.setData(a_con->ptr2int(), 3); a_con->Status(NdbTransaction::DisConnecting); a_con->theMagicNumber = 0x37412619; int ret_code = sendRecSignal(node_id, WAIT_TC_RELEASE, &tSignal, conn_seq); if (ret_code == 0) { ; } else if (ret_code == -1) { TRACE_DEBUG("Time-out when TCRELEASE sent"); } else if (ret_code == -2) { TRACE_DEBUG("Node failed when TCRELEASE sent"); } else if (ret_code == -3) { TRACE_DEBUG("Send failed when TCRELEASE sent"); } else if (ret_code == -4) { TRACE_DEBUG("Send buffer full when TCRELEASE sent"); } else if (ret_code == -5) { TRACE_DEBUG("Node stopping when TCRELEASE sent"); } else { ndbout << "Impossible return from sendRecSignal when TCRELEASE" << endl; abort(); }//if releaseNdbCon(a_con); DBUG_VOID_RETURN;}template<class T>staticNdb::Free_list_usage*update(Ndb::Free_list_usage* curr, Ndb_free_list_t<T> & list, const char * name){ curr->m_name = name; curr->m_created = list.m_alloc_cnt; curr->m_free = list.m_free_cnt; curr->m_sizeof = sizeof(T); return curr;}Ndb::Free_list_usage*Ndb::get_free_list_usage(Ndb::Free_list_usage* curr){ if (curr == 0) { return 0; } if(curr->m_name == 0) { update(curr, theImpl->theConIdleList, "NdbTransaction"); } else if(!strcmp(curr->m_name, "NdbTransaction")) { update(curr, theImpl->theOpIdleList, "NdbOperation"); } else if(!strcmp(curr->m_name, "NdbOperation")) { update(curr, theImpl->theScanOpIdleList, "NdbIndexScanOperation"); } else if(!strcmp(curr->m_name, "NdbIndexScanOperation")) { update(curr, theImpl->theIndexOpIdleList, "NdbIndexOperation"); } else if(!strcmp(curr->m_name, "NdbIndexOperation")) { update(curr, theImpl->theRecAttrIdleList, "NdbRecAttr"); } else if(!strcmp(curr->m_name, "NdbRecAttr")) { update(curr, theImpl->theSignalIdleList, "NdbApiSignal"); } else if(!strcmp(curr->m_name, "NdbApiSignal")) { update(curr, theImpl->theLabelList, "NdbLabel"); } else if(!strcmp(curr->m_name, "NdbLabel")) { update(curr, theImpl->theBranchList, "NdbBranch"); } else if(!strcmp(curr->m_name, "NdbBranch")) { update(curr, theImpl->theSubroutineList, "NdbSubroutine"); } else if(!strcmp(curr->m_name, "NdbSubroutine")) { update(curr, theImpl->theCallList, "NdbCall"); } else if(!strcmp(curr->m_name, "NdbCall")) { update(curr, theImpl->theNdbBlobIdleList, "NdbBlob"); } else if(!strcmp(curr->m_name, "NdbBlob")) { update(curr, theImpl->theScanList, "NdbReceiver"); } else if(!strcmp(curr->m_name, "NdbReceiver")) { return 0; } else { update(curr, theImpl->theConIdleList, "NdbTransaction"); } return curr;}#define TI(T) \ template Ndb::Free_list_usage* \ update(Ndb::Free_list_usage*, Ndb_free_list_t<T> &, const char * name);\ template struct Ndb_free_list_t<T>TI(NdbBlob);TI(NdbCall);TI(NdbLabel);TI(NdbBranch);TI(NdbSubroutine);TI(NdbApiSignal);TI(NdbRecAttr);TI(NdbOperation);TI(NdbReceiver);TI(NdbConnection);TI(NdbIndexOperation);TI(NdbIndexScanOperation);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -