From: Maitrayi Sabaratnam Date: May 24 2012 12:08pm Subject: bzr push into mysql-5.5-cluster-7.2-spj branch (maitrayi.sabaratnam:3864 to 3865) List-Archive: http://lists.mysql.com/commits/143937 Message-Id: <20120524120853.8186.qmail@astra01> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3865 Maitrayi Sabaratnam 2012-05-24 SPJ: Inject sectiom memory allocation fault, remove possible mem-leak modified: storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp storage/ndb/test/ndbapi/testSpj.cpp 3864 Maitrayi Sabaratnam 2012-05-02 Fix NF_Join failure on slow machines - reduce client load modified: storage/ndb/test/include/HugoQueries.hpp storage/ndb/test/ndbapi/testSpj.cpp storage/ndb/test/src/HugoQueries.cpp storage/ndb/test/tools/hugoJoin.cpp === modified file 'storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp' --- a/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2012-04-25 06:24:54 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2012-05-24 11:43:11 +0000 @@ -69,6 +69,8 @@ private: void execDIH_SCAN_GET_NODES_REF(Signal*); void execDIH_SCAN_GET_NODES_CONF(Signal*); + void execSIGNAL_DROPPED_REP(Signal*); + /** * Signals from LQH */ @@ -1264,6 +1266,13 @@ private: SLList::Head m_free_page_list; ArrayPool m_page_pool; + /* Random fault injection */ + +#ifdef ERROR_INSERT + bool appendToSection(Uint32& firstSegmentIVal, + const Uint32* src, Uint32 len); +#endif + /** * Scratch buffers... */ === modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2012-04-25 09:22:21 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2012-05-24 11:43:11 +0000 @@ -37,6 +37,7 @@ #include #include +#include // Use DEBUG to print messages that should be // seen only when we debug the product @@ -65,6 +66,50 @@ const Ptr Dbspj::NullTreeNodePtr = { 0, RNIL }; const Dbspj::RowRef Dbspj::NullRowRef = { RNIL, GLOBAL_PAGE_SIZE_WORDS, { 0 } }; + +void Dbspj::execSIGNAL_DROPPED_REP(Signal* signal) +{ + /* An incoming signal was dropped, handle it. + * Dropped signal really means that we ran out of + * long signal buffering to store its sections. + */ + jamEntry(); + + if (!assembleDroppedFragments(signal)) + { + jam(); + return; + } + + const SignalDroppedRep* rep = (SignalDroppedRep*) &signal->theData[0]; + Uint32 originalGSN= rep->originalGsn; + + DEBUG("SignalDroppedRep received for GSN " << originalGSN); + + switch(originalGSN) { + case GSN_SCAN_FRAGREQ: + { + jam(); + /* Get information necessary to send SCAN_FRAGREF back to TC */ + // TODO : Handle dropped signal fragments + + const ScanFragReq * const truncatedScanFragReq = + (ScanFragReq *) &rep->originalData[0]; + + handle_early_scanfrag_ref(signal, truncatedScanFragReq, + DbspjErr::OutOfSectionMemory); + break; + } + default: + jam(); + /* Don't expect dropped signals for other GSNs + */ + SimulatedBlock::execSIGNAL_DROPPED_REP(signal); + }; + + return; +} + /** A noop for now.*/ void Dbspj::execREAD_CONFIG_REQ(Signal* signal) { @@ -6673,6 +6718,26 @@ Dbspj::appendParamToPattern(Local_patter return dst.append(&info,1) && dst.append(ptr,len) ? 0 : DbspjErr::OutOfQueryMemory; } +#ifdef ERROR_INSERT +static int fi_cnt = 0; +bool +Dbspj::appendToSection(Uint32& firstSegmentIVal, + const Uint32* src, Uint32 len) +{ + if (fi_cnt++ % 13 == 0 && ERROR_INSERTED(17510)) + { + jam(); + ndbout_c("Injecting appendToSection error 17510 at line %d file %s", + __LINE__, __FILE__); + return false; + } + else + { + return SimulatedBlock::appendToSection(firstSegmentIVal, src, len); + } +} +#endif + Uint32 Dbspj::appendParamHeadToPattern(Local_pattern_store& dst, const RowPtr::Linear & row, Uint32 col) @@ -7820,18 +7885,20 @@ Dbspj::parseDA(Build_context& ctx, { SectionReader r0(ptr, getSectionSegmentPool()); err = appendTreeToSection(attrInfoPtrI, r0, ptr.sz); - sectionptrs[4] = ptr.sz; if (unlikely(err != 0)) { jam(); break; } + sectionptrs[4] = ptr.sz; } releaseSection(attrParamPtrI); + attrParamPtrI = RNIL; } } treeNodePtr.p->m_send.m_attrInfoPtrI = attrInfoPtrI; + attrInfoPtrI = RNIL; } // if (((treeBits & mask) | (paramBits & DABits::PI_ATTR_LIST)) != 0) // Empty attrinfo would cause node crash. @@ -7852,6 +7919,18 @@ Dbspj::parseDA(Build_context& ctx, return 0; } while (0); + if (attrInfoPtrI != RNIL) + { + jam(); + releaseSection(attrInfoPtrI); + } + + if (attrParamPtrI != RNIL) + { + jam(); + releaseSection(attrParamPtrI); + } + return err; } === modified file 'storage/ndb/test/ndbapi/testSpj.cpp' --- a/storage/ndb/test/ndbapi/testSpj.cpp 2012-05-02 11:31:46 +0000 +++ b/storage/ndb/test/ndbapi/testSpj.cpp 2012-05-24 11:43:11 +0000 @@ -31,7 +31,7 @@ static int faultToInject = 0; enum faultsToInject { FI_START = 17001, - FI_END = 17121 + FI_END = 17510 }; int @@ -125,7 +125,8 @@ runLookupJoinError(NDBT_Context* ctx, ND 17060, 17061, 17062, 17063, // scanIndex_parent_row -> outOfSectionMem 17070, 17071, 17072, // lookup_send.dupsec -> outOfSectionMem 17080, 17081, 17082, // lookup_parent_row -> OutOfQueryMemory - 17120, 17121 // execTRANSID_AI -> OutOfRowMemory + 17120, 17121, // execTRANSID_AI -> OutOfRowMemory + 17510 // random failure when allocating seection memory }; loops = faultToInject ? 1 : sizeof(lookupFaults)/sizeof(int); @@ -217,7 +218,8 @@ runScanJoinError(NDBT_Context* ctx, NDBT 17090, 17091, 17092, 17093, // scanIndex_send -> OutOfQueryMemory 17100, // scanFrag_sends invalid schema version, to get a SCAN_FRAGREF 17110, 17111, 17112, // scanIndex_sends invalid schema version, to get a SCAN_FRAGREF - 17120, 17121 // execTRANSID_AI -> OutOfRowMemory + 17120, 17121, // execTRANSID_AI -> OutOfRowMemory + 17510 // random failure when allocating seection memory }; loops = faultToInject ? 1 : sizeof(scanFaults)/sizeof(int); No bundle (reason: useless for push emails).