List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 10 2010 7:48am
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3282 to
3284)
View as plain text  
 3284 Jonas Oreland	2010-09-10
      ndb spj svs - Compute m_frags_not_complete while receiving rows from parent instead of when sending

    modified:
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 3283 Jonas Oreland	2010-09-10
      ndb - Fix problem single fragment table (e.g single ndbd)

    modified:
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 3282 Jonas Oreland	2010-09-10
      ndb spj svs - minor cleanups (preparation for non-parallel scan)

    modified:
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2010-09-10 06:23:27 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2010-09-10 07:48:02 +0000
@@ -4344,7 +4344,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
   data.m_scanCookie = cookie;
 
   const Uint32 prunemask = TreeNode::T_PRUNE_PATTERN | TreeNode::T_CONST_PRUNE;
-  const bool pruned = (treeNodePtr.p->m_bits & prunemask) != 0;
+  bool pruned = (treeNodePtr.p->m_bits & prunemask) != 0;
 
   Ptr<Request> requestPtr;
   m_request_pool.getPtr(requestPtr, treeNodePtr.p->m_requestPtrI);
@@ -4387,6 +4387,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
 
     fragPtr.p->m_fragId = tmp.fragId; 
     fragPtr.p->m_ref = tmp.receiverRef;
+    data.m_fragCount = 1;
   }
   else if (fragCount == 1)
   {
@@ -4406,6 +4407,11 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
     Uint32 clear = TreeNode::T_PRUNE_PATTERN | TreeNode::T_SCAN_PARALLEL;
     treeNodePtr.p->m_bits &= ~clear;
     treeNodePtr.p->m_bits |= TreeNode::T_CONST_PRUNE;
+
+    /**
+     * We must get fragPtr.p->m_ref...so set pruned=false
+     */
+    pruned = false;
   }
   else
   {
@@ -4595,6 +4601,7 @@ Dbspj::scanIndex_parent_row(Signal* sign
       {
         jam();
         fragPtr.p->m_ref = tmp.receiverRef;
+        data.m_frags_not_complete++;
       }
       else
       {
@@ -4614,6 +4621,7 @@ Dbspj::scanIndex_parent_row(Signal* sign
        * and send to 1 or all resp.
        */
       list.first(fragPtr);
+      data.m_frags_not_complete++;
     }
     
     Uint32 ptrI = fragPtr.p->m_rangePtrI;
@@ -4704,7 +4712,20 @@ Dbspj::scanIndex_parent_batch_complete(S
   data.m_rows_received = 0;
   data.m_rows_expecting = 0;
   ndbassert(data.m_frags_outstanding == 0);
-  ndbassert(data.m_frags_not_complete == 0);
+
+  if (data.m_frags_not_complete == 0)
+  {
+    jam();
+    /**
+     * No keys was produced...
+     */
+    return;
+  }
+  else if ((treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN) == 0)
+  {
+    jam();
+    data.m_frags_not_complete = data.m_fragCount;
+  }
 
   /**
    * When parent's batch is complete, we send our batch
@@ -4728,10 +4749,9 @@ Dbspj::scanIndex_send(Signal* signal,
   if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL)
   {
     jam();
-    cnt = data.m_fragCount;
+    cnt = data.m_frags_not_complete;
     ndbrequire(cnt > 0);
 
-    // TODO: In case of pruned scan, divide batchsize by how many fragments we will actually involve.
     bs_rows /= cnt;
     bs_bytes /= cnt;
 
@@ -4763,11 +4783,7 @@ Dbspj::scanIndex_send(Signal* signal,
     jam();
     list.first(fragPtr);
     keyInfoPtrI = fragPtr.p->m_rangePtrI;
-    if (keyInfoPtrI == RNIL)
-    {
-      jam();
-      return;
-    }
+    ndbrequire(keyInfoPtrI != RNIL);
   }
 
   Uint32 batchRange = 0;
@@ -4852,7 +4868,6 @@ Dbspj::scanIndex_send(Signal* signal,
     i++;
     fragPtr.p->m_state = ScanFragHandle::SFH_SCANNING; // running
     data.m_frags_outstanding++;
-    data.m_frags_not_complete++;
     batchRange += bs_rows;
   }
 
@@ -4864,10 +4879,13 @@ Dbspj::scanIndex_send(Signal* signal,
     releaseSection(keyInfoPtrI);
   }
 
-  if (data.m_frags_outstanding == 0)
+  if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL)
   {
-    jam();
-    return;
+    ndbrequire(data.m_frags_outstanding == data.m_frags_not_complete);
+  }
+  else
+  {
+    ndbrequire(data.m_frags_outstanding == 1);
   }
 
   requestPtr.p->m_cnt_active++;


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100910074802-vf0t4xqvcv1zmx4n.bundle
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3282 to3284) Jonas Oreland10 Sep