List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:January 23 2012 8:31am
Subject:bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3778 to 3779)
View as plain text  
 3779 Jonas Oreland	2012-01-23 [merge]
      ndb - merge 71 to 72

    added:
      storage/ndb/src/kernel/vm/CountingPool.cpp
      storage/ndb/src/kernel/vm/CountingPool.hpp
    modified:
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
      storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp
      storage/ndb/src/kernel/vm/CMakeLists.txt
      storage/ndb/src/kernel/vm/Pool.cpp
      storage/ndb/src/kernel/vm/Pool.hpp
 3778 Jonas Oreland	2012-01-23 [merge]
      ndb - merge 71 to 72

    added:
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/NdbRecordBlobImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/NdbRecordImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/NdbRecordOperationImpl.java
    modified:
      storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/SessionImpl.java
      storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/store/Operation.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/BlobImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ClusterConnectionImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ClusterConnectionServiceImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ClusterTransactionImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/ColumnImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/DbImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/DictionaryImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/OperationImpl.java
      storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/Utility.java
      storage/ndb/clusterj/clusterj-tie/src/main/resources/com/mysql/clusterj/tie/Bundle.properties
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2012-01-19 12:28:47 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2012-01-23 08:29:37 +0000
@@ -6536,7 +6536,8 @@ Dbdict::execADD_FRAGREQ(Signal* signal)
       findSchemaOp(op_ptr, alterTabPtr, senderData);
       ndbrequire(!op_ptr.isNull());
       alterTabPtr.p->m_dihAddFragPtr = dihPtr;
