From: Ole John Aske Date: November 8 2010 9:39am Subject: bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3341 to 3342) List-Archive: http://lists.mysql.com/commits/123049 Message-Id: <20101108093912.1841A222@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3342 Ole John Aske 2010-11-08 spj-svs: Corrected a potential mutex issue accessing 'm_finalBatchFrags' within ::nextRootResult) m_finalBatchFrags requires the PullGuard mutex to be locked before accesing it. However, in ::nextRootResult() it was accessed wo/ mutex. Moved the mutex violating logic inside :awaitMoreResults() where the mutex is locked, and extended the return values from ::awaitMoreResults() to include 'FetchResult_noMoreCache'. modified: storage/ndb/src/ndbapi/NdbQueryOperation.cpp storage/ndb/src/ndbapi/NdbQueryOperationImpl.hpp 3341 jonas oreland 2010-11-06 ndb - spj svs - when computing xfrm:ed key in scanIndex, it used incorrect lenght for final md5 calculation modified: mysql-test/suite/ndb/r/ndb_join_pushdown.result mysql-test/suite/ndb/t/ndb_join_pushdown.test storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp === modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp' --- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2010-11-05 14:45:27 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2010-11-08 09:38:33 +0000 @@ -1713,17 +1713,19 @@ NdbQueryImpl::nextRootResult(bool fetchA assert (m_error.code == 0); assert (m_applFrags.getCurrent()==NULL); getRoot().nullifyResult(); - if (!fetchAllowed) - { - return NdbQuery::NextResult_bufferEmpty; - } - else if (m_finalBatchFrags == getRootFragCount()) + m_state = EndOfData; + postFetchRelease(); + return NdbQuery::NextResult_scanComplete; + + case FetchResult_noMoreCache: // No cached data, no error + assert (m_error.code == 0); + assert (m_applFrags.getCurrent()==NULL); + getRoot().nullifyResult(); + if (fetchAllowed) { - m_state = EndOfData; - postFetchRelease(); - return NdbQuery::NextResult_scanComplete; + break; // ::sendFetchMore() may request more results } - break; // ::sendFetchMore() will request more results + return NdbQuery::NextResult_bufferEmpty; case FetchResult_gotError: // Error in 'm_error.code' assert (m_error.code != 0); @@ -1823,7 +1825,8 @@ NdbQueryImpl::awaitMoreResults(bool forc if (m_pendingFrags == 0) { // 'No more *pending* results', ::sendFetchMore() may make more available - return FetchResult_noMoreData; + return (m_finalBatchFrags < getRootFragCount()) ? FetchResult_noMoreCache + : FetchResult_noMoreData; } /* More results are on the way, so we wait for them.*/ @@ -1873,6 +1876,7 @@ NdbQueryImpl::awaitMoreResults(bool forc * - There was no matching row for an inner join. * - or, the application called nextResult() twice for a lookup query. */ + assert(m_finalBatchFrags == getRootFragCount()); return FetchResult_noMoreData; } else === modified file 'storage/ndb/src/ndbapi/NdbQueryOperationImpl.hpp' --- a/storage/ndb/src/ndbapi/NdbQueryOperationImpl.hpp 2010-11-05 14:45:27 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryOperationImpl.hpp 2010-11-08 09:38:33 +0000 @@ -199,8 +199,9 @@ public: { return m_rootFragCount; } private: - /** Possible return values from NdbQueryImpl::awaitMoreResults. Integer values - * matches those returned from PoolGuard::wait_scan(). + /** Possible return values from NdbQueryImpl::awaitMoreResults. + * A subset of the integer values also matches those returned + * from PoolGuard::wait_scan(). */ enum FetchResult{ FetchResult_gotError = -4, // There is an error avail in 'm_error.code' @@ -208,7 +209,8 @@ private: FetchResult_nodeFail = -2, FetchResult_timeOut = -1, FetchResult_ok = 0, - FetchResult_noMoreData = 1 + FetchResult_noMoreData = 1, + FetchResult_noMoreCache = 2 }; /** A stack of NdbRootFragment pointers. No bundle (reason: useless for push emails).