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

 4359 Pekka Nousiainen	2011-05-04
      wl#4163 g06_ops.diff
      use node prefix in index scan

    modified:
      storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp	2011-05-04 12:24:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp	2011-05-04 12:25:51 +0000
@@ -218,20 +218,33 @@ Dbtux::findNodeToScan(Frag& frag, unsign
   const int jdir = 1 - 2 * int(idir);
   const Index& index = *c_indexPool.getPtr(frag.m_indexId);
   const Uint32 numAttrs = searchBound.get_data().get_cnt();
+  const Uint32 prefAttrs = min(index.m_prefAttrs, numAttrs);
+  const Uint32 prefBytes = index.m_prefBytes;
   KeyData entryKey(index.m_keySpec, false, 0);
   entryKey.set_buf(c_ctx.c_entryKey, MaxAttrDataSize << 2);
+  KeyDataC prefKey(index.m_keySpec, false);
   NodeHandle glbNode(frag);     // potential g.l.b of final node
   while (true) {
     jam();
     selectNode(currNode, currNode.m_loc);
-    // wl4163_todo temp disable prefix
-    int ret = (-1) * jdir;
+    prefKey.set_buf(currNode.getPref(), prefBytes, prefAttrs);
+    int ret = 0;
     if (numAttrs > 0) {
+      if (prefAttrs > 0) {
+        jam();
+        // compare node prefix - result 0 implies bound is longer
+        ret = cmpSearchBound(searchBound, prefKey, prefAttrs);
+      }
+      if (ret == 0) {
+        jam();
+        // read and compare all attributes
+        readKeyAttrs(c_ctx, frag, currNode.getEnt(0), entryKey, numAttrs);
+        ret = cmpSearchBound(searchBound, entryKey, numAttrs);
+        ndbrequire(ret != 0);
+      }
+    } else {
       jam();
-      // read and compare all attributes
-      readKeyAttrs(c_ctx, frag, currNode.getEnt(0), entryKey, numAttrs);
-      ret = cmpSearchBound(searchBound, entryKey, numAttrs);
-      ndbrequire(ret != 0);
+      ret = (-1) * jdir;
     }
     if (ret < 0) {
       // bound is left of this node


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20110504122551-25ombhiec7vhsj5a.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-wl4163 branch (pekka:4359) WL#4163Pekka Nousiainen4 May