From: Ole John Aske Date: June 16 2011 9:33am Subject: bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4457 to 4458) List-Archive: http://lists.mysql.com/commits/139309 Message-Id: <20110616093307.B368D224@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4458 Ole John Aske 2011-06-16 SPJ API update: The ndbapi for SPJ was not completely in synch with the primary SPJ source (mysql-5.1-telco-7.0-spj-scan-scan). Likely due to some late arriving patches when the SPJ api was merged into telco-7.0. This patch fix this unintentional diff between these branches. modified: storage/ndb/src/ndbapi/NdbQueryBuilder.cpp storage/ndb/src/ndbapi/NdbQueryBuilder.hpp storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp storage/ndb/src/ndbapi/NdbQueryOperation.cpp storage/ndb/test/include/HugoQueryBuilder.hpp storage/ndb/test/src/HugoQueryBuilder.cpp 4457 Jan Wedvik 2011-06-16 This fix affects pushed queries only. There was an error in the code setting the T_SCAN_REPEATABLE flag. The flag was set on the parent of the intended operation rather than on the operation itself. This caused scan ranges for the repeatable scan to be released too early. This gave wrong results when running a bushy scan where the scan to be repeated used pruning. modified: storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp === modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp' --- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2011-05-17 12:47:21 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2011-06-16 09:32:43 +0000 @@ -23,7 +23,6 @@ #include #include "signaldata/QueryTree.hpp" -#include #include "NdbDictionaryImpl.hpp" #include #include "AttributeHeader.hpp" @@ -575,16 +574,15 @@ NdbQueryIndexScanOperationDef::~NdbQuery NdbQueryOperationDefImpl::~NdbQueryOperationDefImpl() { + // Unlink any parent and child refering this object if (m_parent != NULL) { m_parent->removeChild(this); } - // Delete children recursively also. for (Uint32 i = 0; im_parent == this); m_children[i]->m_parent = NULL; - delete m_children[i]; } } @@ -686,9 +684,9 @@ NdbQueryOperationDef::getIndex() const * Implementation of NdbQueryBuilder factory ******************************************/ // Static method. -NdbQueryBuilder* NdbQueryBuilder::create(Ndb& ndb) +NdbQueryBuilder* NdbQueryBuilder::create() { - NdbQueryBuilderImpl* const impl = new NdbQueryBuilderImpl(ndb); + NdbQueryBuilderImpl* const impl = new NdbQueryBuilderImpl(); if (likely (impl != NULL)) { if (likely(impl->getNdbError().code == 0)) @@ -1045,9 +1043,9 @@ NdbQueryBuilder::prepare() // The (hidden) Impl of NdbQueryBuilder //////////////////////////////////////// -NdbQueryBuilderImpl::NdbQueryBuilderImpl(Ndb& ndb) +NdbQueryBuilderImpl::NdbQueryBuilderImpl() : m_interface(*this), - m_ndb(ndb), m_error(), + m_error(), m_operations(), m_operands(), m_paramCnt(0), @@ -1063,12 +1061,13 @@ NdbQueryBuilderImpl::NdbQueryBuilderImpl NdbQueryBuilderImpl::~NdbQueryBuilderImpl() { // Delete all operand and operator in Vector's - if (m_operations.size() > 0) + for (Uint32 i=0; i 0) + for (Uint32 i=0; igetQueryBuilder(); + NdbQueryBuilder* qb = myBuilder; const NdbQueryOperand* managerKey[] = // Manager is indexed om {"dept_no", "emp_no"} { qb->constValue("d005"), // dept_no = "d005" === modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.hpp' --- a/storage/ndb/src/ndbapi/NdbQueryBuilder.hpp 2011-04-06 14:16:13 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.hpp 2011-06-16 09:32:43 +0000 @@ -24,7 +24,6 @@ // skip includes...and require them to be included first // BUH! -class Ndb; class NdbQueryDef; class NdbQueryDefImpl; class NdbQueryBuilderImpl; @@ -358,9 +357,8 @@ private: * build phase. * * - The NdbQueryDef produced by the ::prepare() method has a lifetime - * determined by the Ndb object, or until it is explicit released by - * NdbQueryDef::release() - * + * until it is explicit released by NdbQueryDef::release() + * */ class NdbQueryBuilder { @@ -380,7 +378,7 @@ public: * Allocate an instance. * @return New instance, or NULL if allocation failed. */ - static NdbQueryBuilder* create(Ndb& ndb); + static NdbQueryBuilder* create(); /** * Release this object and any resources held by it. @@ -478,8 +476,7 @@ private: * NdbQueryDef represents a ::prepare()'d object from NdbQueryBuilder. * * The NdbQueryDef is reusable in the sense that it may be executed multiple - * times. Its lifetime is defined by the Ndb object which it was created with, - * or it may be explicitely released() when no longer required. + * times. It is valid until it is explicitely released(). * * The NdbQueryDef *must* be keept alive until the last thread * which executing a query based on this NdbQueryDef has completed execution === modified file 'storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp' --- a/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2011-05-05 11:06:08 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2011-06-16 09:32:43 +0000 @@ -631,7 +631,7 @@ class NdbQueryBuilderImpl public: ~NdbQueryBuilderImpl(); - explicit NdbQueryBuilderImpl(Ndb& ndb); + explicit NdbQueryBuilderImpl(); const NdbQueryDefImpl* prepare(); @@ -665,7 +665,6 @@ private: bool contains(const NdbQueryOperationDefImpl*); NdbQueryBuilder m_interface; - Ndb& m_ndb; NdbError m_error; Vector m_operations; === modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp' --- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-05-26 14:44:59 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-06-16 09:32:43 +0000 @@ -2895,7 +2895,6 @@ NdbQueryImpl::closeTcCursor(bool forceSe assert (m_queryDef.isScanQuery()); NdbImpl* const ndb = m_transaction.getNdb()->theImpl; - NdbImpl* const impl = ndb; const Uint32 timeout = ndb->get_waitfor_timeout(); const Uint32 nodeId = m_transaction.getConnectedNodeId(); const Uint32 seq = m_transaction.theNodeSequence; @@ -2905,7 +2904,7 @@ NdbQueryImpl::closeTcCursor(bool forceSe */ PollGuard poll_guard(*ndb); - if (unlikely(impl->getNodeSequence(nodeId) != seq)) + if (unlikely(ndb->getNodeSequence(nodeId) != seq)) { setErrorCode(Err_NodeFailCausedAbort); return -1; // Transporter disconnected and reconnected, no need to close @@ -2917,7 +2916,7 @@ NdbQueryImpl::closeTcCursor(bool forceSe const FetchResult result = static_cast (poll_guard.wait_scan(3*timeout, nodeId, forceSend)); - if (unlikely(impl->getNodeSequence(nodeId) != seq)) + if (unlikely(ndb->getNodeSequence(nodeId) != seq)) setFetchTerminated(Err_NodeFailCausedAbort,false); else if (unlikely(result != FetchResult_ok)) { @@ -2952,7 +2951,7 @@ NdbQueryImpl::closeTcCursor(bool forceSe const FetchResult result = static_cast (poll_guard.wait_scan(3*timeout, nodeId, forceSend)); - if (unlikely(impl->getNodeSequence(nodeId) != seq)) + if (unlikely(ndb->getNodeSequence(nodeId) != seq)) setFetchTerminated(Err_NodeFailCausedAbort,false); else if (unlikely(result != FetchResult_ok)) { === modified file 'storage/ndb/test/include/HugoQueryBuilder.hpp' --- a/storage/ndb/test/include/HugoQueryBuilder.hpp 2011-04-06 14:16:13 +0000 +++ b/storage/ndb/test/include/HugoQueryBuilder.hpp 2011-06-16 09:32:43 +0000 @@ -1,6 +1,5 @@ /* - Copyright (C) 2003 MySQL AB - All rights reserved. Use is subject to license terms. + Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -105,7 +104,7 @@ public: OptionMask getOptionMask() const { return m_options;} void setOptionMask(OptionMask om) { m_options = om;} - const NdbQueryDef * createQuery(Ndb*, bool takeOwnership = false); + const NdbQueryDef * createQuery(bool takeOwnership = false); private: struct TableDef === modified file 'storage/ndb/test/src/HugoQueryBuilder.cpp' --- a/storage/ndb/test/src/HugoQueryBuilder.cpp 2011-04-06 14:16:13 +0000 +++ b/storage/ndb/test/src/HugoQueryBuilder.cpp 2011-06-16 09:32:43 +0000 @@ -1,6 +1,5 @@ /* - Copyright (C) 2003 MySQL AB - All rights reserved. Use is subject to license terms. + Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -563,9 +562,9 @@ loop: } const NdbQueryDef * -HugoQueryBuilder::createQuery(Ndb* pNdb, bool takeOwnership) +HugoQueryBuilder::createQuery(bool takeOwnership) { - NdbQueryBuilder* const builder = NdbQueryBuilder::create(*pNdb); + NdbQueryBuilder* const builder = NdbQueryBuilder::create(); if (builder == NULL) { ndbout << "Failed to create NdbQueryBuilder." << endl; No bundle (reason: useless for push emails).