List:Commits« Previous MessageNext Message »
From:jonas Date:February 25 2006 9:12pm
Subject:bk commit into 5.1 tree (jonas:1.2112)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2112 06/02/25 22:12:16 jonas@eel.(none) +10 -0
  ndb dd -
    convert Dbtup::Page_request and pgman::Page_request to WOPool

  storage/ndb/src/kernel/vm/SimulatedBlock.hpp
    1.23 06/02/25 22:12:10 jonas@eel.(none) +1 -0
    Add records types to blocks includes

  storage/ndb/src/kernel/vm/SLFifoList.hpp
    1.2 06/02/25 22:12:10 jonas@eel.(none) +9 -5
    Add a few likely's + format some code

  storage/ndb/src/kernel/vm/DLFifoList.hpp
    1.7 06/02/25 22:12:10 jonas@eel.(none) +159 -203
    Made pool templ. ag of DLFifoList + cleanup some

  storage/ndb/src/kernel/blocks/pgman.hpp
    1.7 06/02/25 22:12:10 jonas@eel.(none) +8 -7
    Convert disk records to shared global mem users

  storage/ndb/src/kernel/blocks/pgman.cpp
    1.11 06/02/25 22:12:10 jonas@eel.(none) +12 -11
    Convert disk records to shared global mem users

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.31 06/02/25 22:12:10 jonas@eel.(none) +1 -1
    Make buddy is initialized first

  storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
    1.26 06/02/25 22:12:10 jonas@eel.(none) +4 -1
    Convert disk records to shared global mem users

  storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
    1.13 06/02/25 22:12:10 jonas@eel.(none) +9 -11
    Convert disk records to shared global mem users

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
    1.41 06/02/25 22:12:10 jonas@eel.(none) +11 -18
    Convert disk records to shared global mem users

  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.105 06/02/25 22:12:09 jonas@eel.(none) +1 -1
    remove bad method call

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/mysql-5.1-new

--- 1.12/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2006-02-15 13:20:12 +01:00
+++ 1.13/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2006-02-25 22:12:10 +01:00
@@ -89,8 +89,8 @@
   {
     printf("  %d : ", i);
     Ptr<Page_request> ptr;
-    LocalDLList<Page_request> list(c_page_request_pool, 
-				   alloc.m_page_requests[i]);
+    Local_page_request_list list(c_page_request_pool, 
+				 alloc.m_page_requests[i]);
     for(list.first(ptr); !ptr.isNull(); list.next(ptr))
     {
       ndbout << ptr << " ";
@@ -388,8 +388,6 @@
     return -err;
   }
 
-  new (req.p) Page_request();
-
   req.p->m_ref_count= 1;
   req.p->m_frag_ptr_i= fragPtr.i;
   req.p->m_uncommitted_used_space= sz;
@@ -510,8 +508,8 @@
   // And put page request in correct free list
   idx= alloc.calc_page_free_bits(new_size);
   {
-    LocalDLList<Page_request> list(c_page_request_pool, 
-				   alloc.m_page_requests[idx]);
+    Local_page_request_list list(c_page_request_pool, 
+				 alloc.m_page_requests[idx]);
     
     list.add(req);
   }
@@ -605,9 +603,9 @@
   
   if (old_idx != new_idx)
   {
-    DLList<Page_request>::Head *lists = alloc.m_page_requests;
-    LocalDLList<Page_request> old_list(c_page_request_pool, lists[old_idx]);
-    LocalDLList<Page_request> new_list(c_page_request_pool, lists[new_idx]);
+    Page_request_list::Head *lists = alloc.m_page_requests;
+    Local_page_request_list old_list(c_page_request_pool, lists[old_idx]);
+    Local_page_request_list new_list(c_page_request_pool, lists[new_idx]);
     old_list.remove(req);
     new_list.add(req);
 
@@ -761,8 +759,8 @@
   }
   
   {
-    Page_request_list list(c_page_request_pool, 
-			   alloc.m_page_requests[old_idx]);
+    Local_page_request_list list(c_page_request_pool, 
+				 alloc.m_page_requests[old_idx]);
     list.release(req);
   }
 }

