List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:August 17 2011 1:07pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4465 to 4466)
View as plain text  
 4466 Ole John Aske	2011-08-17
      SPJ: Rename a couple of ::reset() methods to ::prepareNextReceiveSet() which
      is more descriptive.
            
      Also reorder code to place it together with NdbResultStream::prepareResultSet()
      which is logical related.

    modified:
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
 4465 Ole John Aske	2011-08-17
      SPJ: Introduce the helper class NdbResultSet which manage the receive/read
      buffer for class NdbResultStream.
            
      The intention is to later change class NdbResultStream to have
      multiple NdbResultSets -> double buffered results.

    modified:
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-08-17 13:03:23 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-08-17 13:06:11 +0000
@@ -187,9 +187,9 @@ public:
   { return m_fragNo; }
 
   /**
-   * Prepare for receiving another batch.
+   * Prepare for receiving another batch of results.
    */
-  void reset();
+  void prepareNextReceiveSet();
 
   /**
    * Prepare for reading another batch of results.
@@ -403,7 +403,7 @@ public:
   void prepare();
 
   /** Prepare for receiving next batch of scan results. */
-  void reset();
+  void prepareNextReceiveSet();
     
   NdbReceiver& getReceiver()
   { return m_receiver; }
@@ -738,27 +738,6 @@ NdbResultStream::prepare()
                           m_resultSets[m_recv].m_buffer);
 } //NdbResultStream::prepare
 
-void
-NdbResultStream::reset()
-{
-  assert (isScanQuery());
-
-  m_iterState = Iter_notStarted;
-  m_currentRow = tupleNotFound;
-  m_resultSets[m_recv].prepareReceive(m_receiver);
-
-  /**
-   * If this stream will get new rows in the next batch, then so will
-   * all of its descendants.
-   */
-  for (Uint32 childNo = 0; childNo < m_operation.getNoOfChildOperations();
-       childNo++)
-  {
-    NdbQueryOperationImpl& child = m_operation.getChildOperation(childNo);
-    m_rootFrag.getResultStream(child).reset();
-  }
-} //NdbResultStream::reset
-
 /** Locate, and return 'tupleNo', of first tuple with specified parentId.
  *  parentId == tupleNotFound is use as a special value for iterating results
  *  from the root operation in the order which they was inserted by 
@@ -851,7 +830,6 @@ NdbResultStream::firstResult()
   return tupleNotFound;
 } //NdbResultStream::firstResult()
 
-
 Uint16
 NdbResultStream::nextResult()
 {
@@ -867,7 +845,6 @@ NdbResultStream::nextResult()
   return tupleNotFound;
 } //NdbResultStream::nextResult()
 
-
 /**
  * Callback when a TRANSID_AI signal (receive row) is processed.
  */
@@ -891,6 +868,32 @@ NdbResultStream::execTRANSID_AI(const Ui
 } // NdbResultStream::execTRANSID_AI()
 
 /**
+ * Make preparation for another batch of results to be received.
+ * This NdbResultStream, and all its sibling will receive a batch
+ * of results from the datanodes.
+ */
+void
+NdbResultStream::prepareNextReceiveSet()
+{
+  assert (isScanQuery());
+
+  m_iterState = Iter_notStarted;
+  m_currentRow = tupleNotFound;
+  m_resultSets[m_recv].prepareReceive(m_receiver);
+
+  /**
+   * If this stream will get new rows in the next batch, then so will
+   * all of its descendants.
+   */
+  for (Uint32 childNo = 0; childNo < m_operation.getNoOfChildOperations();
+       childNo++)
+  {
+    NdbQueryOperationImpl& child = m_operation.getChildOperation(childNo);
+    m_rootFrag.getResultStream(child).prepareNextReceiveSet();
+  }
+} //NdbResultStream::prepareNextReceiveSet
+
+/**
  * Make preparations for another batch of result to be read:
  *  - Fill in parent/child result correlations in m_tupleSet[]
  *  - ... or reset m_tupleSet[] if we reuse the previous.
@@ -911,7 +914,8 @@ NdbResultStream::prepareResultSet(Uint32
 
   /**
    * Prepare NdbResultSet for reading - either the next received
-   * from datanodes or reuse current.
+   * from datanodes or reuse the last as has been determined by 
+   * ::prepareNextReceiveSet()
    */
   if (m_tupleSet!=NULL)
   {
@@ -1210,7 +1214,7 @@ bool NdbRootFragment::hasReceivedMore() 
   return (m_availResultSets > 0);
 }
 
-void NdbRootFragment::reset()
+void NdbRootFragment::prepareNextReceiveSet()
 {
   assert(m_fragNo!=voidFragNo);
   assert(m_outstandingResults == 0);
@@ -1218,13 +1222,14 @@ void NdbRootFragment::reset()
 
   for (unsigned opNo=0; opNo<m_query->getNoOfOperations(); opNo++) 
   {
-    if (!m_resultStreams[opNo].isSubScanComplete(m_remainingScans))
+    NdbResultStream& resultStream = getResultStream(opNo);
+    if (!resultStream.isSubScanComplete(m_remainingScans))
     {
       /**
-       * Reset m_resultStreams[] and all its descendants, since all these
+       * Reset resultStream and all its descendants, since all these
        * streams will get a new set of rows in the next batch.
        */ 
-      m_resultStreams[opNo].reset();
+      resultStream.prepareNextReceiveSet();
     }
   }
   m_confReceived = false;
@@ -3194,7 +3199,7 @@ NdbQueryImpl::sendFetchMore(NdbRootFragm
     NdbRootFragment* rootFrag = rootFrags[i];
     assert(rootFrag->isFragBatchComplete());
     assert(!rootFrag->finalBatchReceived());
-    rootFrag->reset();
+    rootFrag->prepareNextReceiveSet();
   }
 
   Ndb& ndb = *getNdbTransaction().getNdb();

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