List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:September 24 2010 11:06am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (pekka:3304) Bug#56829
View as plain text  
#At file:///export/space/pekka/ms/ms-bug56829-63/ based on revid:pekka@stripped

 3304 Pekka Nousiainen	2010-09-24
      bug#56829 a02_patch.diff
      the patch

    modified:
      storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
      storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2010-09-03 05:30:17 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2010-09-24 11:06:19 +0000
@@ -1679,7 +1679,7 @@ public:
    * index node.  TUX reads and writes the node directly via pointer.
    */
   int tuxAllocNode(Uint8* jambase, Uint32* jamidx, Uint32 fragPtrI, Uint32& pageId, Uint32& pageOffset, Uint32*& node);
-  void tuxFreeNode(Signal* signal, Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* node);
+  void tuxFreeNode(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32* node);
   void tuxGetNode(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32*& node);
 
   /*

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2010-09-03 05:30:17 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp	2010-09-24 11:06:19 +0000
@@ -75,10 +75,8 @@ Dbtup::tuxAllocNode(Uint8* jambase, Uint
   return 0;
 }
 
-#if 0
 void
-Dbtup::tuxFreeNode(Signal* signal,
-                   Uint32 fragPtrI,
+Dbtup::tuxFreeNode(Uint32 fragPtrI,
                    Uint32 pageId,
                    Uint32 pageOffset,
                    Uint32* node)
@@ -90,15 +88,19 @@ Dbtup::tuxFreeNode(Signal* signal,
   TablerecPtr tablePtr;
   tablePtr.i= fragPtr.p->fragTableId;
   ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
+
+  Local_key key;
+  key.m_page_no = pageId;
+  key.m_page_idx = pageOffset;
   PagePtr pagePtr;
-  pagePtr.i= pageId;
-  ptrCheckGuard(pagePtr, cnoOfPage, cpage);
+  Tuple_header* ptr = (Tuple_header*)get_ptr(&pagePtr, &key, tablePtr.p);
+
   Uint32 attrDescIndex= tablePtr.p->tabDescriptor + (0 << ZAD_LOG_SIZE);
   Uint32 attrDataOffset= AttributeOffset::getOffset(tableDescriptor[attrDescIndex + 1].tabDescr);
-  ndbrequire(node == &pagePtr.p->pageWord[pageOffset] + attrDataOffset);
-  freeTh(fragPtr.p, tablePtr.p, signal, pagePtr.p, pageOffset);
+  ndbrequire(node == (Uint32*)ptr + attrDataOffset);
+
+  free_fix_rec(fragPtr.p, tablePtr.p, &key, (Fix_page*)pagePtr.p);
 }
-#endif
 
 void
 Dbtup::tuxGetNode(Uint32 fragPtrI,

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2010-08-20 10:18:47 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2010-09-24 11:06:19 +0000
@@ -493,7 +493,7 @@ private:
     Uint16 m_numAttrs;
     bool m_storeNullKey;
     TreeHead m_tree;
-    TupLoc m_freeLoc;           // list of free index nodes
+    TupLoc m_freeLoc;           // one free node for next op
     DLList<ScanOp> m_scanList;  // current scans on this fragment
     Uint32 m_tupIndexFragPtrI;
     Uint32 m_tupTableFragPtrI;
@@ -603,9 +603,11 @@ private:
    * DbtuxNode.cpp
    */
   int allocNode(TuxCtx&, NodeHandle& node);
+  void freeNode(NodeHandle& node);
   void selectNode(NodeHandle& node, TupLoc loc);
   void insertNode(NodeHandle& node);
   void deleteNode(NodeHandle& node);
+  void freePreallocatedNode(Frag& frag);
   void setNodePref(struct TuxCtx &, NodeHandle& node);
   // node operations
   void nodePushUp(TuxCtx&, NodeHandle& node, unsigned pos, const TreeEnt& ent, Uint32 scanList);

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp	2010-01-12 07:26:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxBuild.cpp	2010-09-24 11:06:19 +0000
@@ -144,8 +144,6 @@ Dbtux::mt_buildIndexFragment(mt_BuildInd
       {
         break;
       }
-      // link to freelist
-      node.setLink(0, frag.m_freeLoc);
       frag.m_freeLoc = node.m_loc;
       ndbrequire(frag.m_freeLoc != NullTupLoc);
     }

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp	2009-12-14 10:58:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp	2010-09-24 11:06:19 +0000
@@ -146,8 +146,6 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
         jam();
         break;
       }
