diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-10-06 10:54:07 +0200 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-10-06 10:54:07 +0200 |
commit | d04832d195aba5badc42310eaa69c628a4a183bd (patch) | |
tree | cbe58ba165511396b212afaa1654a226d8ae88a4 /storage/ndb/src/ndbapi/Ndblist.cpp | |
parent | 282855e90bf052e2cf126adfaada61924cd8dd41 (diff) | |
parent | 3c2dca475dfa91c95f2488831fafacacaf852347 (diff) | |
download | mariadb-git-d04832d195aba5badc42310eaa69c628a4a183bd.tar.gz |
Merge
BitKeeper/etc/ignore:
auto-union
BUILD/autorun.sh:
Auto merged
BitKeeper/deleted/.del-bdb.vcproj~ed8534936e40cefb:
Auto merged
BitKeeper/deleted/.del-heap.vcproj~70c0cc1d680a51c1:
Auto merged
BitKeeper/deleted/.del-innobase.vcproj~71e1de81f11138bf:
Auto merged
BitKeeper/deleted/.del-myisam.vcproj~32bb9e4a163fcb5a:
Auto merged
BitKeeper/deleted/.del-myisammrg.vcproj~6534e59acbfbb63:
Auto merged
BitKeeper/deleted/.del-mysqld.vcproj~703886a28862bb2:
Auto merged
Makefile.am:
Auto merged
client/mysqltest.c:
Auto merged
include/my_global.h:
Auto merged
include/mysql_com.h:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/ndb_alter_table.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/ps_7ndb.result:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysys/default.c:
Auto merged
scripts/make_win_src_distribution.sh:
Auto merged
scripts/mysql_create_system_tables.sh:
Auto merged
scripts/mysql_fix_privilege_tables.sql:
Auto merged
sql/Makefile.am:
Auto merged
sql/field.cc:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_berkeley.h:
Auto merged
sql/ha_federated.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_acl.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
sql/unireg.cc:
Auto merged
storage/innobase/buf/buf0buf.c:
Auto merged
storage/innobase/buf/buf0flu.c:
Auto merged
storage/innobase/data/data0data.c:
Auto merged
storage/innobase/dict/dict0dict.c:
Auto merged
storage/innobase/include/btr0btr.h:
Auto merged
storage/innobase/include/data0type.ic:
Auto merged
storage/innobase/include/dict0dict.h:
Auto merged
storage/innobase/include/dict0mem.h:
Auto merged
storage/innobase/include/mem0mem.h:
Auto merged
storage/innobase/include/mem0mem.ic:
Auto merged
storage/innobase/include/os0file.h:
Auto merged
storage/innobase/include/row0mysql.h:
Auto merged
storage/innobase/include/trx0trx.h:
Auto merged
storage/innobase/include/ut0mem.h:
Auto merged
storage/innobase/mem/mem0mem.c:
Auto merged
storage/innobase/os/os0file.c:
Auto merged
storage/innobase/os/os0proc.c:
Auto merged
storage/innobase/rem/rem0rec.c:
Auto merged
storage/innobase/row/row0ins.c:
Auto merged
storage/innobase/row/row0mysql.c:
Auto merged
storage/innobase/srv/srv0start.c:
Auto merged
storage/innobase/trx/trx0sys.c:
Auto merged
storage/innobase/trx/trx0trx.c:
Auto merged
storage/innobase/ut/ut0mem.c:
Auto merged
storage/myisam/ft_boolean_search.c:
Auto merged
storage/myisam/mi_check.c:
Auto merged
storage/myisam/mi_dbug.c:
Auto merged
storage/myisam/mi_delete.c:
Auto merged
storage/myisam/mi_delete_all.c:
Auto merged
storage/myisam/mi_key.c:
Auto merged
storage/myisam/mi_open.c:
Auto merged
storage/myisam/mi_rkey.c:
Auto merged
storage/myisam/mi_search.c:
Auto merged
storage/myisam/mi_test1.c:
Auto merged
storage/myisam/mi_update.c:
Auto merged
storage/myisam/mi_write.c:
Auto merged
storage/myisam/myisamchk.c:
Auto merged
storage/myisam/myisamdef.h:
Auto merged
storage/myisam/myisampack.c:
Auto merged
storage/myisam/sp_key.c:
Auto merged
storage/myisammrg/myrg_rkey.c:
Auto merged
storage/ndb/include/kernel/GlobalSignalNumbers.h:
Auto merged
storage/ndb/include/kernel/signaldata/ApiVersion.hpp:
Auto merged
storage/ndb/include/kernel/signaldata/EventReport.hpp:
Auto merged
storage/ndb/include/kernel/signaldata/StopReq.hpp:
Auto merged
storage/ndb/include/mgmapi/ndb_logevent.h:
Auto merged
storage/ndb/include/ndbapi/NdbBlob.hpp:
Auto merged
storage/ndb/include/ndbapi/NdbIndexOperation.hpp:
Auto merged
storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp:
Auto merged
storage/ndb/include/ndbapi/NdbOperation.hpp:
Auto merged
storage/ndb/include/ndbapi/NdbRecAttr.hpp:
Auto merged
storage/ndb/include/ndbapi/NdbTransaction.hpp:
Auto merged
storage/ndb/src/common/util/SimpleProperties.cpp:
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Auto merged
storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp:
Auto merged
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp:
Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp:
Auto merged
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
Auto merged
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
Auto merged
storage/ndb/src/mgmapi/ndb_logevent.cpp:
Auto merged
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
Auto merged
storage/ndb/src/mgmsrv/Config.cpp:
Auto merged
storage/ndb/src/mgmsrv/Config.hpp:
Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
Auto merged
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Auto merged
storage/ndb/src/mgmsrv/InitConfigFileParser.hpp:
Auto merged
storage/ndb/src/mgmsrv/MgmtSrvr.hpp:
Auto merged
storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp:
Auto merged
storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp:
Auto merged
storage/ndb/src/mgmsrv/Services.cpp:
Auto merged
storage/ndb/src/mgmsrv/Services.hpp:
Auto merged
storage/ndb/src/mgmsrv/main.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbApiSignal.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbApiSignal.hpp:
Auto merged
storage/ndb/src/ndbapi/NdbBlob.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbImpl.hpp:
Auto merged
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbUtil.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbUtil.hpp:
Auto merged
storage/ndb/src/ndbapi/Ndbif.cpp:
Auto merged
storage/ndb/src/ndbapi/Ndblist.cpp:
Auto merged
storage/ndb/src/ndbapi/ObjectMap.hpp:
Auto merged
storage/ndb/test/include/NDBT_Test.hpp:
Auto merged
storage/ndb/test/ndbapi/bank/BankLoad.cpp:
Auto merged
storage/ndb/test/ndbapi/testOIBasic.cpp:
Auto merged
storage/ndb/test/src/HugoCalculator.cpp:
Auto merged
storage/ndb/test/src/NDBT_Test.cpp:
Auto merged
storage/ndb/test/src/NdbBackup.cpp:
Auto merged
storage/ndb/test/src/NdbRestarts.cpp:
Auto merged
storage/ndb/tools/ndb_condig.cpp:
Auto merged
storage/ndb/tools/restore/Restore.cpp:
Auto merged
storage/ndb/tools/restore/consumer_restore.cpp:
Auto merged
support-files/mysql.spec.sh:
Auto merged
configure.in:
merge
BUILD/SETUP.sh:
merge
BitKeeper/deleted/.del-mysql.sln~f2120278f8a437be:
SCCS merged
libmysqld/Makefile.am:
merge
sql/ha_ndbcluster.cc:
merge
sql/handler.h:
merge
sql/mysqld.cc:
merge
sql/opt_range.cc:
merge
sql/slave.cc:
merge
sql/slave.h:
e
merge
sql/sql_parse.cc:
merge
sql/table.cc:
merge
sql/examples/ha_tina.cc:
merge
sql/examples/ha_tina.h:
merge
sql/share/errmsg.txt:
merge
storage/ndb/include/ndbapi/Ndb.hpp:
merge
storage/ndb/src/common/debugger/EventLogger.cpp:
merge
storage/ndb/src/kernel/blocks/dbdict/Makefile.am:
merge
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
merge
storage/ndb/src/ndbapi/Ndbinit.cpp:
SCCS merged
Diffstat (limited to 'storage/ndb/src/ndbapi/Ndblist.cpp')
-rw-r--r-- | storage/ndb/src/ndbapi/Ndblist.cpp | 506 |
1 files changed, 132 insertions, 374 deletions
diff --git a/storage/ndb/src/ndbapi/Ndblist.cpp b/storage/ndb/src/ndbapi/Ndblist.cpp index 96d0f4d7de5..f82348fc91d 100644 --- a/storage/ndb/src/ndbapi/Ndblist.cpp +++ b/storage/ndb/src/ndbapi/Ndblist.cpp @@ -75,24 +75,7 @@ Ndb::checkFailedNode() int Ndb::createConIdleList(int aNrOfCon) { - for (int i = 0; i < aNrOfCon; i++) - { - NdbTransaction* tNdbCon = new NdbTransaction(this); - if (tNdbCon == NULL) - { - return -1; - } - if (theConIdleList == NULL) - { - theConIdleList = tNdbCon; - theConIdleList->next(NULL); - } else - { - tNdbCon->next(theConIdleList); - theConIdleList = tNdbCon; - } - tNdbCon->Status(NdbTransaction::NotConnected); - } + theImpl->theConIdleList.fill(this, aNrOfCon); return aNrOfCon; } @@ -108,19 +91,7 @@ Ndb::createConIdleList(int aNrOfCon) int Ndb::createOpIdleList(int aNrOfOp) { - for (int i = 0; i < aNrOfOp; i++){ - NdbOperation* tOp = new NdbOperation(this); - if ( tOp == NULL ){ - return -1; - } - if (theOpIdleList == NULL){ - theOpIdleList = tOp; - theOpIdleList->next(NULL); - } else{ - tOp->next(theOpIdleList); - theOpIdleList = tOp; - } - } + theImpl->theOpIdleList.fill(this, aNrOfOp); return aNrOfOp; } @@ -134,22 +105,7 @@ Ndb::createOpIdleList(int aNrOfOp) NdbBranch* Ndb::getNdbBranch() { - NdbBranch* tNdbBranch; - if ( theBranchList == NULL ) - { - tNdbBranch = new NdbBranch; - if (tNdbBranch == NULL) - { - return NULL; - } - tNdbBranch->theNext = NULL; - } else - { - tNdbBranch = theBranchList; - theBranchList = tNdbBranch->theNext; - tNdbBranch->theNext = NULL; - } - return tNdbBranch; + return theImpl->theBranchList.seize(this); } /*************************************************************************** @@ -162,22 +118,7 @@ Ndb::getNdbBranch() NdbCall* Ndb::getNdbCall() { - NdbCall* tNdbCall; - if ( theCallList == NULL ) - { - tNdbCall = new NdbCall; - if (tNdbCall == NULL) - { - return NULL; - } - tNdbCall->theNext = NULL; - } else - { - tNdbCall = theCallList; - theCallList = tNdbCall->theNext; - tNdbCall->theNext = NULL; - } - return tNdbCall; + return theImpl->theCallList.seize(this); } /*************************************************************************** @@ -190,19 +131,7 @@ Ndb::getNdbCall() NdbTransaction* Ndb::getNdbCon() { - NdbTransaction* tNdbCon; - if ( theConIdleList == NULL ) { - tNdbCon = new NdbTransaction(this); - if (tNdbCon == NULL) { - return NULL; - }//if - tNdbCon->next(NULL); - } else - { - tNdbCon = theConIdleList; - theConIdleList = tNdbCon->next(); - tNdbCon->next(NULL); - } + NdbTransaction* tNdbCon = theImpl->theConIdleList.seize(this); tNdbCon->theMagicNumber = 0x37412619; return tNdbCon; } @@ -217,22 +146,7 @@ Ndb::getNdbCon() NdbLabel* Ndb::getNdbLabel() { - NdbLabel* tNdbLabel; - if ( theLabelList == NULL ) - { - tNdbLabel = new NdbLabel; - if (tNdbLabel == NULL) - { - return NULL; - } - tNdbLabel->theNext = NULL; - } else - { - tNdbLabel = theLabelList; - theLabelList = tNdbLabel->theNext; - tNdbLabel->theNext = NULL; - } - return tNdbLabel; + return theImpl->theLabelList.seize(this); } /*************************************************************************** @@ -246,23 +160,7 @@ Ndb::getNdbLabel() NdbReceiver* Ndb::getNdbScanRec() { - NdbReceiver* tNdbScanRec; - if ( theScanList == NULL ) - { - tNdbScanRec = new NdbReceiver(this); - if (tNdbScanRec == NULL) - { - return NULL; - } - tNdbScanRec->next(NULL); - } else - { - tNdbScanRec = theScanList; - theScanList = tNdbScanRec->next(); - tNdbScanRec->next(NULL); - } - - return tNdbScanRec; + return theImpl->theScanList.seize(this); } /*************************************************************************** @@ -275,22 +173,7 @@ Ndb::getNdbScanRec() NdbSubroutine* Ndb::getNdbSubroutine() { - NdbSubroutine* tNdbSubroutine; - if ( theSubroutineList == NULL ) - { - tNdbSubroutine = new NdbSubroutine; - if (tNdbSubroutine == NULL) - { - return NULL; - } - tNdbSubroutine->theNext = NULL; - } else - { - tNdbSubroutine = theSubroutineList; - theSubroutineList = tNdbSubroutine->theNext; - tNdbSubroutine->theNext = NULL; - } - return tNdbSubroutine; + return theImpl->theSubroutineList.seize(this); } /*************************************************************************** @@ -303,18 +186,7 @@ Remark: Get an operation from theOpIdleList and return the object . NdbOperation* Ndb::getOperation() { - NdbOperation* tOp = theOpIdleList; - if (tOp != NULL ) { - NdbOperation* tOpNext = tOp->next(); - tOp->next(NULL); - theOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; + return theImpl->theOpIdleList.seize(this); } /*************************************************************************** @@ -327,18 +199,7 @@ Remark: Get an operation from theScanOpIdleList and return the object . NdbIndexScanOperation* Ndb::getScanOperation() { - NdbIndexScanOperation* tOp = theScanOpIdleList; - if (tOp != NULL ) { - NdbIndexScanOperation* tOpNext = (NdbIndexScanOperation*)tOp->next(); - tOp->next(NULL); - theScanOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbIndexScanOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; + return theImpl->theScanOpIdleList.seize(this); } /*************************************************************************** @@ -351,18 +212,7 @@ Remark: Get an operation from theIndexOpIdleList and return the object . NdbIndexOperation* Ndb::getIndexOperation() { - NdbIndexOperation* tOp = theIndexOpIdleList; - if (tOp != NULL ) { - NdbIndexOperation* tOpNext = (NdbIndexOperation*) tOp->next(); - tOp->next(NULL); - theIndexOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbIndexOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; + return theImpl->theIndexOpIdleList.seize(this); } /*************************************************************************** @@ -374,21 +224,14 @@ Return Value: Return a reference to a receive attribute object. NdbRecAttr* Ndb::getRecAttr() { - NdbRecAttr* tRecAttr; - tRecAttr = theRecAttrIdleList; - if (tRecAttr != NULL) { - NdbRecAttr* tRecAttrNext = tRecAttr->next(); + NdbRecAttr* tRecAttr = theImpl->theRecAttrIdleList.seize(this); + if (tRecAttr != NULL) + { tRecAttr->init(); - theRecAttrIdleList = tRecAttrNext; return tRecAttr; - } else { - tRecAttr = new NdbRecAttr; - if (tRecAttr == NULL) - return NULL; - tRecAttr->next(NULL); - }//if - tRecAttr->init(); - return tRecAttr; + } + + return NULL; } /*************************************************************************** @@ -400,34 +243,16 @@ Return Value: Return a reference to a signal object. NdbApiSignal* Ndb::getSignal() { - NdbApiSignal* tSignal = theSignalIdleList; - if (tSignal != NULL){ - NdbApiSignal* tSignalNext = tSignal->next(); - tSignal->next(NULL); - theSignalIdleList = tSignalNext; - } else { - tSignal = new NdbApiSignal(theMyRef); -#ifdef POORMANSPURIFY - cnewSignals++; -#endif - if (tSignal != NULL) - tSignal->next(NULL); - } -#ifdef POORMANSPURIFY - cgetSignals++; -#endif - return tSignal; + return theImpl->theSignalIdleList.seize(this); } NdbBlob* Ndb::getNdbBlob() { - NdbBlob* tBlob = theNdbBlobIdleList; - if (tBlob != NULL) { - theNdbBlobIdleList = tBlob->theNext; + NdbBlob* tBlob = theImpl->theNdbBlobIdleList.seize(this); + if(tBlob) + { tBlob->init(); - } else { - tBlob = new NdbBlob; } return tBlob; } @@ -441,8 +266,7 @@ Remark: Add a NdbBranch object into the Branch idlelist. void Ndb::releaseNdbBranch(NdbBranch* aNdbBranch) { - aNdbBranch->theNext = theBranchList; - theBranchList = aNdbBranch; + theImpl->theBranchList.release(aNdbBranch); } /*************************************************************************** @@ -454,8 +278,7 @@ Remark: Add a NdbBranch object into the Branch idlelist. void Ndb::releaseNdbCall(NdbCall* aNdbCall) { - aNdbCall->theNext = theCallList; - theCallList = aNdbCall; + theImpl->theCallList.release(aNdbCall); } /*************************************************************************** @@ -467,9 +290,8 @@ Remark: Add a Connection object into the signal idlelist. void Ndb::releaseNdbCon(NdbTransaction* aNdbCon) { - aNdbCon->next(theConIdleList); aNdbCon->theMagicNumber = 0xFE11DD; - theConIdleList = aNdbCon; + theImpl->theConIdleList.release(aNdbCon); } /*************************************************************************** @@ -481,8 +303,7 @@ Remark: Add a NdbLabel object into the Label idlelist. void Ndb::releaseNdbLabel(NdbLabel* aNdbLabel) { - aNdbLabel->theNext = theLabelList; - theLabelList = aNdbLabel; + theImpl->theLabelList.release(aNdbLabel); } /*************************************************************************** @@ -494,8 +315,7 @@ Remark: Add a NdbScanReceiver object into the Scan idlelist. void Ndb::releaseNdbScanRec(NdbReceiver* aNdbScanRec) { - aNdbScanRec->next(theScanList); - theScanList = aNdbScanRec; + theImpl->theScanList.release(aNdbScanRec); } /*************************************************************************** @@ -507,8 +327,7 @@ Remark: Add a NdbSubroutine object into theSubroutine idlelist. void Ndb::releaseNdbSubroutine(NdbSubroutine* aNdbSubroutine) { - aNdbSubroutine->theNext = theSubroutineList; - theSubroutineList = aNdbSubroutine; + theImpl->theSubroutineList.release(aNdbSubroutine); } /*************************************************************************** @@ -521,16 +340,14 @@ void Ndb::releaseOperation(NdbOperation* anOperation) { if(anOperation->m_tcReqGSN == GSN_TCKEYREQ){ - anOperation->next(theOpIdleList); anOperation->theNdbCon = NULL; anOperation->theMagicNumber = 0xFE11D0; - theOpIdleList = anOperation; + theImpl->theOpIdleList.release(anOperation); } else { assert(anOperation->m_tcReqGSN == GSN_TCINDXREQ); - anOperation->next(theIndexOpIdleList); anOperation->theNdbCon = NULL; anOperation->theMagicNumber = 0xFE11D1; - theIndexOpIdleList = (NdbIndexOperation*)anOperation; + theImpl->theIndexOpIdleList.release((NdbIndexOperation*)anOperation); } } @@ -553,10 +370,9 @@ Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation) } } #endif - aScanOperation->next(theScanOpIdleList); aScanOperation->theNdbCon = NULL; aScanOperation->theMagicNumber = 0xFE11D2; - theScanOpIdleList = aScanOperation; + theImpl->theScanOpIdleList.release(aScanOperation); DBUG_VOID_RETURN; } @@ -570,8 +386,7 @@ void Ndb::releaseRecAttr(NdbRecAttr* aRecAttr) { aRecAttr->release(); - aRecAttr->next(theRecAttrIdleList); - theRecAttrIdleList = aRecAttr; + theImpl->theRecAttrIdleList.release(aRecAttr); } /*************************************************************************** @@ -598,8 +413,7 @@ Ndb::releaseSignal(NdbApiSignal* aSignal) #ifdef POORMANSPURIFY creleaseSignals++; #endif - aSignal->next(theSignalIdleList); - theSignalIdleList = aSignal; + theImpl->theSignalIdleList.release(aSignal); } void @@ -616,162 +430,7 @@ void Ndb::releaseNdbBlob(NdbBlob* aBlob) { aBlob->release(); - aBlob->theNext = theNdbBlobIdleList; - theNdbBlobIdleList = aBlob; -} - -/*************************************************************************** -void freeOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeOperation() -{ - NdbOperation* tOp = theOpIdleList; - theOpIdleList = theOpIdleList->next(); - delete tOp; -} - -/*************************************************************************** -void freeScanOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeScanOperation() -{ - NdbIndexScanOperation* tOp = theScanOpIdleList; - theScanOpIdleList = (NdbIndexScanOperation *)tOp->next(); - delete tOp; -} - -/*************************************************************************** -void freeIndexOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeIndexOperation() -{ - NdbIndexOperation* tOp = theIndexOpIdleList; - theIndexOpIdleList = (NdbIndexOperation *) theIndexOpIdleList->next(); - delete tOp; -} - -/*************************************************************************** -void freeNdbBranch(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbBranch() -{ - NdbBranch* tNdbBranch = theBranchList; - theBranchList = theBranchList->theNext; - delete tNdbBranch; -} - -/*************************************************************************** -void freeNdbCall(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbCall() -{ - NdbCall* tNdbCall = theCallList; - theCallList = theCallList->theNext; - delete tNdbCall; -} - -/*************************************************************************** -void freeNdbScanRec(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbScanRec() -{ - NdbReceiver* tNdbScanRec = theScanList; - theScanList = theScanList->next(); - delete tNdbScanRec; -} - -/*************************************************************************** -void freeNdbCon(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbCon() -{ - NdbTransaction* tNdbCon = theConIdleList; - theConIdleList = theConIdleList->next(); - delete tNdbCon; -} - -/*************************************************************************** -void freeNdbLabel(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbLabel() -{ - NdbLabel* tNdbLabel = theLabelList; - theLabelList = theLabelList->theNext; - delete tNdbLabel; -} - -/*************************************************************************** -void freeNdbSubroutine(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbSubroutine() -{ - NdbSubroutine* tNdbSubroutine = theSubroutineList; - theSubroutineList = theSubroutineList->theNext; - delete tNdbSubroutine; -} - -/*************************************************************************** -void freeRecAttr(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeRecAttr() -{ - NdbRecAttr* tRecAttr = theRecAttrIdleList; - theRecAttrIdleList = theRecAttrIdleList->next(); - delete tRecAttr; -} - -/*************************************************************************** -void freeSignal(); - -Remark: Delete a signal object from the signal idlelist. -***************************************************************************/ -void -Ndb::freeSignal() -{ - NdbApiSignal* tSignal = theSignalIdleList; - theSignalIdleList = tSignal->next(); - delete tSignal; -#ifdef POORMANSPURIFY - cfreeSignals++; -#endif -} - -void -Ndb::freeNdbBlob() -{ - NdbBlob* tBlob = theNdbBlobIdleList; - theNdbBlobIdleList = tBlob->theNext; - delete tBlob; + theImpl->theNdbBlobIdleList.release(aBlob); } /**************************************************************************** @@ -826,3 +485,102 @@ Ndb::releaseConnectToNdb(NdbTransaction* a_con) DBUG_VOID_RETURN; } +template<class T> +static +Ndb::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); |