List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:March 29 2011 7:38am
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas:4259 to 4261)
View as plain text  
 4261 Jonas Oreland	2011-03-29
      ndb - make ObjectIdMap more unmap friendly, by using bit 0 to signal free/allocated. Note assumes that no object with uneven address will be mapped (which is asserted)

    modified:
      storage/ndb/src/ndbapi/ObjectMap.cpp
      storage/ndb/src/ndbapi/ObjectMap.hpp
 4260 Jonas Oreland	2011-03-29
      ndb - fix SPJ abort case

    modified:
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 4259 Jonas Oreland	2011-03-29 [merge]
      ndb - merge 63 to 70

    modified:
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2011-02-23 19:28:26 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2011-03-29 06:50:49 +0000
@@ -1546,7 +1546,7 @@ Dbspj::abort(Signal* signal, Ptr<Request
   if ((requestPtr.p->m_state & Request::RS_ABORTING) != 0)
   {
     jam();
-    return;
+    goto checkcomplete;
   }
 
   requestPtr.p->m_state |= Request::RS_ABORTING;
@@ -1573,6 +1573,7 @@ Dbspj::abort(Signal* signal, Ptr<Request
     }
   }
 
+checkcomplete:
   checkBatchComplete(signal, requestPtr, 0);
 }
 
@@ -5475,6 +5476,33 @@ Dbspj::scanIndex_cleanup(Ptr<Request> re
 {
   ScanIndexData& data = treeNodePtr.p->m_scanindex_data;
   Local_ScanFragHandle_list list(m_scanfraghandle_pool, data.m_fragments);
+  if (requestPtr.p->m_state & Request::RS_ABORTING)
+  {
+    /**
+     * If we're aborting...there can be keys attached...that has not
+     *   (and will not) be sent...release them to avoid memleak
+     */
+    jam();
+    Ptr<ScanFragHandle> fragPtr;
+    for (list.first(fragPtr); !fragPtr.isNull(); list.next(fragPtr))
+    {
+      if (fragPtr.p->m_rangePtrI != RNIL)
+      {
+        releaseSection(fragPtr.p->m_rangePtrI);
+        fragPtr.p->m_rangePtrI = RNIL;
+      }
+    }
+  }
+  else
+  {
+#ifdef VM_TRACE
+    Ptr<ScanFragHandle> fragPtr;
+    for (list.first(fragPtr); !fragPtr.isNull(); list.next(fragPtr))
+    {
+      ndbrequire(fragPtr.p->m_rangePtrI == RNIL);
+    }
+#endif
+  }
   list.remove();
 
   if (treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN)

=== modified file 'storage/ndb/src/ndbapi/ObjectMap.cpp'
--- a/storage/ndb/src/ndbapi/ObjectMap.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/ndbapi/ObjectMap.cpp	2011-03-29 07:38:11 +0000
@@ -47,9 +47,9 @@ int NdbObjectIdMap::expand(Uint32 incSiz
     m_map = tmp;
     
     for(Uint32 i = m_size; i < newSize; i++){
-      m_map[i].m_next = i + 1;
+      m_map[i].m_next = 2 * (i + 1) + 1;
     }
-    m_firstFree = m_size;
+    m_firstFree = (2 * m_size) + 1;
     m_map[newSize-1].m_next = InvalidId;
     m_size = newSize;
   }

=== modified file 'storage/ndb/src/ndbapi/ObjectMap.hpp'
--- a/storage/ndb/src/ndbapi/ObjectMap.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/ndbapi/ObjectMap.hpp	2011-03-29 07:38:11 +0000
@@ -47,7 +47,7 @@ private:
   Uint32 m_expandSize;
   Uint32 m_firstFree;
   union MapEntry {
-     Uint32 m_next;
+     UintPtr m_next;
      void * m_obj;
   } * m_map;
 
@@ -60,11 +60,12 @@ Uint32
 NdbObjectIdMap::map(void * object){
   
   //  lock();
+  assert((UintPtr(object) & 3) == 0);
   
   if(m_firstFree == InvalidId && expand(m_expandSize))
     return InvalidId;
   
-  Uint32 ff = m_firstFree;
+  Uint32 ff = m_firstFree >> 1;
   m_firstFree = m_map[ff].m_next;
   m_map[ff].m_obj = object;
   
@@ -86,7 +87,7 @@ NdbObjectIdMap::unmap(Uint32 id, void *o
     void * obj = m_map[i].m_obj;
     if (object == obj) {
       m_map[i].m_next = m_firstFree;
-      m_firstFree = i;
+      m_firstFree = (2 * i) + 1;
     } else {
       g_eventLogger->error("NdbObjectIdMap::unmap(%u, 0x%lx) obj=0x%lx",
                            id, (long) object, (long) obj);
@@ -109,7 +110,8 @@ NdbObjectIdMap::getObject(Uint32 id){
   // DBUG_PRINT("info",("NdbObjectIdMap::getObject(%u) obj=0x%x", id,  m_map[id>>2].m_obj));
   id >>= 2;
   if(id < m_size){
-    return m_map[id].m_obj;
+    if ((m_map[id].m_next & 3) == 0)
+      return m_map[id].m_obj;
   }
   return 0;
 }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas:4259 to 4261) Jonas Oreland29 Mar