-      tabPtr = alterTabPtr.p->m_newTablePtr;
+      tabPtr.i = alterTabPtr.p->m_newTablePtrI;
+      c_tableRecordPool_.getPtr(tabPtr);
     }
     else
     {
@@ -8060,7 +8061,6 @@ Dbdict::alterTable_parse(Signal* signal,
   }
 
   // save it for abort code
-  alterTabPtr.p->m_tablePtr = tablePtr;
 
   if (tablePtr.p->tableVersion != impl_req->tableVersion) {
     jam();
@@ -8069,7 +8069,7 @@ Dbdict::alterTable_parse(Signal* signal,
   }
 
   // parse new table definition into new table record
-  TableRecordPtr& newTablePtr = alterTabPtr.p->m_newTablePtr; // ref
+  TableRecordPtr newTablePtr;
   {
     ParseDictTabInfoRecord parseRecord;
     parseRecord.requestType = DictTabInfo::AlterTableFromAPI;
@@ -8091,6 +8091,7 @@ Dbdict::alterTable_parse(Signal* signal,
 
     // the new temporary table record seized from pool
     newTablePtr = parseRecord.tablePtr;
+    alterTabPtr.p->m_newTablePtrI = newTablePtr.i;
     alterTabPtr.p->m_newTable_realObjectId = newTablePtr.p->tableId;
     newTablePtr.p->tableId = impl_req->tableId; // set correct table id...(not the temporary)
   }
@@ -8370,7 +8371,7 @@ Dbdict::alterTable_parse(Signal* signal,
     jam();
     releaseSections(handle);
     SimplePropertiesSectionWriter w(* this);
-    packTableIntoPages(w, alterTabPtr.p->m_newTablePtr);
+    packTableIntoPages(w, newTablePtr);
 
     SegmentedSectionPtr tabInfoPtr;
     w.getPtr(tabInfoPtr);
@@ -9178,8 +9179,11 @@ Dbdict::alterTable_toLocal(Signal* signa
     {
       jam();
       HashMapRecordPtr hm_ptr;
+      TableRecordPtr newTablePtr;
+      newTablePtr.i = alterTabPtr.p->m_newTablePtrI;
+      c_tableRecordPool_.getPtr(newTablePtr);
       ndbrequire(find_object(hm_ptr,
-                                      alterTabPtr.p->m_newTablePtr.p->hashMapObjectId));
+                             newTablePtr.p->hashMapObjectId));
       req->new_map_ptr_i = hm_ptr.p->m_map_ptr_i;
     }
 
@@ -9267,7 +9271,9 @@ Dbdict::alterTable_commit(Signal* signal
     tablePtr.p->tableVersion = impl_req->newTableVersion;
     tablePtr.p->gciTableCreated = impl_req->gci;
 
-    TableRecordPtr newTablePtr = alterTabPtr.p->m_newTablePtr;
+    TableRecordPtr newTablePtr;
+    newTablePtr.i = alterTabPtr.p->m_newTablePtrI;
+    c_tableRecordPool_.getPtr(newTablePtr);
 
     const Uint32 changeMask = impl_req->changeMask;
 
@@ -9359,7 +9365,9 @@ Dbdict::alterTable_commit(Signal* signal
     /**
      * DIH is next op
      */
-    TableRecordPtr newTablePtr = alterTabPtr.p->m_newTablePtr;
+    TableRecordPtr newTablePtr;
+    newTablePtr.i = alterTabPtr.p->m_newTablePtrI;
+    c_tableRecordPool_.getPtr(newTablePtr);
     tablePtr.p->hashMapObjectId = newTablePtr.p->hashMapObjectId;
     tablePtr.p->hashMapVersion = newTablePtr.p->hashMapVersion;
     alterTabPtr.p->m_blockNo[1] = RNIL;
@@ -9575,7 +9583,7 @@ Dbdict::alterTable_fromCommitComplete(Si
     objEntry->m_transId = 0;
   }
 
-  releaseTableObject(alterTabPtr.p->m_newTablePtr.i, false);
+  releaseTableObject(alterTabPtr.p->m_newTablePtrI, false);
   sendTransConf(signal, op_ptr);
 }
 
@@ -9653,8 +9661,7 @@ Dbdict::alterTable_abortParse(Signal* si
     return;
   }
 
-  TableRecordPtr& newTablePtr = alterTabPtr.p->m_newTablePtr; // ref
-  if (!newTablePtr.isNull()) {
+  if (alterTabPtr.p->m_newTablePtrI != RNIL) {
     jam();
     // release the temporary work table
 
@@ -9667,14 +9674,8 @@ Dbdict::alterTable_abortParse(Signal* si
       objEntry->m_transId = 0;
     }
 
-    releaseTableObject(newTablePtr.i, false);
-    newTablePtr.setNull();
-  }
-
-  TableRecordPtr& tablePtr = alterTabPtr.p->m_tablePtr; // ref
-  if (!tablePtr.isNull()) {
-    jam();
-    tablePtr.setNull();
+    releaseTableObject(alterTabPtr.p->m_newTablePtrI, false);
+    alterTabPtr.p->m_newTablePtrI = RNIL;
   }
 
   sendTransConf(signal, op_ptr);

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2012-01-18 15:16:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2012-01-23 08:29:37 +0000
@@ -2530,8 +2530,7 @@ private:
     MutexHandle2<BACKUP_DEFINE_MUTEX> m_define_backup_mutex;
 
     // current and new temporary work table
-    TableRecordPtr m_tablePtr;
-    TableRecordPtr m_newTablePtr;
+    TableRecordPtr::I m_newTablePtrI;
     Uint32 m_newTable_realObjectId;
 
     // before image
@@ -2560,8 +2559,7 @@ private:
     AlterTableRec() :
       OpRec(g_opInfo, (Uint32*)&m_request) {
       memset(&m_request, 0, sizeof(m_request));
-      m_tablePtr.setNull();
-      m_newTablePtr.setNull();
+      m_newTablePtrI = RNIL;
       m_dihAddFragPtr = RNIL;
       m_lqhFragPtr = RNIL;
       m_blockNo[0] = DBLQH;

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2012-01-18 15:16:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2012-01-23 08:29:37 +0000
@@ -63,8 +63,14 @@ struct Tup_fixsize_page
   struct File_formats::Page_header m_page_header;
   Uint32 m_restart_seq;
   Uint32 page_state;
-  Uint32 next_page;
-  Uint32 prev_page;
+  union {
+    Uint32 next_page;
+    Uint32 nextList;
+  };
+  union {
+    Uint32 prev_page;
+    Uint32 prevList;
+  };
   Uint32 first_cluster_page;
   Uint32 last_cluster_page;
   Uint32 next_cluster_page;
@@ -108,8 +114,14 @@ struct Tup_varsize_page
   struct File_formats::Page_header m_page_header;
   Uint32 m_restart_seq;
   Uint32 page_state;
-  Uint32 next_page;
-  Uint32 prev_page;
+  union {
+    Uint32 next_page;
+    Uint32 nextList;
+  };
+  union {
+    Uint32 prev_page;
+    Uint32 prevList;
+  };
   Uint32 first_cluster_page;
   Uint32 last_cluster_page;
   Uint32 next_cluster_page;

=== modified file 'storage/ndb/src/kernel/vm/CMakeLists.txt'
--- a/storage/ndb/src/kernel/vm/CMakeLists.txt	2012-01-18 15:16:38 +0000
+++ b/storage/ndb/src/kernel/vm/CMakeLists.txt	2012-01-23 08:29:37 +0000
@@ -62,18 +62,19 @@ IF(NDB_BUILD_NDBMTD)
     dummy_mt.cpp)
 ENDIF()
 
+ADD_CONVENIENCE_LIBRARY(ndbtest
+    test_context.cpp
+    ../blocks/dbtup/tuppage.cpp
+)
+
 ADD_EXECUTABLE(mt_thr_config-t mt_thr_config.cpp)
 SET_TARGET_PROPERTIES(mt_thr_config-t
                       PROPERTIES COMPILE_FLAGS "-DTEST_MT_THR_CONFIG")
 TARGET_LINK_LIBRARIES(mt_thr_config-t ndbgeneral)
 
-ADD_EXECUTABLE(DynArr256-t DynArr256.cpp test_context.cpp)
-SET_TARGET_PROPERTIES(DynArr256-t
-                      PROPERTIES COMPILE_FLAGS "-DTAP_TEST")
-TARGET_LINK_LIBRARIES(DynArr256-t ndbkernel ndbsched ndberror
-                      ndbtransport
-		      ndbmgmcommon
-                      ndbmgmapi 
-                      ndbportlib
-		      ndbgeneral)
-
+FOREACH(testprog IN ITEMS CountingPool DynArr256)
+  ADD_EXECUTABLE(${testprog}-t ${testprog}.cpp)
+  SET_TARGET_PROPERTIES(${testprog}-t PROPERTIES COMPILE_FLAGS "-DTAP_TEST")
+  TARGET_LINK_LIBRARIES(${testprog}-t ndbtest ndbkernel ndbsched ndberror
+                ndbtransport ndbmgmcommon ndbmgmapi ndbportlib ndbgeneral)
+ENDFOREACH(testprog)

=== added file 'storage/ndb/src/kernel/vm/CountingPool.cpp'
--- a/storage/ndb/src/kernel/vm/CountingPool.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/vm/CountingPool.cpp	2012-01-23 08:20:12 +0000
@@ -0,0 +1,29 @@
+#ifdef TAP_TEST
+
+#include <NdbTap.hpp>
+#include "CountingPool.hpp"
+#include "Pool.hpp"
+#include "RWPool.hpp"
+#include "test_context.hpp"
+#include "WOPool.hpp"
+
+struct record
+{
+  int dummy;
+};
+
+template class CountingPool<record, RecordPool<record, RWPool> >;
+template class CountingPool<record, RecordPool<record, WOPool> >;
+
+TAPTEST(CountingPool)
+{
+  Pool_context pc = test_context(100);
+
+  // Only compile test. See template instantiations above.
+
+  OK(true);
+
+  return 1;
+}
+
+#endif

=== added file 'storage/ndb/src/kernel/vm/CountingPool.hpp'
--- a/storage/ndb/src/kernel/vm/CountingPool.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/vm/CountingPool.hpp	2012-01-23 08:20:12 +0000
@@ -0,0 +1,118 @@
+#ifndef COUNTINGPOOL_HPP
+#define COUNTINGPOOL_HPP
+
+#include <ndb_global.h>
+#include "blocks/diskpage.hpp"
+#include "blocks/dbtup/tuppage.hpp"
+#include "ndbd_malloc_impl.hpp"
+#include "DLList.hpp"
+#include "Pool.hpp"
+
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+// Implementation CountingPool
+
+template<typename T, class P>
+class CountingPool : public P
+{
+  Uint32 m_inuse;
+  Uint32 m_inuse_high;
+  Uint32 m_max_allowed;
+protected:
+public:
+  CountingPool() :m_inuse(0), m_inuse_high(0), m_max_allowed(UINT32_MAX)
+    {}
+
+  bool seize(Ptr<T>& ptr)
+  {
+    if (m_inuse >= m_max_allowed)
+    {
+      return false;
+    }
+    bool ok = P::seize(ptr);
+    if (!ok)
+    {
+      return false;
+    }
+    m_inuse++;
+    if (m_inuse_high < m_inuse)
+    {
+      m_inuse_high++;
+    }
+    return true;
+  }
+
+  void release(Ptr<T> ptr)
+  {
+    P::release(ptr);
+    m_inuse--;
+  }
+
+  void release(Uint32 i)
+  {
+    Ptr<T> p;
+    getPtr(p, i);
+    release(p);
+  }
+
+  T* getPtr(Uint32 i)
+  {
+    return P::getPtr(i);
+  }
+
+  void getPtr(Ptr<T>& p, Uint32 i)
+  {
+    p.i = i;
+    p.p = getPtr(i);
+  }
+
+  void getPtr(Ptr<T>& p)
+  {
+    p.p = getPtr(p.i);
+  }
+
+  bool seize(Uint32& i)
+  {
+    Ptr<T> p;
+    p.i = i;
+    bool ok = seize(p);
+    i = p.i;
+    return ok;
+  }
+
+public:
+  // Extra methods
+  void setSize(Uint32 size)
+  {
+    m_max_allowed = size;
+  }
+
+  Uint32 getSize() const
+  {
+    return m_max_allowed /*m_seized*/;
+  }
+
+  Uint32 getEntrySize() const
+  {
+    return 8 * ((sizeof(T) + 7) / 8);  // Assuming alignment every 8 byte
+  }
+
+  Uint32 getNoOfFree() const
+  {
+    return getSize() - getUsed();
+  }
+
+  Uint32 getUsed() const
+  {
+    return m_inuse;
+  }
+
+  Uint32 getUsedHi() const
+  {
+    return m_inuse_high;
+  }
+};
+
+#endif

=== modified file 'storage/ndb/src/kernel/vm/Pool.cpp'
--- a/storage/ndb/src/kernel/vm/Pool.cpp	2012-01-18 15:16:38 +0000
+++ b/storage/ndb/src/kernel/vm/Pool.cpp	2012-01-23 08:29:37 +0000
@@ -34,13 +34,13 @@ Pool_context::release_page(Uint32 type_i
 }
 
 void*
-Pool_context::get_memroot()
+Pool_context::get_memroot() const
 {
   return m_block->m_ctx.m_mm.get_memroot();
 }
 
 void
-Pool_context::handleAbort(int err, const char * msg)
+Pool_context::handleAbort(int err, const char * msg) const
 {
   m_block->progError(__LINE__, err, msg);
 }

=== modified file 'storage/ndb/src/kernel/vm/Pool.hpp'
--- a/storage/ndb/src/kernel/vm/Pool.hpp	2012-01-18 15:16:38 +0000
+++ b/storage/ndb/src/kernel/vm/Pool.hpp	2012-01-23 08:29:37 +0000
@@ -72,7 +72,7 @@ struct Pool_context
   /**
    * Get mem root
    */
-  void* get_memroot();
+  void* get_memroot() const;
   
   /**
    * Alloc consekutive pages
@@ -118,12 +118,13 @@ struct Pool_context
   /**
    * Abort
    */
-  void handleAbort(int code, const char* msg) ATTRIBUTE_NORETURN;
+  void handleAbort(int code, const char* msg) const ATTRIBUTE_NORETURN;
 };
 
 template <typename T>
 struct Ptr 
 {
+  typedef Uint32 I;
   T * p;
   Uint32 i;
   inline bool isNull() const { return i == RNIL; }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3778 to 3779) Jonas Oreland23 Jan