List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:August 15 2011 12:33pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4448 to 4449)
View as plain text  
 4449 Ole John Aske	2011-08-15
      Introduce The NdbResultStreams methods ::getReceiverId() & ::getReceiverTcPtrI()

    modified:
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
 4448 Ole John Aske	2011-08-15
      SPJ: Fixed 'of by one' bug in ::verifySortOrder() which caused
      the last element m_activeFrags[] to not be verified.
      
      Also fixed ::fetchRow to used not advance the current row in
      NdbReceiver which would cause the above verifySortOrder to fail.
      
      NOTE: All NdbReceiver navigation in NdbQueryOperation use random
      access to the received rows due to parent / child correlated 
      results and therefore does not need ::get_row() which advance
      to the next row.

    modified:
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-08-15 12:18:44 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-08-15 12:32:57 +0000
@@ -201,6 +201,9 @@ public:
   NdbResultStream& getResultStream(Uint32 operationNo) const
   { return m_query->getQueryOperation(operationNo).getResultStream(m_fragNo); }
   
+  Uint32 getReceiverId() const;
+  Uint32 getReceiverTcPtrI() const;
+
   /**
    * @return True if there are no more batches to be received for this fragment.
    */
@@ -876,8 +879,7 @@ void NdbRootFragment::buildReciverIdMap(
 {
   for(Uint32 fragNo = 0; fragNo < noOfFrags; fragNo++)
   {
-    const Uint32 receiverId = 
-      frags[fragNo].getResultStream(0).getReceiver().getId();
+    const Uint32 receiverId = frags[fragNo].getReceiverId();
     /** 
      * For reasons unknow, NdbObjectIdMap shifts ids two bits to the left,
      * so we must do the opposite to get a good hash distribution.
@@ -890,6 +892,7 @@ void NdbRootFragment::buildReciverIdMap(
   } 
 }
 
+//static
 NdbRootFragment* 
 NdbRootFragment::receiverIdLookup(NdbRootFragment* frags, 
                                   Uint32 noOfFrags, 
@@ -903,9 +906,7 @@ NdbRootFragment::receiverIdLookup(NdbRoo
   const int hash = (receiverId >> 2) % noOfFrags;
   int current = frags[hash].m_idMapHead;
   assert(current < static_cast<int>(noOfFrags));
-  while (current >= 0 && 
-         frags[current].getResultStream(0).getReceiver().getId() 
-         != receiverId)
+  while (current >= 0 && frags[current].getReceiverId() != receiverId)
   {
     current = frags[current].m_idMapNext;
     assert(current < static_cast<int>(noOfFrags));
@@ -958,14 +959,31 @@ void NdbRootFragment::setConfReceived()
 
 bool NdbRootFragment::finalBatchReceived() const
 {
-  return getResultStream(0).getReceiver().m_tcPtrI==RNIL;
+  return getReceiverTcPtrI()==RNIL;
 }
 
-bool  NdbRootFragment::isEmpty() const
+bool NdbRootFragment::isEmpty() const
 { 
   return getResultStream(0).isEmpty();
 }
 
+/**
+ * SPJ requests are identified by the receiver-id of the
+ * *root* ResultStream for each RootFragment. Furthermore
+ * a NEXTREQ use the tcPtrI saved in this ResultStream to
+ * identify the 'cursor' to restart.
+ *
+ * We provide some convenient accessors for fetching this info 
+ */
+Uint32 NdbRootFragment::getReceiverId() const
+{
+  return getResultStream(0).getReceiver().getId();
+}
+
+Uint32 NdbRootFragment::getReceiverTcPtrI() const
+{
+  return getResultStream(0).getReceiver().m_tcPtrI;
+}
 
 ///////////////////////////////////////////
 /////////  NdbQuery API methods ///////////
@@ -2868,8 +2886,7 @@ NdbQueryImpl::sendFetchMore(NdbRootFragm
   scanNextReq->transId2 = (Uint32) (transId >> 32);
   tSignal.setLength(ScanNextReq::SignalLength);
 
-  const uint32 receiverId = 
-    emptyFrag.getResultStream(0).getReceiver().m_tcPtrI;
+  const uint32 receiverId = emptyFrag.getReceiverTcPtrI();
   LinearSectionIterator receiverIdIter(&receiverId ,1);
 
   GenericSectionPtr secs[1];

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4448 to 4449) Ole John Aske16 Aug