--- 1.10/storage/ndb/src/kernel/blocks/pgman.cpp	2006-02-14 08:08:30 +01:00
+++ 1.11/storage/ndb/src/kernel/blocks/pgman.cpp	2006-02-25 22:12:10 +01:00
@@ -125,10 +125,13 @@
   {
     page_buffer /= GLOBAL_PAGE_SIZE; // in pages
     m_page_entry_pool.setSize(100*page_buffer);
-    m_page_request_pool.setSize(10000);
     m_param.m_max_pages = page_buffer;
     m_param.m_max_hot_pages = (page_buffer * 9) / 10;
   }
+
+  Pool_context pc;
+  pc.m_block = this;
+  m_page_request_pool.wo_pool_init(RT_PGMAN_PAGE_REQUEST, pc);
   
   ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
@@ -977,8 +980,7 @@
        * Make sure list is in own scope if callback will access this
        * list again (destructor restores list head).
        */
-      LocalDLFifoList<Page_request>
-        req_list(m_page_request_pool, ptr.p->m_requests);
+      Local_page_request_list req_list(m_page_request_pool, ptr.p->m_requests);
       Ptr<Page_request> req_ptr;
 
       req_list.first(req_ptr);
@@ -988,8 +990,6 @@
       b = globalData.getBlock(req_ptr.p->m_block);
       callback = req_ptr.p->m_callback;
       
-      req_list.release(req_ptr);
-
       if (req_ptr.p->m_flags & DIRTY_FLAGS)
       {
         jam();
@@ -997,6 +997,8 @@
 	ndbassert(ptr.p->m_dirty_count);
 	ptr.p->m_dirty_count --;
       }
+
+      req_list.releaseFirst(req_ptr);
     }
     ndbrequire(state & Page_entry::BOUND);
     ndbrequire(state & Page_entry::MAPPED);
@@ -1602,12 +1604,11 @@
   // queue the request
   Ptr<Pgman::Page_request> req_ptr;
   {
-    LocalDLFifoList<Page_request>
-      req_list(m_page_request_pool, ptr.p->m_requests);
+    Local_page_request_list req_list(m_page_request_pool, ptr.p->m_requests);
     if (! (req_flags & Page_request::ALLOC_REQ))
-      req_list.seize(req_ptr);
+      req_list.seizeLast(req_ptr);
     else
-      req_list.seizeFront(req_ptr);
+      req_list.seizeFirst(req_ptr);
   }
   
   if (req_ptr.i == RNIL)
