From: Ole John Aske Date: October 28 2011 8:47am Subject: bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4623 to 4624) List-Archive: http://lists.mysql.com/commits/141628 Message-Id: <20111028084736.0FE5B233@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4624 Ole John Aske 2011-10-28 Added missing check for NdbQuery failures which returned an error but did not cause the *transaction* to fail (or: rollback) modified: storage/ndb/test/src/HugoQueries.cpp 4623 Jonas Oreland 2011-10-24 ndb - introduce OutputStream::write to avoid the warnings about incorrect format-specifier modified: storage/ndb/include/util/OutputStream.hpp storage/ndb/src/common/util/OutputStream.cpp storage/ndb/src/mgmapi/mgmapi.cpp storage/ndb/src/mgmsrv/Services.cpp storage/ndb/test/include/NdbMgmd.hpp storage/ndb/test/ndbapi/testMgm.cpp === modified file 'storage/ndb/test/src/HugoQueries.cpp' --- a/storage/ndb/test/src/HugoQueries.cpp 2011-10-21 08:59:23 +0000 +++ b/storage/ndb/test/src/HugoQueries.cpp 2011-10-28 08:47:01 +0000 @@ -219,11 +219,51 @@ HugoQueries::runLookupQuery(Ndb* pNdb, pTrans->close(); return NDBT_FAILED; } +#if 0 + // Disabled, as this is incorrectly handled in SPJ API, will fix soon + else + { + /** + * If ::execute() didn't fail, there should not be an error on + * its NdbError object either: + */ + const NdbError err = pTrans->getNdbError(); + if (err.code) + { + ERR(err); + ndbout_c("API INCONSISTENCY: NdbTransaction returned NdbError even if ::execute() succeeded"); + pTrans->close(); + return NDBT_FAILED; + } + } +#endif + bool retry = false; for (int b = 0; bnextResult() == NdbQuery::NextResult_gotRow) + + /** + * As NdbQuery is always 'dirty read' (impl. limitations), 'AbortOnError' + * is ignored and handled as 'IgnoreError'. We will therefore not get + * errors returned from ::execute() or set into 'pTrans->getNdbError()': + * Has to check for errors on the NdbQuery object instead: + */ + const NdbError& err = query->getNdbError(); + if (err.code) + { + ERR(err); + if (err.status == NdbError::TemporaryError){ + pTrans->close(); + retry = true; + break; + } + pTrans->close(); + return NDBT_FAILED; + } + + const NdbQuery::NextResultOutcome stat = query->nextResult(); + if (stat == NdbQuery::NextResult_gotRow) { for (unsigned o = 0; ogetNdbError(); + ERR(err); + if (err.status == NdbError::TemporaryError){ + pTrans->close(); + retry = true; + break; + } + pTrans->close(); + return NDBT_FAILED; + } + } + if (retry) + { + NdbSleep_MilliSleep(50); + retryAttempt++; + continue; } + pTrans->close(); r += batch; @@ -312,6 +371,44 @@ HugoQueries::runScanQuery(Ndb * pNdb, pTrans->close(); return NDBT_FAILED; } + else + { + // Disabled, as this is incorrectly handled in SPJ API, will fix soon +#if 0 + /** + * If ::execute() didn't fail, there should not be an error on + * its NdbError object either: + */ + const NdbError err = pTrans->getNdbError(); + if (err.code) + { + ERR(err); + ndbout_c("API INCONSISTENCY: NdbTransaction returned NdbError even if ::execute() succeeded"); + pTrans->close(); + return NDBT_FAILED; + } +#endif + + /** + * As NdbQuery is always 'dirty read' (impl. limitations), 'AbortOnError' + * is ignored and handled as 'IgnoreError'. We will therefore not get + * errors returned from ::execute() or set into 'pTrans->getNdbError()': + * Has to check for errors on the NdbQuery object instead: + */ + NdbError err = query->getNdbError(); + if (err.code) + { + ERR(err); + if (err.status == NdbError::TemporaryError){ + pTrans->close(); + NdbSleep_MilliSleep(50); + retryAttempt++; + continue; + } + pTrans->close(); + return NDBT_FAILED; + } + } int r = rand() % 100; if (r < abort && ((r & 1) == 0)) No bundle (reason: useless for push emails).