diff options
author | unknown <joreland@mysql.com> | 2004-08-18 11:18:56 +0200 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2004-08-18 11:18:56 +0200 |
commit | bc5c7427c7d8342b04731d660390de163480ed4d (patch) | |
tree | 39a02664e88cae248bf050a0f059c052bca765a9 /ndb | |
parent | f03022b22a6850d74608be22e9748ed009545e61 (diff) | |
parent | 74dc0adce57dc6c30c40dd80ffc3d97573f1d601 (diff) | |
download | mariadb-git-bc5c7427c7d8342b04731d660390de163480ed4d.tar.gz |
Merge mysql.com:/home/jonas/src/mysql-4.1-ndb
into mysql.com:/home/jonas/src/wl2025
BitKeeper/etc/logging_ok:
auto-union
ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
Auto merged
ndb/src/kernel/blocks/dblqh/DblqhInit.cpp:
Auto merged
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
Auto merged
ndb/src/kernel/blocks/dbtc/Dbtc.hpp:
Auto merged
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
Auto merged
ndb/src/kernel/blocks/suma/Suma.cpp:
Auto merged
Diffstat (limited to 'ndb')
40 files changed, 485 insertions, 289 deletions
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index 2975d0a5f78..038950a7a32 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -3,9 +3,11 @@ #define NDBGLOBAL_H #include <my_global.h> - #define NDB_BASE_PORT 2200 +/** signal & SIG_PIPE */ +#include <my_alarm.h> + #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #define NDB_WIN32 #else diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 951c36bade1..76fc4dc407e 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -1414,12 +1414,19 @@ public: * * @return tuple id or 0 on error */ - Uint64 getAutoIncrementValue(const char* aTableName, Uint32 cacheSize = 1); - bool setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase = false); - Uint64 getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize = 1000 ); - Uint64 getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize = 1000 ); - bool setTupleIdInNdb(const char* aTableName, Uint64 val, bool increase = false); - bool setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase = false); + Uint64 getAutoIncrementValue(const char* aTableName, + Uint32 cacheSize = 1); + Uint64 readAutoIncrementValue(const char* aTableName); + bool setAutoIncrementValue(const char* aTableName, Uint64 val, + bool increase = false); + Uint64 getTupleIdFromNdb(const char* aTableName, + Uint32 cacheSize = 1000); + Uint64 getTupleIdFromNdb(Uint32 aTableId, + Uint32 cacheSize = 1000); + Uint64 readTupleIdFromNdb(Uint32 aTableId); + bool setTupleIdInNdb(const char* aTableName, Uint64 val, + bool increase); + bool setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase); Uint64 opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op); #endif diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp index 1dffd6751b5..78f81f29ad8 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -154,11 +154,15 @@ bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); +bool check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data); const ConfigInfo::ConfigRule ConfigInfo::m_ConfigRules[] = { { add_node_connections, 0 }, { add_server_ports, 0 }, + { check_node_vs_replicas, 0 }, { 0, 0 } }; @@ -2197,6 +2201,13 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){ ctx.m_userProperties.get("NoOfNodes", &nodes); ctx.m_userProperties.put("NoOfNodes", ++nodes, true); + /** + * Update count (per type) + */ + nodes = 0; + ctx.m_userProperties.get(ctx.fname, &nodes); + ctx.m_userProperties.put(ctx.fname, ++nodes, true); + return true; } @@ -2991,6 +3002,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, return true; } + bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) @@ -3030,4 +3042,22 @@ bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, return true; } +bool +check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data) +{ + Uint32 db_nodes = 0; + Uint32 replicas = 0; + ctx.m_userProperties.get("DB", &db_nodes); + ctx.m_userProperties.get("NoOfReplicas", &replicas); + if((db_nodes % replicas) != 0){ + ctx.reportError("Invalid no of db nodes wrt no of replicas.\n" + "No of nodes must be dividable with no or replicas"); + return false; + } + + return true; +} + template class Vector<ConfigInfo::ConfigRuleSection>; diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index a67dba95dc7..0a986f63fda 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> -#include <signal.h> - #include <BaseString.hpp> #include <InputStream.hpp> diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp index 11f6238d5f7..913c31de1f7 100644 --- a/ndb/src/cw/cpcd/main.cpp +++ b/ndb/src/cw/cpcd/main.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> /* Needed for mkdir(2) */ -#include <signal.h> #include "CPCD.hpp" #include "APIService.hpp" diff --git a/ndb/src/kernel/blocks/ERROR_codes.txt b/ndb/src/kernel/blocks/ERROR_codes.txt index 92dbfd067f7..af575de4f62 100644 --- a/ndb/src/kernel/blocks/ERROR_codes.txt +++ b/ndb/src/kernel/blocks/ERROR_codes.txt @@ -3,7 +3,7 @@ Next NDBCNTR 1000 Next NDBFS 2000 Next DBACC 3001 Next DBTUP 4007 -Next DBLQH 5036 +Next DBLQH 5040 Next DBDICT 6006 Next DBDIH 7173 Next DBTC 8035 @@ -190,6 +190,10 @@ Delay execution of ABORTREQ signal 2 seconds to generate time-out. 5035: Delay ACC_CONTOPCONT +5038: Drop LQHKEYREQ + set 5039 +5039: Drop ABORT + set 5003 + + ERROR CODES FOR TESTING TIME-OUT HANDLING IN DBTC ------------------------------------------------- 8040: diff --git a/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp b/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp index 90e914987c3..b22fd6ce641 100644 --- a/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp +++ b/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp @@ -94,7 +94,8 @@ void Dbacc::initRecords() page8 = (Page8*)allocRecord("Page8", sizeof(Page8), - cpagesize); + cpagesize, + false); rootfragmentrec = (Rootfragmentrec*)allocRecord("Rootfragmentrec", sizeof(Rootfragmentrec), @@ -114,7 +115,8 @@ void Dbacc::initRecords() undopage = (Undopage*)allocRecord("Undopage", sizeof(Undopage), - cundopagesize); + cundopagesize, + false); // Initialize BAT for interface to file system diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 143a96e49d3..d7c4b8a2222 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -6255,16 +6255,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) jam(); found = true; const Uint32 a = aRec->attributeDescriptor; - bool isNullable = AttributeDescriptor::getNullable(a); - // We do not allow more than one NULLable attribute for hash index - if (isNullable && - indexPtr.p->isHashIndex() && - (opPtr.p->m_attrList.sz > 1)) { - jam(); - opPtr.p->m_errorCode = CreateIndxRef::AttributeNullable; - opPtr.p->m_errorLine = __LINE__; - return; - } if (indexPtr.p->isHashIndex()) { const Uint32 s1 = AttributeDescriptor::getSize(a); const Uint32 s2 = AttributeDescriptor::getArraySize(a); diff --git a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp index 882b0ee945d..2d9da269971 100644 --- a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp +++ b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp @@ -2881,8 +2881,9 @@ private: /* ------------------------------------------------------------------------- */ UintR preComputedRequestInfoMask; UintR ctransidHash[1024]; - - + + Uint32 c_diskless; + public: /** * diff --git a/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp b/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp index c8e05b8dad4..0f9b50796da 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp @@ -122,7 +122,8 @@ void Dblqh::initRecords() logPageRecord = (LogPageRecord*)allocRecord("LogPageRecord", sizeof(LogPageRecord), - clogPageFileSize); + clogPageFileSize, + false); pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord", sizeof(PageRefRecord), @@ -324,6 +325,31 @@ Dblqh::Dblqh(const class Configuration & conf): addRecSignal(GSN_TUX_ADD_ATTRREF, &Dblqh::execTUX_ADD_ATTRREF); initData(); + +#ifdef VM_TRACE + { + void* tmp[] = { + &addfragptr, + &attrinbufptr, + &databufptr, + &fragptr, + &gcpPtr, + &lcpPtr, + &lcpLocptr, + &logPartPtr, + &logFilePtr, + &lfoPtr, + &logPagePtr, + &pageRefPtr, + &scanptr, + &tabptr, + &tcConnectptr, + &tcNodeFailptr, + }; + init_globals_list(tmp, sizeof(tmp)/sizeof(tmp[0])); + } +#endif + }//Dblqh::Dblqh() Dblqh::~Dblqh() diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 87a6eebda6f..d2946a11788 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -892,6 +892,8 @@ void Dblqh::execREAD_CONFIG_REQ(Signal* signal) ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_SCAN, &cscanrecFileSize)); cmaxAccOps = cscanrecFileSize * MAX_PARALLEL_OP_PER_SCAN; + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &c_diskless)); + initRecords(); initialiseRecordsLab(signal, 0, ref, senderData); @@ -3183,6 +3185,13 @@ void Dblqh::execLQHKEYREQ(Signal* signal) noFreeRecordLab(signal, lqhKeyReq, ZNO_TC_CONNECT_ERROR); return; }//if + + if(ERROR_INSERTED(5038) && + refToNode(signal->getSendersBlockRef()) != getOwnNodeId()){ + jam(); + SET_ERROR_INSERT_VALUE(5039); + return; + } c_Counters.operations++; @@ -3560,6 +3569,7 @@ void Dblqh::prepareContinueAfterBlockedLab(Signal* signal) /* -------------------------------------------------------------------------- */ /* ALSO AFTER NORMAL PROCEDURE WE CONTINUE HERE */ /* -------------------------------------------------------------------------- */ + Uint32 tc_ptr_i = tcConnectptr.i; TcConnectionrec * const regTcPtr = tcConnectptr.p; if (regTcPtr->indTakeOver == ZTRUE) { jam(); @@ -3665,14 +3675,14 @@ void Dblqh::prepareContinueAfterBlockedLab(Signal* signal) EXECUTE_DIRECT(refToBlock(regTcPtr->tcAccBlockref), GSN_ACCKEYREQ, signal, 7 + regTcPtr->primKeyLen); if (signal->theData[0] < RNIL) { - signal->theData[0] = tcConnectptr.i; + signal->theData[0] = tc_ptr_i; execACCKEYCONF(signal); return; } else if (signal->theData[0] == RNIL) { ; } else { ndbrequire(signal->theData[0] == (UintR)-1); - signal->theData[0] = tcConnectptr.i; + signal->theData[0] = tc_ptr_i; execACCKEYREF(signal); }//if return; @@ -5683,9 +5693,7 @@ void Dblqh::execABORT(Signal* signal) BlockReference tcBlockref = signal->theData[1]; Uint32 transid1 = signal->theData[2]; Uint32 transid2 = signal->theData[3]; - if (ERROR_INSERTED(5003)) { - systemErrorLab(signal); - } + CRASH_INSERTION(5003); if (ERROR_INSERTED(5015)) { CLEAR_ERROR_INSERT_VALUE; sendSignalWithDelay(cownref, GSN_ABORT, signal, 2000, 4); @@ -5695,6 +5703,21 @@ void Dblqh::execABORT(Signal* signal) transid2, tcOprec) != ZOK) { jam(); + + if(ERROR_INSERTED(5039) && + refToNode(signal->getSendersBlockRef()) != getOwnNodeId()){ + jam(); + SET_ERROR_INSERT_VALUE(5040); + return; + } + + if(ERROR_INSERTED(5040) && + refToNode(signal->getSendersBlockRef()) != getOwnNodeId()){ + jam(); + SET_ERROR_INSERT_VALUE(5003); + return; + } + /* ------------------------------------------------------------------------- */ // SEND ABORTED EVEN IF NOT FOUND. //THE TRANSACTION MIGHT NEVER HAVE ARRIVED HERE. @@ -5882,10 +5905,18 @@ void Dblqh::execACCKEYREF(Signal* signal) * Only primary replica can get ZTUPLE_ALREADY_EXIST || ZNO_TUPLE_FOUND * * Unless it's a simple or dirty read + * + * NOT TRUE! + * 1) op1 - primary insert ok + * 2) op1 - backup insert fail (log full or what ever) + * 3) op1 - delete ok @ primary + * 4) op1 - delete fail @ backup + * + * -> ZNO_TUPLE_FOUND is possible */ ndbrequire (tcPtr->seqNoReplica == 0 || - (errCode != ZTUPLE_ALREADY_EXIST && errCode != ZNO_TUPLE_FOUND) || + errCode != ZTUPLE_ALREADY_EXIST || (tcPtr->operation == ZREAD && (tcPtr->dirtyOp || tcPtr->opSimple))); } tcPtr->abortState = TcConnectionrec::ABORT_FROM_LQH; @@ -10704,6 +10735,8 @@ void Dblqh::execEND_LCPCONF(Signal* signal) clcpCompletedState = LCP_IDLE; }//if }//if + lcpPtr.i = 0; + ptrAss(lcpPtr, lcpRecord); sendLCP_COMPLETE_REP(signal, lcpPtr.p->currentFragment.lcpFragOrd.lcpId); }//Dblqh::execEND_LCPCONF() @@ -15176,6 +15209,11 @@ void Dblqh::openSrFourthPhaseLab(Signal* signal) void Dblqh::readSrFourthPhaseLab(Signal* signal) { + if(c_diskless){ + jam(); + logPagePtr.p->logPageWord[ZPOS_LOG_LAP] = 1; + } + /* ------------------------------------------------------------------------ * INITIALISE ALL LOG PART INFO AND LOG FILE INFO THAT IS NEEDED TO * START UP THE SYSTEM. @@ -15204,6 +15242,7 @@ void Dblqh::readSrFourthPhaseLab(Signal* signal) logPartPtr.p->logLap = logPagePtr.p->logPageWord[ZPOS_LOG_LAP]; logFilePtr.p->currentFilepage = logPartPtr.p->headPageNo; logFilePtr.p->currentLogpage = logPagePtr.i; + initLogpage(signal); logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] = logPartPtr.p->headPageIndex; logFilePtr.p->remainingWordsInMbyte = diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index 1ffec0dce51..b4c45d93f19 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -139,6 +139,7 @@ #define ZNOT_FOUND 626 #define ZALREADYEXIST 630 #define ZINCONSISTENTHASHINDEX 892 +#define ZNOTUNIQUE 893 #endif class Dbtc: public SimulatedBlock { diff --git a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp index 9ac1812492f..6803c3609ed 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp @@ -293,6 +293,23 @@ Dbtc::Dbtc(const class Configuration & conf): addRecSignal(GSN_ALTER_TAB_REQ, &Dbtc::execALTER_TAB_REQ); initData(); + +#ifdef VM_TRACE + { + void* tmp[] = { &apiConnectptr, + &tcConnectptr, + &cachePtr, + &attrbufptr, + &hostptr, + &gcpPtr, + &tmpApiConnectptr, + &timeOutptr, + &scanFragptr, + &databufptr, + &tmpDatabufptr }; + init_globals_list(tmp, sizeof(tmp)/sizeof(tmp[0])); + } +#endif }//Dbtc::Dbtc() Dbtc::~Dbtc() @@ -348,5 +365,3 @@ Dbtc::~Dbtc() BLOCK_FUNCTIONS(Dbtc); - - diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 51644ec698c..f3843b189fe 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -65,6 +65,7 @@ #include <signaldata/DictTabInfo.hpp> #include <NdbOut.hpp> +#include <DebuggerNames.hpp> // Use DEBUG to print messages that should be // seen only when we debug the product @@ -260,6 +261,7 @@ void Dbtc::execCONTINUEB(Signal* signal) tcConnectptr.i = Tdata0; apiConnectptr.i = Tdata1; ptrCheckGuard(apiConnectptr, capiConnectFilesize, apiConnectRecord); + apiConnectptr.p->counter--; sendAbortedAfterTimeout(signal, 1); return; case TcContinueB::ZHANDLE_FAILED_API_NODE_REMOVE_MARKERS: @@ -4926,7 +4928,9 @@ void Dbtc::execLQHKEYREF(Signal* signal) // The operation executed an index trigger const Uint32 opType = regTcPtr->operation; - if (!(opType == ZDELETE && errCode == ZNOT_FOUND)) { + if (errCode == ZALREADYEXIST) + errCode = terrorCode = ZNOTUNIQUE; + else if (!(opType == ZDELETE && errCode == ZNOT_FOUND)) { jam(); /** * "Normal path" @@ -5008,6 +5012,8 @@ void Dbtc::execLQHKEYREF(Signal* signal) regApiPtr->lqhkeyreqrec--; // Compensate for extra during read tcKeyRef->connectPtr = indexOp; EXECUTE_DIRECT(DBTC, GSN_TCKEYREF, signal, TcKeyRef::SignalLength); + apiConnectptr.i = regTcPtr->apiConnect; + apiConnectptr.p = regApiPtr; } else { jam(); tcKeyRef->connectPtr = clientData; @@ -6040,7 +6046,8 @@ void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr) << " H'" << apiConnectptr.p->transid[1] << "] " << dec << "Time-out in state = " << apiConnectptr.p->apiConnectstate << " apiConnectptr.i = " << apiConnectptr.i - << " - exec: " << apiConnectptr.p->m_exec_flag); + << " - exec: " << apiConnectptr.p->m_exec_flag + << " - place: " << c_apiConTimer_line[apiConnectptr.i]); switch (apiConnectptr.p->apiConnectstate) { case CS_STARTED: if(apiConnectptr.p->lqhkeyreqrec == apiConnectptr.p->lqhkeyconfrec){ @@ -6301,9 +6308,8 @@ void Dbtc::sendAbortedAfterTimeout(Signal* signal, int Tcheck) warningEvent(buf); ndbout_c(buf); ndbrequire(false); - releaseAbortResources(signal); - return; - }//if + } + releaseAbortResources(signal); return; }//if TloopCount++; @@ -6314,6 +6320,7 @@ void Dbtc::sendAbortedAfterTimeout(Signal* signal, int Tcheck) // away the job buffer. /*------------------------------------------------------------------*/ setApiConTimer(apiConnectptr.i, ctcTimer, __LINE__); + apiConnectptr.p->counter++; signal->theData[0] = TcContinueB::ZABORT_TIMEOUT_BREAK; signal->theData[1] = tcConnectptr.i; signal->theData[2] = apiConnectptr.i; @@ -10017,7 +10024,8 @@ void Dbtc::releaseAbortResources(Signal* signal) }//if } - setApiConTimer(apiConnectptr.i, 0, __LINE__); + setApiConTimer(apiConnectptr.i, 0, + 100000+c_apiConTimer_line[apiConnectptr.i]); if (apiConnectptr.p->apiFailState == ZTRUE) { jam(); handleApiFailState(signal, apiConnectptr.i); @@ -11304,6 +11312,8 @@ void Dbtc::execTCKEYCONF(Signal* signal) } const UintR TconnectIndex = indexOp->connectionIndex; ApiConnectRecord * const regApiPtr = &apiConnectRecord[TconnectIndex]; + apiConnectptr.p = regApiPtr; + apiConnectptr.i = TconnectIndex; switch(indexOp->indexOpState) { case(IOS_NOOP): { jam(); @@ -12146,34 +12156,33 @@ void Dbtc::insertIntoIndexTable(Signal* signal, // Calculate key length and renumber attribute id:s AttributeBuffer::DataBufferPool & pool = c_theAttributeBufferPool; LocalDataBuffer<11> afterValues(pool, firedTriggerData->afterValues); + bool skipNull = false; for(bool moreKeyAttrs = afterValues.first(iter); moreKeyAttrs; attrId++) { jam(); AttributeHeader* attrHeader = (AttributeHeader *) iter.data; + // Filter out NULL valued attributes + if (attrHeader->isNULL()) { + skipNull = true; + break; + } attrHeader->setAttributeId(attrId); keyLength += attrHeader->getDataSize(); hops = attrHeader->getHeaderSize() + attrHeader->getDataSize(); moreKeyAttrs = afterValues.next(iter, hops); } - - // Filter out single NULL attributes - if (attrId == 1) { + if (skipNull) { jam(); - afterValues.first(iter); - AttributeHeader* attrHeader = (AttributeHeader *) iter.data; - if (attrHeader->isNULL() && !afterValues.next(iter)) { - jam(); - opRecord->triggerExecutionCount--; - if (opRecord->triggerExecutionCount == 0) { - /* - We have completed current trigger execution - Continue triggering operation - */ - jam(); - continueTriggeringOp(signal, opRecord); - }//if - return; + opRecord->triggerExecutionCount--; + if (opRecord->triggerExecutionCount == 0) { + /* + We have completed current trigger execution + Continue triggering operation + */ + jam(); + continueTriggeringOp(signal, opRecord); }//if + return; }//if // Calculate total length of primary key to be stored in index table @@ -12501,36 +12510,36 @@ void Dbtc::deleteFromIndexTable(Signal* signal, // Calculate key length and renumber attribute id:s AttributeBuffer::DataBufferPool & pool = c_theAttributeBufferPool; LocalDataBuffer<11> beforeValues(pool, firedTriggerData->beforeValues); + bool skipNull = false; for(bool moreKeyAttrs = beforeValues.first(iter); (moreKeyAttrs); attrId++) { jam(); AttributeHeader* attrHeader = (AttributeHeader *) iter.data; + // Filter out NULL valued attributes + if (attrHeader->isNULL()) { + skipNull = true; + break; + } attrHeader->setAttributeId(attrId); keyLength += attrHeader->getDataSize(); hops = attrHeader->getHeaderSize() + attrHeader->getDataSize(); moreKeyAttrs = beforeValues.next(iter, hops); } - // Filter out single NULL attributes - if (attrId == 1) { + if (skipNull) { jam(); - beforeValues.first(iter); - AttributeHeader* attrHeader = (AttributeHeader *) iter.data; - if (attrHeader->isNULL() && !beforeValues.next(iter)) { - jam(); - opRecord->triggerExecutionCount--; - if (opRecord->triggerExecutionCount == 0) { - /* + opRecord->triggerExecutionCount--; + if (opRecord->triggerExecutionCount == 0) { + /* We have completed current trigger execution Continue triggering operation - */ - jam(); - continueTriggeringOp(signal, opRecord); - }//if - return; + */ + jam(); + continueTriggeringOp(signal, opRecord); }//if + return; }//if TcKeyReq::setKeyLength(tcKeyRequestInfo, keyLength); diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index eb9ff08c2b1..0dc196d5f56 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -1441,7 +1441,10 @@ int Dbtup::interpreterNextLab(Signal* signal, register Uint32 theRegister; Uint32 TdataWritten = 0; Uint32 RstackPtr = 0; - Uint32 TregMemBuffer[32]; + union { + Uint32 TregMemBuffer[32]; + Uint64 Tdummy[16]; + }; Uint32 TstackMemBuffer[32]; /* ---------------------------------------------------------------- */ @@ -1492,19 +1495,23 @@ int Dbtup::interpreterNextLab(Signal* signal, // word read. Thus we set the register to be a 32 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x50; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 3) { /* ------------------------------------------------------------- */ // Three words read means that we get the instruction plus two // 32 words read. Thus we set the register to be a 64 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x60; + TregMemBuffer[theRegister+3] = TregMemBuffer[theRegister+2]; + TregMemBuffer[theRegister+2] = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 1) { /* ------------------------------------------------------------- */ // One word read means that we must have read a NULL value. We set // the register to indicate a NULL value. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0; + TregMemBuffer[theRegister + 2] = 0; + TregMemBuffer[theRegister + 3] = 0; } else if (TnoDataRW == (Uint32)-1) { jam(); tupkeyErrorLab(signal); @@ -1546,8 +1553,8 @@ int Dbtup::interpreterNextLab(Signal* signal, AttributeHeader& ah = AttributeHeader::init(&TdataForUpdate[0], TattrId, TattrNoOfWords); - TdataForUpdate[1] = TregMemBuffer[theRegister + 1]; - TdataForUpdate[2] = TregMemBuffer[theRegister + 2]; + TdataForUpdate[1] = TregMemBuffer[theRegister + 2]; + TdataForUpdate[2] = TregMemBuffer[theRegister + 3]; Tlen = TattrNoOfWords + 1; if (Toptype == ZUPDATE) { if (TattrNoOfWords <= 2) { @@ -1593,24 +1600,22 @@ int Dbtup::interpreterNextLab(Signal* signal, case Interpreter::LOAD_CONST16: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = theInstruction >> 16; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = theInstruction >> 16; break; case Interpreter::LOAD_CONST32: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = TcurrentProgram[TprogramCounter]; - TregMemBuffer[theRegister + 2] = 0; + * (Int64*)(TregMemBuffer+theRegister+2) = * + (TcurrentProgram+TprogramCounter); TprogramCounter++; break; case Interpreter::LOAD_CONST64: jam(); TregMemBuffer[theRegister] = 0x60; /* 64 BIT UNSIGNED CONSTANT */ - TregMemBuffer[theRegister + 1] = TcurrentProgram[TprogramCounter + 0]; - TregMemBuffer[theRegister + 2] = TcurrentProgram[TprogramCounter + 1]; - TprogramCounter += 2; + TregMemBuffer[theRegister + 2 ] = * (TcurrentProgram + TprogramCounter++); + TregMemBuffer[theRegister + 3 ] = * (TcurrentProgram + TprogramCounter++); break; case Interpreter::ADD_REG_REG: @@ -1620,27 +1625,16 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; - Uint32 Tany64bit = (((TleftType | TrightType) & 0x60) == 0x60); + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { - Uint32 Tdest0 = Tleft0 + Tright0; - Uint32 Tdest1 = 0; - TregMemBuffer[TdestRegister + 1] = Tdest0; - TregMemBuffer[TdestRegister] = 0x50; - if (Tany64bit) { - TregMemBuffer[TdestRegister] = 0x60; - Tdest1 = Tleft1 + Tright1; - if (Tdest0 < Tleft0) { - Tdest1++; - } - }//if - TregMemBuffer[TdestRegister + 2] = Tdest1; + Uint64 Tdest0 = Tleft0 + Tright0; + * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; + TregMemBuffer[TdestRegister] = 0x60; } else { return TUPKEY_abort(signal, 20); } @@ -1654,30 +1648,18 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; - + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; - Uint32 Tany64bit = (((TleftType | TrightType) & 0x60) == 0x60); + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { - Uint32 Tdest0 = Tleft0 - Tright0; - Uint32 Tdest1 = 0; - TregMemBuffer[TdestRegister + 1] = Tdest0; - TregMemBuffer[TdestRegister] = 0x50; - if (Tany64bit) { - TregMemBuffer[TdestRegister] = 0x60; - Tdest1 = Tleft1 - Tright1; - if (Tdest0 > Tleft0) { - Tdest1--; - }//if - }//if - TregMemBuffer[TdestRegister + 2] = Tdest1; + Int64 Tdest0 = Tleft0 - Tright0; + * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; + TregMemBuffer[TdestRegister] = 0x60; } else { - return TUPKEY_abort(signal, 21); - }//if + return TUPKEY_abort(signal, 20); + } break; } @@ -1711,12 +1693,12 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 == Tright0) && (Tleft1 == Tright1)) { @@ -1733,12 +1715,12 @@ int Dbtup::interpreterNextLab(Signal* signal, Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; + Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; + Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 != Tright0) || (Tleft1 != Tright1)) { @@ -1754,17 +1736,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 < Tright0) || ((Tleft0 == Tright0) && - (Tleft1 < Tright1))) { + if (Tleft0 < Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1777,17 +1758,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 < Tright0) || ((Tleft0 == Tright0) && - (Tleft1 <= Tright1))) { + if (Tleft0 <= Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1800,17 +1780,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 > Tright0) || ((Tleft0 == Tright0) && - (Tleft1 > Tright1))) { + if (Tleft0 > Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { @@ -1823,17 +1802,16 @@ int Dbtup::interpreterNextLab(Signal* signal, { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; + Uint32 TrightType = TregMemBuffer[TrightRegister]; + Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); + Uint32 TleftType = TregMemBuffer[theRegister]; - Uint32 Tleft0 = TregMemBuffer[theRegister + 1]; - Uint32 Tleft1 = TregMemBuffer[theRegister + 2]; + Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); + - Uint32 TrightType = TregMemBuffer[TrightRegister]; - Uint32 Tright0 = TregMemBuffer[TrightRegister + 1]; - Uint32 Tright1 = TregMemBuffer[TrightRegister + 2]; if ((TrightType | TleftType) != 0) { jam(); - if ((Tleft0 > Tright0) || ((Tleft0 == Tright0) && - (Tleft1 >= Tright1))) { + if (Tleft0 >= Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { diff --git a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp index cba3c62ec03..f5c3e2b4128 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp @@ -698,7 +698,8 @@ void Dbtup::initRecords() page = (Page*)allocRecord("Page", sizeof(Page), - cnoOfPage); + cnoOfPage, + false); pageRange = (PageRange*)allocRecord("PageRange", sizeof(PageRange), diff --git a/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp b/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp index b74b2c00e3e..f8f2b9bdbd2 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp @@ -344,6 +344,8 @@ void Dbtup::lcpSaveDataPageLab(Signal* signal, Uint32 ciIndex) if (ciPtr.p->lcpTabPtr == c_errorInsert4000TableId) { // Delay writing of data pages during LCP ndbout << "Delay writing of data pages during LCP" << endl; + signal->theData[0] = ZCONT_SAVE_DP; + signal->theData[1] = ciIndex; sendSignalWithDelay(cownref, GSN_CONTINUEB, signal, 1000, 2); return; }//if diff --git a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp index 1830b4135e3..9722aa437c0 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp @@ -139,6 +139,12 @@ void Dbtup::initializePage() pagePtr.i = 0; ptrAss(pagePtr, page); pagePtr.p->pageWord[ZPAGE_STATE_POS] = ~ZFREE_COMMON; + + for(size_t j = 0; j<MAX_PARALLELL_TUP_SRREQ; j++){ + pagePtr.i = 1+j; + ptrAss(pagePtr, page); + pagePtr.p->pageWord[ZPAGE_STATE_POS] = ~ZFREE_COMMON; + } Uint32 tmp = 1 + MAX_PARALLELL_TUP_SRREQ; returnCommonArea(tmp, cnoOfPage - tmp); diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp index 4b2fcfe0c8c..ff4876b1506 100644 --- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp +++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp @@ -1613,6 +1613,7 @@ void Ndbcntr::startInsertTransactions(Signal* signal) ckey = 1; ctransidPhase = ZTRUE; + signal->theData[0] = 0; signal->theData[1] = reference(); sendSignal(DBTC_REF, GSN_TCSEIZEREQ, signal, 2, JBB); return; @@ -1740,6 +1741,7 @@ void Ndbcntr::crSystab8Lab(Signal* signal) }//if signal->theData[0] = ctcConnectionP; signal->theData[1] = reference(); + signal->theData[2] = 0; sendSignal(DBTC_REF, GSN_TCRELEASEREQ, signal, 2, JBB); return; }//Ndbcntr::crSystab8Lab() diff --git a/ndb/src/kernel/blocks/suma/Suma.cpp b/ndb/src/kernel/blocks/suma/Suma.cpp index 2f7e4403209..98d5afc9008 100644 --- a/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/ndb/src/kernel/blocks/suma/Suma.cpp @@ -267,6 +267,40 @@ Suma::execREAD_NODESCONF(Signal* signal){ sendSTTORRY(signal); } +#if 0 +void +Suma::execREAD_CONFIG_REQ(Signal* signal) +{ + const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr(); + Uint32 ref = req->senderRef; + Uint32 senderData = req->senderData; + ndbrequire(req->noOfParameters == 0); + + jamEntry(); + + const ndb_mgm_configuration_iterator * p = + theConfiguration.getOwnConfigIterator(); + ndbrequire(p != 0); + + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_REDOLOG_FILES, + &cnoLogFiles)); + ndbrequire(cnoLogFiles > 0); + + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_FRAG, &cfragrecFileSize)); + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TABLE, &ctabrecFileSize)); + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_TC_CONNECT, + &ctcConnectrecFileSize)); + clogFileFileSize = 4 * cnoLogFiles; + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_LQH_SCAN, &cscanrecFileSize)); + cmaxAccOps = cscanrecFileSize * MAX_PARALLEL_SCANS_PER_FRAG; + + initRecords(); + initialiseRecordsLab(signal, 0, ref, senderData); + + return; +}//Dblqh::execSIZEALT_REP() +#endif + void Suma::sendSTTORRY(Signal* signal){ signal->theData[0] = 0; @@ -581,34 +615,33 @@ Suma::execDUMP_STATE_ORD(Signal* signal){ jamEntry(); Uint32 tCase = signal->theData[0]; - if(tCase < 8000 || tCase > 8004) - return; - - SubscriptionPtr subPtr; - c_subscriptions.getPtr(subPtr, g_subPtrI); - - Ptr<SyncRecord> syncPtr; - c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI); - - if(tCase == 8000){ - syncPtr.p->startMeta(signal); - } - - if(tCase == 8001){ - syncPtr.p->startScan(signal); - } - - if(tCase == 8002){ - syncPtr.p->startTrigger(signal); - } + if(tCase >= 8000 && tCase <= 8003){ + SubscriptionPtr subPtr; + c_subscriptions.getPtr(subPtr, g_subPtrI); + + Ptr<SyncRecord> syncPtr; + c_syncPool.getPtr(syncPtr, subPtr.p->m_syncPtrI); + + if(tCase == 8000){ + syncPtr.p->startMeta(signal); + } + + if(tCase == 8001){ + syncPtr.p->startScan(signal); + } - if(tCase == 8003){ - subPtr.p->m_subscriptionType = SubCreateReq::SingleTableScan; - LocalDataBuffer<15> attrs(c_dataBufferPool, syncPtr.p->m_attributeList); - Uint32 tab = 0; - Uint32 att[] = { 0, 1, 1 }; - syncPtr.p->m_tableList.append(&tab, 1); - attrs.append(att, 3); + if(tCase == 8002){ + syncPtr.p->startTrigger(signal); + } + + if(tCase == 8003){ + subPtr.p->m_subscriptionType = SubCreateReq::SingleTableScan; + LocalDataBuffer<15> attrs(c_dataBufferPool, syncPtr.p->m_attributeList); + Uint32 tab = 0; + Uint32 att[] = { 0, 1, 1 }; + syncPtr.p->m_tableList.append(&tab, 1); + attrs.append(att, 3); + } } if(tCase == 8004){ @@ -1229,6 +1262,9 @@ SumaParticipant::parseTable(Signal* signal, GetTabInfoConf* conf, Uint32 tableId if(!tabPtr.isNull() && tabPtr.p->m_schemaVersion != tableDesc.TableVersion){ jam(); + + tabPtr.p->release(* this); + // oops wrong schema version in stored tabledesc // we need to find all subscriptions with old table desc // and all subscribers to this diff --git a/ndb/src/kernel/blocks/trix/Trix.cpp b/ndb/src/kernel/blocks/trix/Trix.cpp index 6cbc7a9b371..4088d55c76d 100644 --- a/ndb/src/kernel/blocks/trix/Trix.cpp +++ b/ndb/src/kernel/blocks/trix/Trix.cpp @@ -814,8 +814,8 @@ void Trix::executeInsertTransaction(Signal* signal, for(Uint32 i = 0; i < headerPtr.sz; i++) { AttributeHeader* keyAttrHead = (AttributeHeader *) headerBuffer + i; - // Filter out single NULL attributes - if (keyAttrHead->isNULL() && (i == (Uint32)0) && (headerPtr.sz == (Uint32)2)) + // Filter out NULL attributes + if (keyAttrHead->isNULL()) return; if (i < subRec->noOfIndexColumns) diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 858af88d6de..e68c266c394 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -38,10 +38,6 @@ #include <sys/processor.h> // For system informatio #endif -#if !defined NDB_SOFTOSE && !defined NDB_OSE -#include <signal.h> // For process signals -#endif - extern EventLogger g_eventLogger; void catchsigs(bool ignore); // for process signal handling diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 07998794d01..75aea2bda7f 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -35,8 +35,6 @@ #include <NdbSleep.h> #include <new> -#include <signal.h> // For process signals - extern "C" { extern void (* ndb_new_handler)(); } @@ -202,7 +200,7 @@ NdbShutdown(NdbShutdownType type, if(type != NST_Normal && type != NST_Restart){ ndbout << "Error handler shutdown completed - " << exitAbort << endl; -#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) +#if ( defined VM_TRACE || defined ERROR_INSERT ) && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) signal(6, SIG_DFL); abort(); #else diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index c63ed0f3a3f..18b7f474ddc 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -104,6 +104,11 @@ SimulatedBlock::SimulatedBlock(BlockNumber blockNumber, UpgradeStartup::installEXEC(this); CLEAR_ERROR_INSERT_VALUE; + +#ifdef VM_TRACE + m_global_variables = new Ptr<void> * [1]; + m_global_variables[0] = 0; +#endif } SimulatedBlock::~SimulatedBlock() @@ -112,6 +117,10 @@ SimulatedBlock::~SimulatedBlock() #ifdef VM_TRACE_TIME printTimes(stdout); #endif + +#ifdef VM_TRACE + delete [] m_global_variables; +#endif } void @@ -636,10 +645,10 @@ SimulatedBlock::getBatSize(Uint16 blockNo){ } void* -SimulatedBlock::allocRecord(const char * type, size_t s, size_t n) +SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear) { - void* p = NULL; + void * p = NULL; size_t size = n*s; refresh_watch_dog(); if (size > 0){ @@ -656,17 +665,31 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n) char buf1[255]; char buf2[255]; snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s", - getBlockName(number()), type); - snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", (Uint32)s, (Uint32)n, (Uint32)size); + getBlockName(number()), type); + snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", + (Uint32)s, (Uint32)n, (Uint32)size); ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2); } + + if(clear){ + char * ptr = (char*)p; + const Uint32 chunk = 128 * 1024; + while(size > chunk){ + refresh_watch_dog(); + memset(ptr, 0, chunk); + ptr += chunk; + size -= chunk; + } + refresh_watch_dog(); + memset(ptr, 0, size); + } } return p; } void SimulatedBlock::deallocRecord(void ** ptr, - const char * type, size_t s, size_t n) const { + const char * type, size_t s, size_t n){ (void)type; (void)s; (void)n; @@ -1757,3 +1780,25 @@ SimulatedBlock::execUPGRADE(Signal* signal){ break; } } + +#ifdef VM_TRACE +void +SimulatedBlock::clear_global_variables(){ + Ptr<void> ** tmp = m_global_variables; + while(* tmp != 0){ + (* tmp)->i = RNIL; + (* tmp)->p = 0; + tmp++; + } +} + +void +SimulatedBlock::init_globals_list(void ** tmp, size_t cnt){ + m_global_variables = new Ptr<void> * [cnt+1]; + for(size_t i = 0; i<cnt; i++){ + m_global_variables[i] = (Ptr<void>*)tmp[i]; + } + m_global_variables[cnt] = 0; +} + +#endif diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp index 2d8f7e5aaba..6d46e9cc377 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.hpp +++ b/ndb/src/kernel/vm/SimulatedBlock.hpp @@ -96,7 +96,7 @@ protected: * Handling of execFunctions */ typedef void (SimulatedBlock::* ExecFunction)(Signal* signal); - void addRecSignalImpl(GlobalSignalNumber g, ExecFunction fun, bool f = false); + void addRecSignalImpl(GlobalSignalNumber g, ExecFunction fun, bool f =false); void installSimulatedBlockFunctions(); ExecFunction theExecArray[MAX_GSN+1]; public: @@ -350,14 +350,14 @@ protected: * Allocates memory for the datastructures where ndb keeps the data * */ - void* allocRecord(const char * type, size_t s, size_t n); + void* allocRecord(const char * type, size_t s, size_t n, bool clear = true); /** * Deallocate record * * NOTE: Also resets pointer */ - void deallocRecord(void **, const char * type, size_t s, size_t n) const ; + void deallocRecord(void **, const char * type, size_t s, size_t n); /** * General info event (sent to cluster log) @@ -447,6 +447,12 @@ public: } m_timeTrace[MAX_GSN+1]; Uint32 m_currentGsn; #endif + +#ifdef VM_TRACE + Ptr<void> **m_global_variables; + void clear_global_variables(); + void init_globals_list(void ** tmp, size_t cnt); +#endif }; inline @@ -454,6 +460,9 @@ void SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){ ExecFunction f = theExecArray[gsn]; if(gsn <= MAX_GSN && f != 0){ +#ifdef VM_TRACE + clear_global_variables(); +#endif (this->*f)(signal); return; } @@ -679,6 +688,5 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \ addRecSignalImpl(gsn, (ExecFunction)f, force);\ } - #endif diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am index bf209ddccb5..674debf5cc3 100644 --- a/ndb/src/mgmapi/Makefile.am +++ b/ndb/src/mgmapi/Makefile.am @@ -10,9 +10,9 @@ include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am #ndbtest_PROGRAMS = ndb_test_mgmapi -ndb_test_mgmapi_SOURCES = test_mgmapi.cpp -ndb_test_mgmapi_LDFLAGS = @ndb_bin_am_ldflags@ \ - $(top_builddir)/ndb/src/libndbclient.la +#ndb_test_mgmapi_SOURCES = test_mgmapi.cpp +#ndb_test_mgmapi_LDFLAGS = @ndb_bin_am_ldflags@ +# $(top_builddir)/ndb/src/libndbclient.la # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index e70b454a01f..ec468836d84 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -24,8 +24,6 @@ #include "CommandInterpreter.hpp" -#include <signal.h> - const char *progname = "ndb_mgm"; diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index ec734fe24c5..c7a7c520c52 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string.h> +#include <ndb_global.h> #include <ctype.h> #include <uucode.h> diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 9b48db02b23..bac367bb689 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -714,9 +714,10 @@ Ndb::getNodeId() } /**************************************************************************** -Uint64 getTupleIdFromNdb( Uint32 aTableId ); +Uint64 getTupleIdFromNdb( Uint32 aTableId, Uint32 cacheSize ); Parameters: aTableId : The TableId. + cacheSize: Prefetch this many values Remark: Returns a new TupleId to the application. The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId. It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp. @@ -736,7 +737,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize) } Uint64 -Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize ) +Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize) { const NdbTableImpl* table = theDictionary->getTable(aTableName); if (table == 0) @@ -745,7 +746,7 @@ Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize ) } Uint64 -Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize ) +Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize) { if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] ) { @@ -758,6 +759,27 @@ Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize ) } } +Uint64 +Ndb::readAutoIncrementValue(const char* aTableName) +{ + DEBUG_TRACE("readtAutoIncrementValue"); + const NdbTableImpl* table = theDictionary->getTable(aTableName); + if (table == 0) + return ~0; + Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); + return tupleId; +} + +Uint64 +Ndb::readTupleIdFromNdb(Uint32 aTableId) +{ + if ( theFirstTupleId[aTableId] == theLastTupleId[aTableId] ) + // Cache is empty, check next in database + return opTupleIdOnNdb(aTableId, 0, 3); + + return theFirstTupleId[aTableId] + 1; +} + bool Ndb::setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase) { @@ -837,15 +859,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) case 0: tOperation->interpretedUpdateTuple(); tOperation->equal("SYSKEY_0", aTableId ); - { -#ifdef WORDS_BIGENDIAN - Uint64 cacheSize64 = opValue; // XXX interpreter bug on Uint32 - tOperation->incValue("NEXTID", cacheSize64); -#else - Uint32 cacheSize32 = opValue; // XXX for little-endian - tOperation->incValue("NEXTID", cacheSize32); -#endif - } + tOperation->incValue("NEXTID", opValue); tRecAttrResult = tOperation->getValue("NEXTID"); if (tConnection->execute( Commit ) == -1 ) @@ -891,6 +905,14 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) ret = opValue; } break; + case 3: + tOperation->readTuple(); + tOperation->equal("SYSKEY_0", aTableId ); + tRecAttrResult = tOperation->getValue("NEXTID"); + if (tConnection->execute( Commit ) == -1 ) + goto error_handler; + ret = tRecAttrResult->u_64_value(); + break; default: goto error_handler; } diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 6e95f5c5622..c4ea9909fcd 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1851,13 +1851,6 @@ NdbDictInterface::createIndex(Ndb & ndb, m_error.code = 4245; return -1; } - - if (it == DictTabInfo::UniqueHashIndex && - (col->m_nullable) && (attributeList.sz > 1)) { - // We only support one NULL attribute - m_error.code = 4246; - return -1; - } attributeList.id[i] = col->m_attrId; } if (it == DictTabInfo::UniqueHashIndex) { diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp index 2935df9c235..3a7e0dda85e 100644 --- a/ndb/src/ndbapi/NdbOperationInt.cpp +++ b/ndb/src/ndbapi/NdbOperationInt.cpp @@ -408,9 +408,7 @@ NdbOperation::incValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) // Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto incValue_error1; - if (insertATTRINFO((Uint32)(aValue >> 32)) == -1) - goto incValue_error1; - if (insertATTRINFO(Uint32(aValue & 0xFFFFFFFF)) == -1) + if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto incValue_error1; // Add register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Add(7, 6, 7)) == -1) @@ -451,9 +449,7 @@ NdbOperation::subValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) // Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto subValue_error1; - if (insertATTRINFO((Uint32)(aValue >> 32)) == -1) - goto subValue_error1; - if (insertATTRINFO(Uint32(aValue & 0xFFFFFFFF)) == -1) + if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto subValue_error1; // Subtract register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Sub(7, 6, 7)) == -1) @@ -690,8 +686,6 @@ int NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) { INT_DEBUG(("load_const_u64 %u %llu", RegDest, Constant)); - Uint32 tTemp1; - Uint32 tTemp2; if (initial_interpreterCheck() == -1) return -1; if (RegDest >= 8) @@ -699,15 +693,11 @@ NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) setErrorCodeAbort(4229); return -1; } - tTemp1 = (Uint32)(Constant & 0xFFFFFFFF); - tTemp2 = (Uint32)(Constant >> 32); - + // 64 bit value if (insertATTRINFO( Interpreter::LoadConst64(RegDest)) == -1) return -1; - if (insertATTRINFO(tTemp1) == -1) - return -1; - if (insertATTRINFO(tTemp2) == -1) + if (insertATTRINFOloop((Uint32*)&Constant, 2) == -1) return -1; theErrorLine++; return 0; diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index d1e57e874ee..7ec9a6a55a3 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -34,10 +34,6 @@ #include <ndb_version.h> #include <SignalLoggerManager.hpp> -#if !defined NDB_OSE && !defined NDB_SOFTOSE -#include <signal.h> -#endif - //#define REPORT_TRANSPORTER //#define API_TRACE; @@ -353,12 +349,15 @@ TransporterFacade::start_instance(const char * connectString){ if(s_config_retriever->do_connect() == -1) break; - - const Uint32 nodeId = s_config_retriever->allocNodeId(); + + Uint32 nodeId = s_config_retriever->allocNodeId(); + for(Uint32 i = 0; nodeId == 0 && i<5; i++){ + NdbSleep_SecSleep(3); + nodeId = s_config_retriever->allocNodeId(); + } if(nodeId == 0) break; - - + ndb_mgm_configuration * props = s_config_retriever->getConfig(); if(props == 0) break; diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 760322d669d..66a89326a66 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -91,6 +91,9 @@ ErrorBundle ErrorCodes[] = { { 4029, NR, "Node failure caused abort of transaction" }, { 4031, NR, "Node failure caused abort of transaction" }, { 4033, NR, "Send to NDB failed" }, + { 4115, NR, + "Transaction was committed but all read information was not " + "received due to node crash" }, /** * Node shutdown @@ -114,9 +117,6 @@ ErrorBundle ErrorCodes[] = { "Time-out, most likely caused by simple read or cluster failure" }, { 4024, UR, "Time-out, most likely caused by simple read or cluster failure" }, - { 4115, UR, - "Transaction was committed but all read information was not " - "received due to node crash" }, /** * TemporaryResourceError @@ -404,7 +404,6 @@ ErrorBundle ErrorCodes[] = { { 4243, AE, "Index not found" }, { 4244, AE, "Index or table with given name already exists" }, { 4245, AE, "Index attribute must be defined as stored, i.e. the StorageAttributeType must be defined as NormalStorageAttribute"}, - { 4246, AE, "Combined index attributes are not allowed to be NULL attributes" }, { 4247, AE, "Illegal index/trigger create/drop/alter request" }, { 4248, AE, "Trigger/index name invalid" }, { 4249, AE, "Invalid table" }, diff --git a/ndb/test/ndbapi/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp index 07355de2623..d328a7db292 100644 --- a/ndb/test/ndbapi/testBackup.cpp +++ b/ndb/test/ndbapi/testBackup.cpp @@ -205,6 +205,11 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_OK; } +int runDropTable(NDBT_Context* ctx, NDBT_Step* step){ + GETNDB(step)->getDictionary()->dropTable(ctx->getTab()->getName()); + return NDBT_OK; +} + #include "bank/Bank.hpp" int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ @@ -408,7 +413,7 @@ TESTCASE("BackupOne", INITIALIZER(runRestoreOne); VERIFIER(runVerifyOne); FINALIZER(runClearTable); - + FINALIZER(runDropTable); } TESTCASE("BackupBank", "Test that backup and restore works during transaction load\n" diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp index 1451c942362..e7597c26960 100644 --- a/ndb/test/ndbapi/testDict.cpp +++ b/ndb/test/ndbapi/testDict.cpp @@ -537,6 +537,7 @@ int runTestFragmentTypes(NDBT_Context* ctx, NDBT_Step* step){ } const NdbDictionary::Table* pTab = ctx->getTab(); + pNdb->getDictionary()->dropTable(pTab->getName()); NdbDictionary::Table newTab(* pTab); // Set fragment type for table diff --git a/ndb/test/ndbapi/testScan.cpp b/ndb/test/ndbapi/testScan.cpp index de60d68f213..3da0ceb6d8c 100644 --- a/ndb/test/ndbapi/testScan.cpp +++ b/ndb/test/ndbapi/testScan.cpp @@ -65,7 +65,7 @@ int runDropAllTablesExceptTestTable(NDBT_Context* ctx, NDBT_Step* step){ } int res = GETNDB(step)->getDictionary()->dropTable(tab->getName()); - if(res != -1){ + if(res == -1){ return NDBT_FAILED; } } diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 92c994fad7c..15fa4db4abc 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -3,7 +3,7 @@ # max-time: 1500 cmd: testIndex -args: -n CreateAll +args: -n CreateAll T1 T6 T13 #-m 7200 1: testIndex -n InsertDeleteGentle T7 max-time: 3600 @@ -20,12 +20,12 @@ args: -n CreateLoadDrop T1 T10 # max-time: 600 cmd: testBackup -args: -n BackupOne - -max-time: 600 -cmd: testBackup -args: -n BackupBank T6 +args: -n BackupOne T1 T6 T3 I3 +#max-time: 600 +#cmd: testBackup +#args: -n BackupBank T6 +# # # MGMAPI AND MGSRV # diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 0ea700e1d66..90e14a39296 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -938,9 +938,11 @@ gather_result(atrt_config& config, int * result){ BaseString tmp = g_gather_progname; for(size_t i = 0; i<config.m_processes.size(); i++){ atrt_process & proc = config.m_processes[i]; - tmp.appfmt(" %s:%s", - proc.m_hostname.c_str(), - proc.m_proc.m_cwd.c_str()); + if(proc.m_proc.m_path != ""){ + tmp.appfmt(" %s:%s", + proc.m_hostname.c_str(), + proc.m_proc.m_cwd.c_str()); + } } const int r1 = system(tmp.c_str()); diff --git a/ndb/test/src/NDBT_Tables.cpp b/ndb/test/src/NDBT_Tables.cpp index d0a46604316..ff6db3e892c 100644 --- a/ndb/test/src/NDBT_Tables.cpp +++ b/ndb/test/src/NDBT_Tables.cpp @@ -803,10 +803,12 @@ int NDBT_Tables::createAllTables(Ndb* pNdb, bool _temp, bool existsOk){ for (int i=0; i < NDBT_Tables::getNumTables(); i++){ + pNdb->getDictionary()->dropTable(NDBT_Tables::getTable(i)->getName()); int ret= createTable(pNdb, NDBT_Tables::getTable(i)->getName(), _temp, existsOk); - if(ret) + if(ret){ return ret; + } } return NDBT_OK; } @@ -835,17 +837,19 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp, r = pNdb->getDictionary()->createTable(tmpTab); if(r == -1){ - if(!existsOk) + if(!existsOk){ + ndbout << "Error: " << pNdb->getDictionary()->getNdbError() << endl; break; + } if(pNdb->getDictionary()->getNdbError().code != 721){ - ndbout << pNdb->getDictionary()->getNdbError() << endl; + ndbout << "Error: " << pNdb->getDictionary()->getNdbError() << endl; break; } r = 0; } - + Uint32 i = 0; - for(Uint32 i = 0; indexes[i].m_table != 0; i++){ + for(i = 0; indexes[i].m_table != 0; i++){ if(strcmp(indexes[i].m_table, _name) != 0) continue; Uint32 j = 0; diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 6cb3db7d0d3..a40c6ba7d7c 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -70,11 +70,11 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ * Fetch configuration from management server */ ConfigRetriever cr(0, NODE_TYPE_API); - ndb_mgm_configuration * p; + ndb_mgm_configuration * p = 0; BaseString tmp; tmp.assfmt("%s:%d", host.c_str(), port); NdbMgmHandle handle = ndb_mgm_create_handle(); - if(handle == 0 || ndb_mgm_connect(handle, tmp.c_str()) != 0 && + if(handle == 0 || ndb_mgm_connect(handle, tmp.c_str()) != 0 || (p = ndb_mgm_get_configuration(handle, 0)) == 0){ const char * s = 0; @@ -97,7 +97,8 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ ndbout << "Invalid configuration fetched, DB missing" << endl; return NULL; } - unsigned int type = 123456; + + unsigned int type = NODE_TYPE_DB + 1; if(iter.get(CFG_TYPE_OF_SECTION, &type) || type != NODE_TYPE_DB){ ndbout <<"type = " << type << endl; ndbout <<"Invalid configuration fetched, I'm wrong type of node" << endl; @@ -148,31 +149,18 @@ NdbBackup::execRestore(bool _restore_data, ndbout << "res: " << res << endl; -#if 0 - snprintf(buf, 255, "ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s %s/BACKUP/BACKUP-%d", - ownNodeId, - addr, - _node_id, - _backup_id, - _restore_data?"-r":"", - _restore_meta?"-m":"", - path, - _backup_id); - + snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .", +#if 1 + "", +#else + "valgrind --leak-check=yes -v " #endif - - snprintf(buf, 255, "valgrind --leak-check=yes -v ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .", - ownNodeId, addr.c_str(), _node_id, _backup_id, _restore_data?"-r":"", _restore_meta?"-m":""); - // path, - // _backup_id); - - ndbout << "buf: "<< buf <<endl; res = system(buf); |