From: Ole John Aske Date: August 22 2011 1:04pm Subject: bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (ole.john.aske:3542 to 3543) List-Archive: http://lists.mysql.com/commits/140770 Message-Id: <20110822130458.4BF34218@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3543 Ole John Aske 2011-08-22 [merge] Merge telco-7.0 -> telco-7.0-spj-scan-scan modified: storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp storage/ndb/src/ndbapi/NdbQueryOperation.cpp 3542 Jan Wedvik 2011-08-22 [merge] Merged from mysql-5.1-telco-7.0 modified: mysql-test/suite/ndb/r/ndb_join_pushdown.result storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp storage/ndb/src/ndbapi/NdbQueryOperation.cpp storage/ndb/src/ndbapi/NdbQueryOperation.hpp storage/ndb/src/ndbapi/NdbQueryOperationImpl.hpp === modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-08-22 08:50:01 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-08-22 13:04:16 +0000 @@ -5050,8 +5050,9 @@ Dbspj::scanIndex_parent_batch_complete(S * deviation to have a low risk of setting parallelism to high (as erring * in the other direction is more costly). */ - Int32 parallelism = data.m_parallelismStat.getMean() - - 2 * data.m_parallelismStat.getStdDev(); + Int32 parallelism = + static_cast(data.m_parallelismStat.getMean() + - 2 * data.m_parallelismStat.getStdDev()); if (parallelism < 1) { @@ -5123,7 +5124,8 @@ Dbspj::scanIndex_parent_batch_complete(S } else { - ndbrequire((data.m_frags_outstanding + data.m_frags_complete) <= + ndbrequire(static_cast(data.m_frags_outstanding + + data.m_frags_complete) <= data.m_fragCount); } === modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp' --- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-08-22 08:50:01 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-08-22 13:04:16 +0000 @@ -374,9 +374,6 @@ public: Uint32 getRowCount() const { return m_rowCount; } - char* getRow(Uint32 tupleNo) const - { return (m_buffer + (tupleNo*m_rowSize)); } - private: /** No copying.*/ NdbResultSet(const NdbResultSet&); @@ -388,6 +385,9 @@ private: /** Used for checking if buffer overrun occurred. */ Uint32* m_batchOverflowCheck; + /** Array of TupleCorrelations for all rows in m_buffer */ + TupleCorrelation* m_correlations; + Uint32 m_rowSize; /** The current #rows in 'm_buffer'.*/ @@ -431,8 +431,8 @@ public: const NdbReceiver& getReceiver() const { return m_receiver; } - const char* getCurrentRow() const - { return m_receiver.peek_row(); } + const char* getCurrentRow() + { return m_receiver.get_row(); } /** * Process an incomming tuple for this stream. Extract parent and own tuple @@ -669,6 +669,7 @@ void* NdbBulkAllocator::allocObjMem(Uint NdbResultSet::NdbResultSet() : m_buffer(NULL), m_batchOverflowCheck(NULL), + m_correlations(NULL), m_rowSize(0), m_rowCount(0) {} @@ -688,6 +689,12 @@ NdbResultSet::init(NdbQueryImpl& query, m_batchOverflowCheck = reinterpret_cast(bufferAlloc.allocObjMem(sizeof(Uint32))); *m_batchOverflowCheck = 0xacbd1234; + + if (query.getQueryDef().isScanQuery()) + { + m_correlations = reinterpret_cast + (bufferAlloc.allocObjMem(maxRows*sizeof(TupleCorrelation))); + } } } @@ -872,19 +879,17 @@ void NdbResultStream::execTRANSID_AI(const Uint32 *ptr, Uint32 len, TupleCorrelation correlation) { - m_receiver.execTRANSID_AI(ptr, len); - m_resultSets[m_recv].m_rowCount++; - + NdbResultSet& receiveSet = m_resultSets[m_recv]; if (isScanQuery()) { /** - * Store TupleCorrelation as hidden value imm. after received row - * (NdbQueryOperationImpl::getRowSize() has reserved space for it) + * Store TupleCorrelation. */ - Uint32* row_recv = reinterpret_cast - (m_receiver.m_record.m_row_recv); - row_recv[-1] = correlation.toUint32(); + receiveSet.m_correlations[receiveSet.m_rowCount] = correlation; } + + m_receiver.execTRANSID_AI(ptr, len); + receiveSet.m_rowCount++; } // NdbResultStream::execTRANSID_AI() /** @@ -1010,8 +1015,8 @@ NdbResultStream::prepareResultSet(Uint32 /** * Fill m_tupleSet[] with correlation data between parent - * and child tuples. The 'TupleCorrelation' is stored as - * and extra Uint32 after each row in the NdbResultSet + * and child tuples. The 'TupleCorrelation' is stored + * in an array of TupleCorrelations in each ResultSet * by execTRANSID_AI(). * * NOTE: In order to reduce work done when holding the @@ -1040,12 +1045,9 @@ NdbResultStream::buildResultCorrelations /* Rebuild correlation & hashmap from 'readResult' */ for (Uint32 tupleNo=0; tupleNo