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

 4357 Pekka Nousiainen	2011-05-04
      wl#4163 g04_ops.diff
      add node prefix back

    modified:
      storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-05-04 12:08:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-05-04 12:14:36 +0000
@@ -441,6 +441,8 @@ private:
     Uint32 m_descPage;          // descriptor page
     Uint16 m_descOff;           // offset within the page
     Uint16 m_numAttrs;
+    Uint16 m_prefAttrs;         // attributes in min prefix
+    Uint16 m_prefBytes;         // max bytes in min prefix
     KeySpec m_keySpec;
     union {
     bool m_storeNullKey;
@@ -999,6 +1001,8 @@ Dbtux::Index::Index() :
   m_descPage(RNIL),
   m_descOff(0),
   m_numAttrs(0),
+  m_prefAttrs(0),
+  m_prefBytes(0),
   m_keySpec(),
   m_storeNullKey(false)
 {

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2011-05-04 12:08:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2011-05-04 12:14:36 +0000
@@ -468,6 +468,8 @@ operator<<(NdbOut& out, const Dbtux::Ind
   out << " [descPage " << hex << index.m_descPage << "]";
   out << " [descOff " << dec << index.m_descOff << "]";
   out << " [numAttrs " << dec << index.m_numAttrs << "]";
+  out << " [prefAttrs " << dec << index.m_prefAttrs << "]";
+  out << " [prefBytes " << dec << index.m_prefBytes << "]";
   out << "]";
   return out;
 }

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2011-05-04 11:57:39 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2011-05-04 12:14:36 +0000
@@ -210,6 +210,30 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signa
       break;
     }
     if (lastAttr) {
+      // compute min prefix
+      const KeySpec& keySpec = indexPtr.p->m_keySpec;
+      unsigned attrs = 0;
+      unsigned bytes = keySpec.get_nullmask_len(false);
+      unsigned maxAttrs = indexPtr.p->m_numAttrs;
+#ifdef VM_TRACE
+      {
+        const char* p = NdbEnv_GetEnv("MAX_TTREE_PREF_ATTRS", (char*)0, 0);
+        if (p != 0 && p[0] != 0 && maxAttrs > atoi(p))
+          maxAttrs = atoi(p);
+      }
+#endif
+      while (attrs < maxAttrs) {
+        const KeyType& keyType = keySpec.get_type(attrs);
+        const unsigned newbytes = bytes + keyType.get_byte_size();
+        if (newbytes > (MAX_TTREE_PREF_SIZE << 2))
+          break;
+        attrs++;
+        bytes = newbytes;
+      }
+      if (attrs == 0)
+        bytes = 0;
+      indexPtr.p->m_prefAttrs = attrs;
+      indexPtr.p->m_prefBytes = bytes;
       // fragment is defined
 #ifdef VM_TRACE
       if (debugFlags & DebugMeta) {
@@ -319,7 +343,7 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
     new (&tree) TreeHead();
     // make these configurable later
     tree.m_nodeSize = MAX_TTREE_NODE_SIZE;
-    tree.m_prefSize = 0; // wl4163_todo temp disable prefix
+    tree.m_prefSize = (indexPtr.p->m_prefBytes + 3) / 4;
     const unsigned maxSlack = MAX_TTREE_NODE_SLACK;
     // size of header and min prefix
     const unsigned fixedSize = NodeHeadSize + tree.m_prefSize;

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp	2011-05-04 11:57:39 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp	2011-05-04 12:14:36 +0000
@@ -148,17 +148,25 @@ Dbtux::freePreallocatedNode(Frag& frag)
 }
 
 /*
- * Set prefix.  Copies the number of words that fits.  Includes
- * attribute headers for now.  XXX use null mask instead
+ * Set prefix.  Copies the defined number of attributes.
  */
 void
 Dbtux::setNodePref(TuxCtx & ctx, NodeHandle& node)
 {
   const Frag& frag = node.m_frag;
-  const TreeHead& tree = frag.m_tree;
-#if wl4163_todo // temp disable prefix
-  readKeyAttrs(ctx, frag, node.getEnt(0), 0, ctx.c_entryKey);
-  copyAttrs(ctx, frag, ctx.c_entryKey, node.getPref(), tree.m_prefSize);
+  const Index& index = *c_indexPool.getPtr(frag.m_indexId);
+  KeyData prefKey(index.m_keySpec, false, 0);
+  prefKey.set_buf(node.getPref(), index.m_prefBytes);
+  if (index.m_prefAttrs > 0) {
+    jam();
+    readKeyAttrs(ctx, frag, node.getEnt(0), prefKey, index.m_prefAttrs);
+  }
+#ifdef VM_TRACE
+  if (debugFlags & DebugMaint) {
+    char tmp[MaxAttrDataSize << 2];
+    debugOut << "setNodePref: " << node;
+    debugOut << " " << prefKey.print(tmp, sizeof(tmp)) << endl;
+  }
 #endif
 }
 


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