📄 ndblist.cpp
字号:
/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <NdbOut.hpp>#include <Ndb.hpp>#include <NdbOperation.hpp>#include <NdbIndexOperation.hpp>#include <NdbIndexScanOperation.hpp>#include "NdbApiSignal.hpp"#include <NdbRecAttr.hpp>#include "NdbUtil.hpp"#include "API.hpp"#include "NdbBlob.hpp"voidNdb::checkFailedNode(){ DBUG_ENTER("Ndb::checkFailedNode"); Uint32 *the_release_ind= theImpl->the_release_ind; if (the_release_ind[0] == 0) { DBUG_VOID_RETURN; } Uint32 tNoOfDbNodes = theImpl->theNoOfDBnodes; Uint8 *theDBnodes= theImpl->theDBnodes; DBUG_PRINT("enter", ("theNoOfDBnodes: %d", tNoOfDbNodes)); DBUG_ASSERT(tNoOfDbNodes < MAX_NDB_NODES); for (Uint32 i = 0; i < tNoOfDbNodes; i++){ const NodeId node_id = theDBnodes[i]; DBUG_PRINT("info", ("i: %d, node_id: %d", i, node_id)); DBUG_ASSERT(node_id < MAX_NDB_NODES); if (the_release_ind[node_id] == 1){ /** * Release all connections in idle list (for node) */ NdbTransaction * tNdbCon = theConnectionArray[node_id]; theConnectionArray[node_id] = NULL; while (tNdbCon != NULL) { NdbTransaction* tempNdbCon = tNdbCon; tNdbCon = tNdbCon->next(); releaseNdbCon(tempNdbCon); } the_release_ind[node_id] = 0; } } DBUG_VOID_RETURN;}/*************************************************************************** * int createConIdleList(int aNrOfCon); * * Return Value: Return the number of created connection object * if createConIdleList was succesful * Return -1: In all other case. * Parameters: aNrOfCon : Number of connections offered to the application. * Remark: Create connection idlelist with NdbTransaction objects. ***************************************************************************/ int Ndb::createConIdleList(int aNrOfCon){ theImpl->theConIdleList.fill(this, aNrOfCon); return aNrOfCon; }/*************************************************************************** * int createOpIdleList(int aNrOfOp); * * Return Value: Return the number of created operation object if * createOpIdleList was succesful. * Return -1: In all other case. * Parameters: aNrOfOp: Number of operations offered to the application. * Remark: Create operation idlelist with NdbOperation objects.. ***************************************************************************/ int Ndb::createOpIdleList(int aNrOfOp){ theImpl->theOpIdleList.fill(this, aNrOfOp); return aNrOfOp; }/*************************************************************************** * NdbBranch* NdbBranch(); * * Return Value: Return a NdbBranch if the getNdbBranch was successful. * Return NULL : In all other case. * Remark: Get a NdbBranch from theBranchList and return the object . ***************************************************************************/ NdbBranch*Ndb::getNdbBranch(){ return theImpl->theBranchList.seize(this);}/*************************************************************************** * NdbCall* NdbCall(); * * Return Value: Return a NdbCall if the getNdbCall was successful. * Return NULL : In all other case. * Remark: Get a NdbCall from theCallList and return the object . ***************************************************************************/ NdbCall*Ndb::getNdbCall(){ return theImpl->theCallList.seize(this);}/*************************************************************************** * NdbTransaction* getNdbCon(); * * Return Value: Return a connection if the getNdbCon was successful. * Return NULL : In all other case. * Remark: Get a connection from theConIdleList and return the object . ***************************************************************************/ NdbTransaction*Ndb::getNdbCon(){ NdbTransaction* tNdbCon = theImpl->theConIdleList.seize(this); tNdbCon->theMagicNumber = 0x37412619; return tNdbCon;}/*************************************************************************** * NdbLabel* getNdbLabel(); * * Return Value: Return a NdbLabel if the getNdbLabel was successful. * Return NULL : In all other case. * Remark: Get a NdbLabel from theLabelList and return the object . ***************************************************************************/ NdbLabel*Ndb::getNdbLabel(){ return theImpl->theLabelList.seize(this);}/*************************************************************************** * NdbScanReceiver* getNdbScanRec() * * Return Value: Return a NdbScanReceiver * Return NULL : In all other case. * Remark: Get a NdbScanReceiver from theScanRecList and return the * object . ****************************************************************************/ NdbReceiver*Ndb::getNdbScanRec(){ return theImpl->theScanList.seize(this);}/*************************************************************************** * NdbSubroutine* getNdbSubroutine(); * * Return Value: Return a NdbSubroutine if the getNdbSubroutine was successful. * Return NULL : In all other case. * Remark: Get a NdbSubroutine from theSubroutineList and return the object . ***************************************************************************/ NdbSubroutine*Ndb::getNdbSubroutine(){ return theImpl->theSubroutineList.seize(this);}/***************************************************************************NdbOperation* getOperation();Return Value: Return theOpList : if the getOperation was succesful. Return NULL : In all other case. Remark: Get an operation from theOpIdleList and return the object .***************************************************************************/ NdbOperation*Ndb::getOperation(){ return theImpl->theOpIdleList.seize(this);}/***************************************************************************NdbScanOperation* getScanOperation();Return Value: Return theOpList : if the getScanOperation was succesful. Return NULL : In all other case. Remark: Get an operation from theScanOpIdleList and return the object .***************************************************************************/ NdbIndexScanOperation*Ndb::getScanOperation(){ return theImpl->theScanOpIdleList.seize(this);}/***************************************************************************NdbIndexOperation* getIndexOperation();Return Value: Return theOpList : if the getIndexOperation was succesful. Return NULL : In all other case. Remark: Get an operation from theIndexOpIdleList and return the object .***************************************************************************/ NdbIndexOperation*Ndb::getIndexOperation(){ return theImpl->theIndexOpIdleList.seize(this);}/***************************************************************************NdbRecAttr* getRecAttr();Return Value: Return a reference to a receive attribute object. Return NULL if it's not possible to get a receive attribute object.***************************************************************************/NdbRecAttr*Ndb::getRecAttr(){ NdbRecAttr* tRecAttr = theImpl->theRecAttrIdleList.seize(this); if (tRecAttr != NULL) { tRecAttr->init(); return tRecAttr; } return NULL;}/***************************************************************************NdbApiSignal* getSignal();Return Value: Return a reference to a signal object. Return NULL if not possible to get a signal object.***************************************************************************/NdbApiSignal*Ndb::getSignal(){ return theImpl->theSignalIdleList.seize(this);}NdbBlob*Ndb::getNdbBlob(){ NdbBlob* tBlob = theImpl->theNdbBlobIdleList.seize(this); if(tBlob) { tBlob->init(); } return tBlob;}/***************************************************************************void releaseNdbBranch(NdbBranch* aNdbBranch);Parameters: NdbBranch: The NdbBranch object.Remark: Add a NdbBranch object into the Branch idlelist.***************************************************************************/voidNdb::releaseNdbBranch(NdbBranch* aNdbBranch){ theImpl->theBranchList.release(aNdbBranch);}/***************************************************************************void releaseNdbCall(NdbCall* aNdbCall);Parameters: NdbBranch: The NdbBranch object.Remark: Add a NdbBranch object into the Branch idlelist.***************************************************************************/voidNdb::releaseNdbCall(NdbCall* aNdbCall){ theImpl->theCallList.release(aNdbCall);}/***************************************************************************void releaseNdbCon(NdbTransaction* aNdbCon);Parameters: aNdbCon: The NdbTransaction object.Remark: Add a Connection object into the signal idlelist.***************************************************************************/voidNdb::releaseNdbCon(NdbTransaction* aNdbCon){ aNdbCon->theMagicNumber = 0xFE11DD; theImpl->theConIdleList.release(aNdbCon);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -