List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:April 25 2011 3:57pm
Subject:bzr commit into mysql-5.1-telco-7.0-wl4163 branch (pekka:4341) WL#4163
View as plain text  
#At file:///export/space/pekka/ms/ms-wl4163-70/ based on revid:pekka@stripped

 4341 Pekka Nousiainen	2011-04-25
      wl#4163 d01_ops.diff
      remove use of bottom node in search-to-scan

    modified:
      storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-04-24 13:10:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-04-25 15:57:28 +0000
@@ -850,8 +850,9 @@ Dbtux::scanFind(ScanOpPtr scanPtr)
  * 0 - up from left child (scan this node next)
  * 1 - up from right child (proceed to parent)
  * 2 - up from root (the scan ends)
- * 3 - left to right within node (at end proceed to right child)
+ * 3 - left to right within node (at end set state 5)
  * 4 - down from parent (proceed to left child)
+ * 5 - at node end proceed to right child (state becomes 4)
  *
  * If an entry was found, scan direction is 3.  Therefore tree
  * re-organizations need not worry about scan direction.
@@ -918,6 +919,19 @@ Dbtux::scanNext(ScanOpPtr scanPtr, bool
       // pretend we came from left child
       pos.m_dir = idir;
     }
+    if (pos.m_dir == 5) {
+      // at node end proceed to right child
+      jam();
+      TupLoc loc = node.getLink(1 - idir);
+      if (loc != NullTupLoc) {
+        jam();
+        pos.m_loc = loc;
+        pos.m_dir = 4;  // down from parent as usual
+        continue;
+      }
+      // pretend we came from right child
+      pos.m_dir = 1 - idir;
+    }
     const unsigned occup = node.getOccup();
     if (occup == 0) {
       jam();
@@ -949,15 +963,8 @@ Dbtux::scanNext(ScanOpPtr scanPtr, bool
         break;
       }
       // after node proceed to right child
-      TupLoc loc = node.getLink(1 - idir);
-      if (loc != NullTupLoc) {
-        jam();
-        pos.m_loc = loc;
-        pos.m_dir = 4;
-        continue;
-      }
-      // pretend we came from right child
-      pos.m_dir = 1 - idir;
+      pos.m_dir = 5;
+      continue;
     }
     if (pos.m_dir == 1 - idir) {
       // coming up from right child proceed to parent

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp	2011-04-25 14:50:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp	2011-04-25 15:57:28 +0000
@@ -229,7 +229,6 @@ Dbtux::searchToScanAscending(Frag& frag,
   NodeHandle currNode(frag);
   currNode.m_loc = tree.m_root;
   NodeHandle glbNode(frag);     // potential g.l.b of final node
-  NodeHandle bottomNode(frag);
   while (true) {
     jam();
     selectNode(currNode, currNode.m_loc);
@@ -255,8 +254,7 @@ Dbtux::searchToScanAscending(Frag& frag,
       }
       if (! glbNode.isNull()) {
         jam();
-        // move up to the g.l.b but remember the bottom node
-        bottomNode = currNode;
+        // move up to the g.l.b
         currNode = glbNode;
       } else {
         // start scanning this node
@@ -295,18 +293,10 @@ Dbtux::searchToScanAscending(Frag& frag,
       return;
     }
   }
-  // bound is to right of this node
-  if (! bottomNode.isNull()) {
-    jam();
-    // start scanning the l.u.b
-    treePos.m_loc = bottomNode.m_loc;
-    treePos.m_pos = 0;
-    treePos.m_dir = 3;
-    return;
-  }
-  // start scanning upwards (pretend we came from right child)
+  // start scanning after node end i.e. proceed to right child
   treePos.m_loc = currNode.m_loc;
-  treePos.m_dir = 1;
+  treePos.m_pos = ZNIL;
+  treePos.m_dir = 5;
 }
 
 void
@@ -316,7 +306,6 @@ Dbtux::searchToScanDescending(Frag& frag
   NodeHandle currNode(frag);
   currNode.m_loc = tree.m_root;
   NodeHandle glbNode(frag);     // potential g.l.b of final node
-  NodeHandle bottomNode(frag);
   while (true) {
     jam();
     selectNode(currNode, currNode.m_loc);
@@ -342,8 +331,7 @@ Dbtux::searchToScanDescending(Frag& frag
       }
       if (! glbNode.isNull()) {
         jam();
-        // move up to the g.l.b but remember the bottom node
-        bottomNode = currNode;
+        // move up to the g.l.b
         currNode = glbNode;
       } else {
         // empty result set


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20110425155728-8ljuaklky348yaq0.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-wl4163 branch (pekka:4341) WL#4163Pekka Nousiainen25 Apr