List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:July 4 2012 12:51pm
Subject:bzr push into mysql-5.5-cluster-7.2 branch (ole.john.aske:3958 to 3959)
View as plain text  
 3959 Ole John Aske	2012-07-04
      This is a small SPJ refactoring patch which is required in preparation for fixing:
      
        - Bug 14143553 JOB BUFFER FULL - DATA NODE CRASH (Blizzard)
        - Bug 13799800 NDBMTD CRASHES DURING SONY-QUERY WITH 128 PARTITIONS ON 4 NODES WITH 4 LDM EACH
      
      Patch clean up the allocation of fragments list in Dbspj::execDIH_SCAN_TAB_CONF
      such that:
      
      - The fragment list is allocated in a *single place*, instead of two places
      - Scope of 'list(... , data.m:fragment) is made local within the
         code stub which require it.
         (Required by abort/error handling to be added later, as the list has to
         go out of scope, before it can be referred elsewhere)

    modified:
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
 3958 Ole John Aske	2012-07-04 [merge]
      Merged various 'SPJ resource leakage fixes' from 7.2-spj -> mysql-5.5-cluster.

    modified:
      storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp
      storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
      storage/ndb/src/ndbapi/ndberror.c
      storage/ndb/test/include/HugoQueries.hpp
      storage/ndb/test/ndbapi/testSpj.cpp
      storage/ndb/test/src/HugoQueries.cpp
      storage/ndb/test/tools/hugoJoin.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2012-06-19 13:29:32 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp	2012-07-04 12:50:47 +0000
@@ -2099,7 +2099,7 @@ Dbspj::execSCAN_NEXTREQ(Signal* signal)
   const ScanFragNextReq * req = (ScanFragNextReq*)&signal->theData[0];
 
 #ifdef DEBUG_SCAN_FRAGREQ
-  DEBUG("Incomming SCAN_NEXTREQ";
+  DEBUG("Incomming SCAN_NEXTREQ");
   printSCANFRAGNEXTREQ(stdout, &signal->theData[0],
                        ScanFragNextReq::SignalLength, DBLQH);
 #endif
@@ -4944,7 +4944,11 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
     jam();
     ScanFragReq::setReorgFlag(dst->requestInfo, 1);
   }
-
+  if (treeNodePtr.p->m_bits & TreeNode::T_CONST_PRUNE)
+  {
+    jam();
+    fragCount = 1;
+  }
   data.m_fragCount = fragCount;
   data.m_scanCookie = cookie;
 
@@ -4963,30 +4967,34 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
   do
   {
     Ptr<ScanFragHandle> fragPtr;
-    Local_ScanFragHandle_list list(m_scanfraghandle_pool, data.m_fragments);
 
-    if (ERROR_INSERTED_CLEAR(17012))
+    /** Allocate & init all 'fragCnt' fragment desriptors */
     {
-      jam();
-      ndbout_c("Injecting OutOfQueryMemory error 17012 at line %d file %s",
-               __LINE__,  __FILE__);
-      err = DbspjErr::OutOfQueryMemory;
-      break;
-    }
+      Local_ScanFragHandle_list list(m_scanfraghandle_pool, data.m_fragments);
 
-    if (likely(m_scanfraghandle_pool.seize(requestPtr.p->m_arena, fragPtr)))
-    {
-      jam();
-      fragPtr.p->init(fragNoOffs);
-      fragPtr.p->m_treeNodePtrI = treeNodePtr.i;
-      list.addLast(fragPtr);
-    }
-    else
-    {
-      jam();
-      err = DbspjErr::OutOfQueryMemory;
-      break;
-    }
+      for (Uint32 i = 0; i<fragCount; i++)
+      {
+        jam();
+        Ptr<ScanFragHandle> fragPtr;
+        Uint16 fragNo = (fragNoOffs+i) % fragCount;
+
+        if (!ERROR_INSERTED_CLEAR(17012) &&
+            likely(m_scanfraghandle_pool.seize(requestPtr.p->m_arena, fragPtr)))
+        {
+          jam();
+          fragPtr.p->init(fragNo);
+          fragPtr.p->m_treeNodePtrI = treeNodePtr.i;
+          list.addLast(fragPtr);
+        }
+        else
+        {
+          jam();
+          err = DbspjErr::OutOfQueryMemory;
+          goto error;
+        }
+      }
+      list.first(fragPtr); // Needed if T_CONST_PRUNE
+    } // end 'Alloc scope'
 
     if (treeNodePtr.p->m_bits & TreeNode::T_CONST_PRUNE)
     {
@@ -5018,7 +5026,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
 
       fragPtr.p->m_fragId = tmp.fragId;
       fragPtr.p->m_ref = tmp.receiverRef;
-      data.m_fragCount = 1;
+      ndbassert(data.m_fragCount == 1);
     }
     else if (fragCount == 1)
     {
@@ -5044,28 +5052,6 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
        */
       pruned = false;
     }
-    else
-    {
-      for (Uint32 i = 1; i<fragCount; i++)
-      {
-        jam();
-        Ptr<ScanFragHandle> fragPtr;
-        Uint16 fragNo = (fragNoOffs+i) % fragCount;
-        if (likely(m_scanfraghandle_pool.seize(requestPtr.p->m_arena, fragPtr)))
-        {
-          jam();
-          fragPtr.p->init(fragNo);
-          fragPtr.p->m_treeNodePtrI = treeNodePtr.i;
-          list.addLast(fragPtr);
-        }
-        else
-        {
-          jam();
-          err = DbspjErr::OutOfQueryMemory;
-          goto error;
-        }
-      }
-    }
     data.m_frags_complete = data.m_fragCount;
 
     if (!pruned)
@@ -5078,6 +5064,7 @@ Dbspj::execDIH_SCAN_TAB_CONF(Signal* sig
       req->scanCookie = cookie;
 
       Uint32 cnt = 0;
+      Local_ScanFragHandle_list list(m_scanfraghandle_pool, data.m_fragments);
       for (list.first(fragPtr); !fragPtr.isNull(); list.next(fragPtr))
       {
         jam();

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (ole.john.aske:3958 to 3959) Ole John Aske4 Jul