-      // link to freelist
-      node.setLink(0, frag.m_freeLoc);
       frag.m_freeLoc = node.m_loc;
       ndbrequire(frag.m_freeLoc != NullTupLoc);
     }

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp	2009-12-14 10:58:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp	2010-09-24 11:06:19 +0000
@@ -54,6 +54,24 @@ Dbtux::allocNode(TuxCtx& ctx, NodeHandle
 }
 
 /*
+ * Free index node in TUP
+ */
+void
+Dbtux::freeNode(NodeHandle& node)
+{
+  Frag& frag = node.m_frag;
+  Uint32 pageId = node.m_loc.getPageId();
+  Uint32 pageOffset = node.m_loc.getPageOffset();
+  Uint32* node32 = reinterpret_cast<Uint32*>(node.m_node);
+  c_tup->tuxFreeNode(frag.m_tupIndexFragPtrI,
+                     pageId, pageOffset, node32);
+  jamEntry();
+  // invalidate the handle
+  node.m_loc = NullTupLoc;
+  node.m_node = 0;
+}
+
+/*
  * Set handle to point to existing node.
  */
 void
@@ -77,9 +95,9 @@ void
 Dbtux::insertNode(NodeHandle& node)
 {
   Frag& frag = node.m_frag;
-  // unlink from freelist
+  // use up pre-allocated node
   selectNode(node, frag.m_freeLoc);
-  frag.m_freeLoc = node.getLink(0);
+  frag.m_freeLoc = NullTupLoc;
   new (node.m_node) TreeNode();
 #ifdef VM_TRACE
   TreeHead& tree = frag.m_tree;
@@ -90,19 +108,44 @@ Dbtux::insertNode(NodeHandle& node)
 }
 
 /*
- * Delete existing node.  Simply put it on the freelist.
+ * Delete existing node.  Make it the pre-allocated free node if there
+ * is none.  Otherwise return it to fragment's free list.
  */
 void
 Dbtux::deleteNode(NodeHandle& node)
 {
   Frag& frag = node.m_frag;
   ndbrequire(node.getOccup() == 0);
-  // link to freelist
-  node.setLink(0, frag.m_freeLoc);
-  frag.m_freeLoc = node.m_loc;
-  // invalidate the handle
-  node.m_loc = NullTupLoc;
-  node.m_node = 0;
+  if (frag.m_freeLoc == NullTupLoc)
+  {
+    jam();
+    frag.m_freeLoc = node.m_loc;
+    // invalidate the handle
+    node.m_loc = NullTupLoc;
+    node.m_node = 0;
+  }
+  else
+  {
+    jam();
+    freeNode(node);
+  }
+}
+
+/*
+ * Free the pre-allocated node, called when tree is empty.  This avoids
+ * leaving any used pages in DataMemory.
+ */
+void
+Dbtux::freePreallocatedNode(Frag& frag)
+{
+  if (frag.m_freeLoc != NullTupLoc)
+  {
+    jam();
+    NodeHandle node(frag);
+    selectNode(node, frag.m_freeLoc);
+    freeNode(node);
+    frag.m_freeLoc = NullTupLoc;
+  }
 }
 
 /*

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp	2009-12-14 10:58:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp	2010-09-24 11:06:19 +0000
@@ -328,6 +328,8 @@ Dbtux::treeRemoveNode(Frag& frag, NodeHa
   }
   // tree is now empty
   tree.m_root = NullTupLoc;
+  // free even the pre-allocated node
+  freePreallocatedNode(frag);
 }
 
 /*


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20100924110619-q2q8schemjke0vth.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (pekka:3304) Bug#56829Pekka Nousiainen24 Sep