List:Commits« Previous MessageNext Message »
From:Jan Wedvik Date:June 24 2011 11:20am
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jan.wedvik:3514
to 3515)
View as plain text  
 3515 Jan Wedvik	2011-06-24
      This is a refactoring, replacing m_frags_not_complete with m_frags_complete to improve readability.

    modified:
      storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 3514 Ole John Aske	2011-06-23
      Changed SPJ test to use two connections in order to avoid counters to be affected bu DDL operations.

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/t/ndb_join_pushdown.test
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp	2011-05-04 11:45:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp	2011-06-24 11:19:41 +0000
@@ -532,7 +532,7 @@ public:
 
   struct ScanIndexData
   {
-    Uint16 m_frags_not_complete;
+    Uint16 m_frags_complete;
     Uint16 m_frags_outstanding;
     Uint32 m_rows_received;  // #execTRANSID_AI
     Uint32 m_rows_expecting; // Sum(ScanFragConf)

=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2011-06-16 08:37:10 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2011-06-24 11:19:41 +0000
@@ -4449,7 +4449,7 @@ Dbspj::parseScanIndex(Build_context& ctx
     ScanIndexData& data = treeNodePtr.p->m_scanindex_data;
     data.m_fragments.init();
     data.m_frags_outstanding = 0;
-    data.m_frags_not_complete = 0;
+    data.m_frags_complete = 0;
     data.m_batch_chunks = 0;
 
     err = parseDA(ctx, requestPtr, treeNodePtr,
@@ -4679,6 +4679,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
       }
     }
   }
+  data.m_frags_complete = data.m_fragCount;
 
   if (!pruned)
   {
@@ -4966,7 +4967,8 @@ 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);
+  ndbassert(data.m_frags_complete == data.m_fragCount);
+  data.m_frags_complete = 0;
 
   Ptr<ScanFragHandle> fragPtr;
   {
@@ -4975,32 +4977,33 @@ Dbspj::scanIndex_parent_batch_complete(S
 
     if ((treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN) == 0)
     {
-      if (fragPtr.p->m_rangePtrI != RNIL)
+      if (fragPtr.p->m_rangePtrI == RNIL)
       {
-        // No pruning, so we must scan all fragments.
+        // No keys found
         jam();
-        data.m_frags_not_complete = data.m_fragCount;
+        data.m_frags_complete = data.m_fragCount;
       }
     }
     else
     {
       while(!fragPtr.isNull())
       {
-        if (fragPtr.p->m_rangePtrI != RNIL)
+        if (fragPtr.p->m_rangePtrI == RNIL)
         {
           jam();
           /**
            * This is a pruned scan, so we must scan those fragments that
            * some distribution key hashed to.
            */
-          data.m_frags_not_complete++;
+          fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE;
+          data.m_frags_complete++;
         }
         list.next(fragPtr);
       }
     }
   }
 
-  if (data.m_frags_not_complete == 0)
+  if (data.m_frags_complete == data.m_fragCount)
   {
     jam();
     /**
@@ -5058,7 +5061,7 @@ Dbspj::scanIndex_send(Signal* signal,
   if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL)
   {
     jam();
-    cnt = data.m_frags_not_complete;
+    cnt = data.m_fragCount - data.m_frags_complete;
     ndbrequire(cnt > 0);
 
     bs_rows /= cnt;
@@ -5194,7 +5197,8 @@ Dbspj::scanIndex_send(Signal* signal,
 
   if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL)
   {
-    ndbrequire(data.m_frags_outstanding == data.m_frags_not_complete);
+    ndbrequire(data.m_frags_outstanding == 
+               data.m_fragCount - data.m_frags_complete);
   }
   else
   {
@@ -5295,10 +5299,10 @@ Dbspj::scanIndex_execSCAN_FRAGCONF(Signa
   {
     jam();
     fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE;
-    ndbrequire(data.m_frags_not_complete>0);
-    data.m_frags_not_complete--;
+    ndbrequire(data.m_frags_complete < data.m_fragCount);
+    data.m_frags_complete++;
 
-    if (data.m_frags_not_complete == 0)
+    if (data.m_frags_complete == data.m_fragCount)
     {
       jam();
       ndbrequire(requestPtr.p->m_cnt_active);
@@ -5355,12 +5359,12 @@ Dbspj::scanIndex_execSCAN_FRAGREF(Signal
   fragPtr.p->m_state = ScanFragHandle::SFH_COMPLETE;
 
   ScanIndexData& data = treeNodePtr.p->m_scanindex_data;
-  ndbrequire(data.m_frags_not_complete > 0);
-  data.m_frags_not_complete--;
+  ndbrequire(data.m_frags_complete < data.m_fragCount);
+  data.m_frags_complete++;
   ndbrequire(data.m_frags_outstanding > 0);
   data.m_frags_outstanding--;
 
-  if (data.m_frags_not_complete == 0)
+  if (data.m_frags_complete == data.m_fragCount)
   {
     jam();
     ndbrequire(requestPtr.p->m_cnt_active);
@@ -5391,8 +5395,8 @@ Dbspj::scanIndex_execSCAN_NEXTREQ(Signal
   data.m_rows_expecting = 0;
   ndbassert(data.m_frags_outstanding == 0);
 
-  ndbrequire(data.m_frags_not_complete>0);
-  Uint32 cnt = data.m_frags_not_complete;
+  ndbrequire(data.m_frags_complete < data.m_fragCount);
+  Uint32 cnt = data.m_fragCount - data.m_frags_complete;
   if ((treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) == 0)
   {
     jam();
@@ -5581,7 +5585,7 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal
   Ptr<ScanFragHandle> fragPtr;
 
   Uint32 save0 = data.m_frags_outstanding;
-  Uint32 save1 = data.m_frags_not_complete;
+  Uint32 save1 = data.m_frags_complete;
 
   for (list.first(fragPtr); !fragPtr.isNull(); list.next(fragPtr))
   {
@@ -5597,8 +5601,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal
     switch(fragPtr.p->m_state){
     case ScanFragHandle::SFH_NOT_STARTED:
       jam();
-      ndbrequire(data.m_frags_not_complete > 0);
-      data.m_frags_not_complete--;
+      ndbrequire(data.m_frags_complete < data.m_fragCount);
+      data.m_frags_complete++;
       // fall through
     case ScanFragHandle::SFH_COMPLETE:
       jam();
@@ -5618,8 +5622,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal
     case ScanFragHandle::SFH_WAIT_NEXTREQ:
       jam();
       sum++;
-      ndbrequire(data.m_frags_not_complete > 0);
-      data.m_frags_not_complete--;
+      ndbrequire(data.m_frags_complete < data.m_fragCount);
+      data.m_frags_complete++;
       break;
     }
     fragPtr.p->m_ref = 0;
@@ -5633,7 +5637,8 @@ Dbspj::scanIndex_execNODE_FAILREP(Signal
     requestPtr.p->m_outstanding--;
   }
 
-  if (save1 != 0 && data.m_frags_not_complete == 0)
+  if (save1 != data.m_fragCount
+      && data.m_frags_complete == data.m_fragCount)
   {
     jam();
     ndbrequire(requestPtr.p->m_cnt_active);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jan.wedvik:3514to 3515) Jan Wedvik25 Jun