@@ -2171,8 +2172,8 @@
   out << " busy_count=" << dec << pe.m_busy_count;
 #ifdef VM_TRACE
   {
-    LocalDLFifoList<Pgman::Page_request>
-      req_list(ptr.p->m_this->m_page_request_pool, ptr.p->m_requests);
+    Local_page_request_list req_list(ptr.p->m_this->m_page_request_pool, 
+				     ptr.p->m_requests);
     if (! req_list.isEmpty())
     {
       Ptr<Pgman::Page_request> req_ptr;

--- 1.6/storage/ndb/src/kernel/blocks/pgman.hpp	2006-02-14 08:08:30 +01:00
+++ 1.7/storage/ndb/src/kernel/blocks/pgman.hpp	2006-02-25 22:12:10 +01:00
@@ -262,13 +262,14 @@
     Uint16 m_flags;
     SimulatedBlock::Callback m_callback;
 
-    union {
-      Uint32 nextPool;
-      Uint32 nextList;
-    };
-    Uint32 prevList;
+    Uint32 nextList;
+    Uint32 m_magic;
   };
 
+  typedef RecordPool<Page_request, WOPool> Page_request_pool;
+  typedef SLFifoListImpl<Page_request_pool, Page_request> Page_request_list;
+  typedef LocalSLFifoListImpl<Page_request_pool, Page_request> Local_page_request_list;
+  
   struct Page_entry_stack_ptr {
     Uint32 nextList;
     Uint32 prevList;
@@ -338,7 +339,7 @@
       Uint32 nextPool;
     };
     
-    DLFifoList<Page_request>::Head m_requests;
+    Page_request_list::Head m_requests;
     
     Uint32 nextHash;
     Uint32 prevHash;
@@ -384,7 +385,7 @@
   File_map::DataBufferPool m_data_buffer_pool;
 
   // page entries and requests
-  ArrayPool<Page_request> m_page_request_pool;
+  Page_request_pool m_page_request_pool;
   ArrayPool<Page_entry> m_page_entry_pool;
   Page_hashlist m_page_hashlist;
   Page_stack m_page_stack;

--- 1.1/storage/ndb/src/kernel/vm/SLFifoList.hpp	2006-02-23 15:09:19 +01:00
+++ 1.2/storage/ndb/src/kernel/vm/SLFifoList.hpp	2006-02-25 22:12:10 +01:00
@@ -17,6 +17,7 @@
 #ifndef SLFIFOLIST_HPP
 #define SLFIFOLIST_HPP
 
+#include <ndb_global.h>
 #include <kernel_types.h>
 #include "Pool.hpp"
 
@@ -154,7 +155,7 @@
 bool
 SLFifoListImpl<P,T,U>::seizeFirst(Ptr<T> & p)
 {
-  if (thePool.seize(p)) 
+  if (likely(thePool.seize(p)))
   {
     addFirst(p);
     return true;
@@ -168,7 +169,7 @@
 bool
 SLFifoListImpl<P,T,U>::seizeLast(Ptr<T> & p)
 {
-  if (thePool.seize(p))
+  if (likely(thePool.seize(p)))
   {
     addLast(p);
     return true;
@@ -276,7 +277,8 @@
 SLFifoListImpl<P,T,U>::first(Ptr<T> & p) const 
 {
   p.i = head.firstItem;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -290,7 +292,8 @@
 SLFifoListImpl<P,T,U>::last(Ptr<T> & p) const 
 {
   p.i = head.lastItem;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -304,7 +307,8 @@
 SLFifoListImpl<P,T,U>::next(Ptr<T> & p) const 
 {
   p.i = p.p->U::nextList;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }

--- 1.104/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2006-02-14 08:08:31 +01:00
+++ 1.105/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2006-02-25 22:12:09 +01:00
@@ -12381,7 +12381,7 @@
 	  tmp2.release();
 	  LocalDataBuffer<11> tmp3(pool, trigPtr.p->afterValues);
 	  tmp3.release();
-          regApiPtr->theFiredTriggers.release(trigPtr.i);
+          regApiPtr->theFiredTriggers.release(trigPtr);
         }
 	trigPtr = nextTrigPtr;
       }

--- 1.40/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2006-02-17 17:05:12 +01:00
+++ 1.41/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2006-02-25 22:12:10 +01:00
@@ -469,20 +469,21 @@
 
   struct Page_request 
   {
-    Page_request() {}
     Local_key m_key;
-    Uint16 m_estimated_free_space; // in bytes/records
-    Uint16 m_list_index; // in Disk_alloc_info.m_page_requests
     Uint32 m_frag_ptr_i;
     Uint32 m_extent_info_ptr;
-    Uint16 m_ref_count; // Waiters for page
+    Uint16 m_estimated_free_space; // in bytes/records
+    Uint16 m_list_index;           // in Disk_alloc_info.m_page_requests
+    Uint16 m_ref_count;            // Waiters for page
     Uint16 m_uncommitted_used_space;
-    union {
-      Uint32 nextList;
-      Uint32 nextPool;
-    };
+    Uint32 nextList;
     Uint32 prevList;
+    Uint32 m_magic;
   }; // 32 bytes
+  
+  typedef RecordPool<Page_request, WOPool> Page_request_pool;
+  typedef DLFifoListImpl<Page_request_pool, Page_request> Page_request_list;
+  typedef LocalDLFifoListImpl<Page_request_pool, Page_request> Local_page_request_list;
 
   STATIC_CONST( EXTENT_SEARCH_MATRIX_COLS = 4 ); // Guarantee size
   STATIC_CONST( EXTENT_SEARCH_MATRIX_ROWS = 5 ); // Total size
@@ -518,7 +519,6 @@
   }; // 40 bytes
   
   typedef LocalDLList<Extent_info> Extent_list;
-  typedef LocalDLList<Page_request> Page_request_list;
 
   struct Tablerec;
   struct Disk_alloc_info 
@@ -553,7 +553,7 @@
      * Requests (for update) that have sufficient space left after request
      *   these are currently being "mapped"
      */
-    DLList<Page_request>::Head m_page_requests[MAX_FREE_LIST];
+    Page_request_list::Head m_page_requests[MAX_FREE_LIST];
 
     /**
      * Current extent
@@ -1010,7 +1010,7 @@
   };
   
   ArrayPool<Extent_info> c_extent_pool;
-  ArrayPool<Page_request> c_page_request_pool;
+  Page_request_pool c_page_request_pool;
   DLHashTable<Extent_info> c_extent_hash;
 
   typedef Ptr<Tablerec> TablerecPtr;
@@ -2608,13 +2608,6 @@
 		       Tablerec*, Fragrecord*, Local_key*, PagePtr, Uint32);
   void disk_page_free(Signal*, 
 		      Tablerec*, Fragrecord*, Local_key*, PagePtr, Uint32);
-  
-  void disk_page_update_free_space(Fragrecord*, Ptr<Page_request>,
-				   DLList<Page_request>::Head list[],
-				   Uint32 i, Uint32 sz);
-  void disk_page_update_free_space(Fragrecord*, PagePtr, Uint32 i,
-				   Int32 uncommitted_delta, 
-				   Int32 extent_delta);
   
   void disk_page_commit_callback(Signal*, Uint32 opPtrI, Uint32 page_id);  
   

--- 1.25/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2006-02-13 13:12:42 +01:00
+++ 1.26/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2006-02-25 22:12:10 +01:00
@@ -309,7 +309,10 @@
 
   c_extent_pool.setSize(8192);
   c_extent_hash.setSize(1024); // 4k
-  c_page_request_pool.setSize(1000);
+  
+  Pool_context pc;
+  pc.m_block = this;
+  c_page_request_pool.wo_pool_init(RT_DBTUP_PAGE_REQUEST, pc);
   
   Uint32 nScanOp;       // use TUX config for now
   ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));

--- 1.30/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-02-13 13:12:42 +01:00
+++ 1.31/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-02-25 22:12:10 +01:00
@@ -90,6 +90,7 @@
 static const Uint32 ALL_BLOCKS_SZ = sizeof(ALL_BLOCKS)/sizeof(BlockInfo);
 
 static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
+  CMVMI_REF,
   DBTUP_REF,
   DBACC_REF,
   DBTC_REF,
@@ -100,7 +101,6 @@
   NDBFS_REF,
   NDBCNTR_REF,
   QMGR_REF,
-  CMVMI_REF,
   TRIX_REF,
   BACKUP_REF,
   DBUTIL_REF,

--- 1.6/storage/ndb/src/kernel/vm/DLFifoList.hpp	2006-02-02 12:23:20 +01:00
+++ 1.7/storage/ndb/src/kernel/vm/DLFifoList.hpp	2006-02-25 22:12:10 +01:00
@@ -17,20 +17,23 @@
 #ifndef DLFIFOLIST_HPP
 #define DLFIFOLIST_HPP
 
-#include "ArrayPool.hpp"
-#include <NdbOut.hpp>
+#include <ndb_global.h>
+#include <kernel_types.h>
+#include "Pool.hpp"
 
 /**
  * Template class used for implementing an
  *   list of object retreived from a pool
  */
-template <class T, class U = T>
-class DLFifoList {
+template <typename P, typename T, typename U = T>
+class DLFifoListImpl 
+{
 public:
   /**
    * List head
    */
-  struct Head {
+  struct Head 
+  {
     Head();
     Uint32 firstItem;
     Uint32 lastItem;
@@ -42,62 +45,27 @@
     inline bool isEmpty() const { return firstItem == RNIL;}
   };
   
-  DLFifoList(ArrayPool<T> & thePool);
+  DLFifoListImpl(P & thePool);
   
-  /**
-   * Allocate an object from pool - update Ptr
-   *
-   * Return i
-   */
-  bool seize(Ptr<T> &);
-
-  /**
-   * Allocate an object from pool - update Ptr - put in front of list
-   *
-   * Return i
-   */
-  bool seizeFront(Ptr<T> &);
-
-  /**
-   * Allocate object <b>i</b> from pool - update Ptr
-   *
-   * Return i
-   */
-  bool seizeId(Ptr<T> &, Uint32 i);
+  bool seizeFirst(Ptr<T> &);
+  bool seizeLast(Ptr<T> &);
+  bool seize(Ptr<T> & ptr) { return seizeLast(ptr);}
   
-  /**
-   * Add object to list 
-   * 
-   * @NOTE MUST be seized from correct pool
-   */
-  void add(Ptr<T> &);
+  void release(Ptr<T> &);
+  void release(); // release all
+  
+  void addFirst(Ptr<T> &);
+  void addLast(Ptr<T> &);
+  void add(Ptr<T> & ptr) { addLast(ptr);}
 
   /**
    * Insert object <em>ptr</ptr> _before_ <em>loc</em>
    */
   void insert(Ptr<T> & ptr, Ptr<T>& loc);
   
-  /**
-   * Remove from list 
-   */
   void remove(Ptr<T> &);
-
-  /**
-   * Return an object to pool
-   */
-  void release(Uint32 i);
   
   /**
-   * Return an object to pool
-   */
-  void release(Ptr<T> &);
-
-  /**
-   * Return all objects to the pool
-   */
-  void release();
-
-  /**
    *  Update i & p value according to <b>i</b>
    */
   void getPtr(Ptr<T> &, Uint32 i) const;
@@ -119,7 +87,6 @@
    */
   bool first(Ptr<T> &) const ;
 
-
   /**
    * Update ptr to first element in list
    *
@@ -134,7 +101,6 @@
    */
   bool next(Ptr<T> &) const ;
   
-
   /**
    * Get next element
    *
@@ -148,61 +114,37 @@
    * NOTE ptr must be both p & i
    */
   bool hasNext(const Ptr<T> &) const;
-  
+
   /**
-   * Check if prev exists i.e. this is not first
+   * Check if next exists i.e. this is not last
    *
    * NOTE ptr must be both p & i
    */
   bool hasPrev(const Ptr<T> &) const;
-
-  Uint32 noOfElements() const {
-    Uint32 c = 0;
-    Uint32 i = head.firstItem;
-    while(i != RNIL){
-      c++;
-      const T * t = thePool.getPtr(i);
-      i = t->U::nextList;
-    }
-    return c;
-  }
-
-  /**
-   * Print
-   * (Run operator NdbOut<< on every element)
-   */
-  void print(NdbOut & out) {
-    Uint32 i = head.firstItem;
-    while(i != RNIL){
-      T * t = thePool.getPtr(i);
-      out << (unsigned int) t << "[" << i << "]:"; 
-      t->print(out); out << " ";
-      i = t->U::nextList;
-    }
-  }
-
+  
   inline bool isEmpty() const { return head.firstItem == RNIL;}
 
   /**
    * Copy list (head)
    *   Will construct to identical lists
    */
-  DLFifoList<T>& operator=(const DLFifoList<T>& src){
+  DLFifoListImpl<P,T,U>& operator=(const DLFifoListImpl<P,T,U>& src){
     assert(&thePool == &src.thePool);
     this->head = src.head;
     return * this;
   }
-
+  
 protected:
   Head head;
-  ArrayPool<T> & thePool;
+  P & thePool;
 };
 
-template <class T, class U = T>
-class LocalDLFifoList : public DLFifoList<T,U> {
+template <typename P, typename T, typename U = T>
+class LocalDLFifoListImpl : public DLFifoListImpl<P,T,U> 
+{
 public:
-  LocalDLFifoList(ArrayPool<T> & thePool, typename DLFifoList<T,U>::Head &_src)
-    : DLFifoList<T,U>(thePool), src(_src)
+  LocalDLFifoListImpl(P & thePool, typename DLFifoListImpl<P,T,U>::Head &_src)
+    : DLFifoListImpl<P,T,U>(thePool), src(_src)
   {
     this->head = src;
 #ifdef VM_TRACE
@@ -211,25 +153,27 @@
 #endif
   }
   
-  ~LocalDLFifoList(){
+  ~LocalDLFifoListImpl(){
 #ifdef VM_TRACE
     assert(src.in_use == true);
 #endif
     src = this->head;
   }
 private:
-  typename DLFifoList<T,U>::Head & src;
+  typename DLFifoListImpl<P,T,U>::Head & src;
 };
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
-DLFifoList<T,U>::DLFifoList(ArrayPool<T> & _pool):
-  thePool(_pool){
+DLFifoListImpl<P,T,U>::DLFifoListImpl(P & _pool):
+  thePool(_pool)
+{
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
-DLFifoList<T,U>::Head::Head(){
+DLFifoListImpl<P,T,U>::Head::Head()
+{
   firstItem = RNIL;
   lastItem = RNIL;
 #ifdef VM_TRACE
@@ -237,94 +181,83 @@
 #endif
 }
 
-/**
- * Allocate an object from pool - update Ptr
- *
- * Return i
- */
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::seize(Ptr<T> & p){
-  thePool.seize(p);
-  if (p.i != RNIL) {
-    add(p);
+DLFifoListImpl<P,T,U>::seizeFirst(Ptr<T> & p)
+{
+  if (likely(thePool.seize(p)))
+  {
+    addFirst(p);
     return true;
   }
   p.p = NULL;
   return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::seizeFront(Ptr<T> & p){
-  Uint32 ff = head.firstItem;
-  thePool.seize(p);
-  if (p.i != RNIL) 
+DLFifoListImpl<P,T,U>::seizeLast(Ptr<T> & p)
+{
+  if (likely(thePool.seize(p)))
   {
-    p.p->U::prevList = RNIL;
-    p.p->U::nextList = ff;
-    head.firstItem = p.i;
-    if (ff == RNIL)
-    {
-      head.lastItem = p.i;
-    }
-    else
-    {
-      T * t2 = thePool.getPtr(ff);
-      t2->U::prevList = p.i;
-    }
+    addLast(p);
     return true;
   }
   p.p = NULL;
   return false;
 }
 
-/**
- * Allocate an object from pool - update Ptr
- *
- * Return i
- */
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
-bool
-DLFifoList<T,U>::seizeId(Ptr<T> & p, Uint32 ir){
-  thePool.seizeId(p, ir);
-  if(p.i != RNIL){
-    add(p);
-    return true;
+void
+DLFifoListImpl<P,T,U>::addFirst(Ptr<T> & p)
+{
+  Uint32 ff = head.firstItem;
+  
+  p.p->U::prevList = RNIL;
+  p.p->U::nextList = ff;
+  head.firstItem = p.i;
+  if (ff == RNIL)
+  {
+    head.lastItem = p.i;
+  }
+  else
+  {
+    T * t2 = thePool.getPtr(ff);
+    t2->U::prevList = p.i;
   }
-  p.p = NULL;
-  return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 void
-DLFifoList<T,U>::add(Ptr<T> & p){
+DLFifoListImpl<P,T,U>::addLast(Ptr<T> & p)
+{
   T * t = p.p;
   Uint32 last = head.lastItem;
-
-  if(p.i == RNIL)
-    ErrorReporter::handleAssert("DLFifoList<T,U>::add", __FILE__, __LINE__);
+  head.lastItem = p.i;    
   
   t->U::nextList = RNIL;
   t->U::prevList = last;
-  if (head.firstItem == RNIL)
-    head.firstItem = p.i;
-  head.lastItem = p.i;    
   
-  if(last != RNIL){
+  if(last != RNIL)
+  {
     T * t2 = thePool.getPtr(last);
     t2->U::nextList = p.i;
   }
+  else
+  {
+    head.firstItem = p.i;
+  }
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 void
-DLFifoList<T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc){
+DLFifoListImpl<P,T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc)
+{
   Uint32 prev= loc.p->U::prevList;
   if(loc.i == head.firstItem)
   {
@@ -342,88 +275,85 @@
   ptr.p->U::nextList = loc.i;
 }
 
-/**
- * Return an object to pool
- */
-template <class T, class U>
-inline
-void 
-DLFifoList<T,U>::release(Uint32 i){
-  Ptr<T> p;
-  p.i = i;
-  p.p = thePool.getPtr(i);
-  release(p);
-}
-
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
-void 
-DLFifoList<T,U>::remove(Ptr<T> & p){
+void
+DLFifoListImpl<P,T,U>::remove(Ptr<T> & p)
+{
   T * t = p.p;
   Uint32 ni = t->U::nextList;
   Uint32 pi = t->U::prevList;
 
-  if(ni != RNIL){
+  if(ni != RNIL)
+  {
     T * t = thePool.getPtr(ni);
     t->U::prevList = pi;
-  } else {
+  } 
+  else 
+  {
     // We are releasing last
     head.lastItem = pi;
   }
   
-  if(pi != RNIL){
+  if(pi != RNIL)
+  {
     T * t = thePool.getPtr(pi);
     t->U::nextList = ni;
-  } else {
+  } 
+  else 
+  {
     // We are releasing first
     head.firstItem = ni;
   }
 }
-  
-/**
- * Return an object to pool
- */
-template <class T, class U>
-inline
-void 
-DLFifoList<T,U>::release(Ptr<T> & p){
-  remove(p);
-  thePool.release(p.i);
-}  
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 void 
-DLFifoList<T,U>::release(){
+DLFifoListImpl<P,T,U>::release()
+{
   Ptr<T> p;
-  while(head.firstItem != RNIL){
+  while(head.firstItem != RNIL)
+  {
     p.i = head.firstItem;  
     p.p = thePool.getPtr(head.firstItem);    
     T * t = p.p;
     head.firstItem = t->U::nextList;
     release(p);
   }
-}  
+}
+
+template <typename P, typename T, typename U>
+inline
+void 
+DLFifoListImpl<P,T,U>::release(Ptr<T> & p)
+{
+  remove(p);
+  thePool.release(p);
+}
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 void 
-DLFifoList<T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
+DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p, Uint32 i) const 
+{
   p.i = i;
   p.p = thePool.getPtr(i);
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 void 
-DLFifoList<T,U>::getPtr(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p) const 
+{
   thePool.getPtr(p);
 }
   
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 T * 
-DLFifoList<T,U>::getPtr(Uint32 i) const {
+DLFifoListImpl<P,T,U>::getPtr(Uint32 i) const 
+{
   return thePool.getPtr(i);
 }
 
@@ -432,12 +362,14 @@
  *
  * Return i
  */
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::first(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::first(Ptr<T> & p) const 
+{
   p.i = head.firstItem;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -445,12 +377,14 @@
   return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::last(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::last(Ptr<T> & p) const 
+{
   p.i = head.lastItem;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -458,12 +392,14 @@
   return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::next(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::next(Ptr<T> & p) const 
+{
   p.i = p.p->U::nextList;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -471,12 +407,14 @@
   return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::prev(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::prev(Ptr<T> & p) const 
+{
   p.i = p.p->U::prevList;
-  if(p.i != RNIL){
+  if(p.i != RNIL)
+  {
     p.p = thePool.getPtr(p.i);
     return true;
   }
@@ -484,18 +422,36 @@
   return false;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::hasNext(const Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::hasNext(const Ptr<T> & p) const 
+{
   return p.p->U::nextList != RNIL;
 }
 
-template <class T, class U>
+template <typename P, typename T, typename U>
 inline
 bool
-DLFifoList<T,U>::hasPrev(const Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::hasPrev(const Ptr<T> & p) const 
+{
   return p.p->U::prevList != RNIL;
 }
+
+// Specializations
+
+template <typename T, typename U = T>
+class DLFifoList : public DLFifoListImpl<ArrayPool<T>, T, U>
+{
+public:
+  DLFifoList(ArrayPool<T> & p) : DLFifoListImpl<ArrayPool<T>, T, U>(p) {}
+};
+
+template <typename T, typename U = T>
+class LocalDLFifoList : public LocalDLFifoListImpl<ArrayPool<T>,T,U> {
+public:
+  LocalDLFifoList(ArrayPool<T> & p, typename DLFifoList<T,U>::Head & _src)
+    : LocalDLFifoListImpl<ArrayPool<T>,T,U>(p, _src) {}
+};
 
 #endif

--- 1.22/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2006-02-22 14:23:50 +01:00
+++ 1.23/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2006-02-25 22:12:10 +01:00
@@ -53,6 +53,7 @@
 #include <signaldata/ReadConfig.hpp>
 #include <signaldata/UpgradeStartup.hpp>
 #include "ndbd_malloc_impl.hpp"
+#include <blocks/record_types.hpp>
 
 /**
  * Something for filesystem access
Thread
bk commit into 5.1 tree (jonas:1.2112)jonas25 Feb