List:Commits« Previous MessageNext Message »
From:jonas oreland Date:November 11 2011 8:58am
Subject:bzr push into mysql-5.1-telco-7.1 branch (jonas.oreland:4333 to 4334)
View as plain text  
 4334 jonas oreland	2011-11-11 [merge]
      ndb - merge 70 to 71

    modified:
      storage/ndb/src/common/util/NdbPack.cpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp
      storage/ndb/src/kernel/vm/DLFifoList.hpp
      storage/ndb/src/kernel/vm/DLHashTable.hpp
      storage/ndb/src/kernel/vm/SimulatedBlock.hpp
      storage/ndb/test/ndbapi/flexAsynch.cpp
 4333 jonas oreland	2011-11-10 [merge]
      ndb - merge 70 to 71

    modified:
      sql/ha_ndbcluster.cc
      storage/ndb/src/common/portlib/NdbThread.c
=== modified file 'storage/ndb/src/common/util/NdbPack.cpp'
--- a/storage/ndb/src/common/util/NdbPack.cpp	2011-08-09 15:37:45 +0000
+++ b/storage/ndb/src/common/util/NdbPack.cpp	2011-11-11 08:38:00 +0000
@@ -930,7 +930,6 @@ const char*
 NdbPack::Data::print(char* buf, Uint32 bufsz) const
 {
   Print p(buf, bufsz);
-  char* ptr = buf;
   if (m_varBytes != 0)
   {
     p.print("varBytes:");
@@ -1291,6 +1290,7 @@ Tdata::create()
     Uint8 xbuf[Tspec::MaxBuf];
     Uint64 xbuf_align;
   };
+  (void)xbuf_align; // compiler warning
   memset(xbuf, 0x3f, sizeof(xbuf));
   m_xsize = 0;
   m_xnulls = 0;
@@ -1830,7 +1830,7 @@ testdesc(const Tdata& tdata)
   const NdbPack::Data& data = tdata.m_data;
   const Uint8* buf_old = (const Uint8*)data.get_full_buf();
   const Uint32 varBytes = data.get_var_bytes();
-  const Uint32 nullMaskLen = tspec.m_spec.get_nullmask_len(false);
+  // const Uint32 nullMaskLen = tspec.m_spec.get_nullmask_len(false);
   const Uint32 dataLen = data.get_data_len();
   const Uint32 fullLen = data.get_full_len();
   const Uint32 cnt = data.get_cnt();

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2011-11-03 10:20:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2011-11-11 08:57:51 +0000
@@ -226,9 +226,9 @@ Dbdict::execDUMP_STATE_ORD(Signal* signa
 
   if (signal->theData[0] == 1227)
   {
-    DictObject_hash::Iterator iter;
-    bool ok = c_obj_hash.first(iter);
-    for(; ok; ok = c_obj_hash.next(iter))
+    DictObjectName_hash::Iterator iter;
+    bool ok = c_obj_name_hash.first(iter);
+    for (; ok; ok = c_obj_name_hash.next(iter))
     {
       LocalRope name(c_rope_pool, iter.curr.p->m_name);
       char buf[1024];
@@ -297,7 +297,7 @@ void Dbdict::execDBINFO_SCANREQ(Signal *
         { CFG_DB_NO_ATTRIBUTES,0,0,0 }},
       { "Table Record",
         c_tableRecordPool.getUsed(),
-        c_tableRecordPool.getSize(),
+        c_noOfMetaTables,
         c_tableRecordPool.getEntrySize(),
         c_tableRecordPool.getUsedHi(),
         { CFG_DB_NO_TABLES,0,0,0 }},
@@ -543,7 +543,7 @@ void Dbdict::packTableIntoPages(Signal*
   case DictTabInfo::Tablespace:
   case DictTabInfo::LogfileGroup:{
     FilegroupPtr fg_ptr;
-    ndbrequire(c_filegroup_hash.find(fg_ptr, tableId));
+    ndbrequire(find_object(fg_ptr, tableId));
     const Uint32 free_hi= signal->theData[4];
     const Uint32 free_lo= signal->theData[5];
     packFilegroupIntoPages(w, fg_ptr, free_hi, free_lo);
@@ -551,20 +551,20 @@ void Dbdict::packTableIntoPages(Signal*
   }
   case DictTabInfo::Datafile:{
     FilePtr fg_ptr;
-    ndbrequire(c_file_hash.find(fg_ptr, tableId));
+    ndbrequire(find_object(fg_ptr, tableId));
     const Uint32 free_extents= signal->theData[4];
     packFileIntoPages(w, fg_ptr, free_extents);
     break;
   }
   case DictTabInfo::Undofile:{
     FilePtr fg_ptr;
-    ndbrequire(c_file_hash.find(fg_ptr, tableId));
+    ndbrequire(find_object(fg_ptr, tableId));
     packFileIntoPages(w, fg_ptr, 0);
     break;
   }
   case DictTabInfo::HashMap:{
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, tableId));
+    ndbrequire(find_object(hm_ptr, tableId));
     packHashMapIntoPages(w, hm_ptr);
     break;
   }
@@ -656,7 +656,7 @@ Dbdict::packTableIntoPages(SimplePropert
   if (tablePtr.p->hashMapObjectId != RNIL)
   {
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, tablePtr.p->hashMapObjectId));
+    ndbrequire(find_object(hm_ptr, tablePtr.p->hashMapObjectId));
     w.add(DictTabInfo::HashMapVersion, hm_ptr.p->m_object_version);
   }
 
@@ -731,7 +731,7 @@ Dbdict::packTableIntoPages(SimplePropert
   {
     w.add(DictTabInfo::TablespaceId, tablePtr.p->m_tablespace_id);
     FilegroupPtr tsPtr;
-    ndbrequire(c_filegroup_hash.find(tsPtr, tablePtr.p->m_tablespace_id));
+    ndbrequire(find_object(tsPtr, tablePtr.p->m_tablespace_id));
     w.add(DictTabInfo::TablespaceVersion, tsPtr.p->m_version);
   }
 
@@ -830,7 +830,7 @@ Dbdict::packFilegroupIntoPages(SimplePro
     fg.TS_ExtentSize = fg_ptr.p->m_tablespace.m_extent_size;
     fg.TS_LogfileGroupId = fg_ptr.p->m_tablespace.m_default_logfile_group_id;
     FilegroupPtr lfg_ptr;
-    ndbrequire(c_filegroup_hash.find(lfg_ptr, fg.TS_LogfileGroupId));
+    ndbrequire(find_object(lfg_ptr, fg.TS_LogfileGroupId));
     fg.TS_LogfileGroupVersion = lfg_ptr.p->m_version;
     break;
   case DictTabInfo::LogfileGroup:
@@ -869,7 +869,7 @@ Dbdict::packFileIntoPages(SimpleProperti
   f.FileVersion = f_ptr.p->m_version;
 
   FilegroupPtr lfg_ptr;
-  ndbrequire(c_filegroup_hash.find(lfg_ptr, f.FilegroupId));
+  ndbrequire(find_object(lfg_ptr, f.FilegroupId));
   f.FilegroupVersion = lfg_ptr.p->m_version;
 
   SimpleProperties::UnpackStatus s;
@@ -1816,7 +1816,7 @@ void Dbdict::closeReadSchemaConf(Signal*
       ndbrequire(c_writeSchemaRecord.inUse == false);
       XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.oldSchemaPage != 0 ];
       Uint32 noOfPages =
-        (c_tableRecordPool.getSize() + NDB_SF_PAGE_ENTRIES - 1) /
+        (c_noOfMetaTables + NDB_SF_PAGE_ENTRIES - 1) /
         NDB_SF_PAGE_ENTRIES;
       resizeSchemaFile(xsf, noOfPages);
 
@@ -1946,15 +1946,13 @@ Dbdict::convertSchemaFileTo_6_4(XSchemaF
 Dbdict::Dbdict(Block_context& ctx):
   SimulatedBlock(DBDICT, ctx),
   c_attributeRecordHash(c_attributeRecordPool),
-  c_file_hash(c_file_pool),
-  c_filegroup_hash(c_filegroup_pool),
-  c_obj_hash(c_obj_pool),
+  c_obj_name_hash(c_obj_pool),
+  c_obj_id_hash(c_obj_pool),
   c_schemaOpHash(c_schemaOpPool),
   c_schemaTransHash(c_schemaTransPool),
   c_schemaTransList(c_schemaTransPool),
   c_schemaTransCount(0),
   c_txHandleHash(c_txHandlePool),
-  c_hash_map_hash(c_hash_map_pool),
   c_opCreateEvent(c_opRecordPool),
   c_opSubEvent(c_opRecordPool),
   c_opDropEvent(c_opRecordPool),
@@ -2374,6 +2372,7 @@ void Dbdict::initialiseTableRecord(Table
   tablePtr.p->indexStatFragId = ZNIL;
   tablePtr.p->indexStatNodeId = ZNIL;
   tablePtr.p->indexStatBgRequest = 0;
+  tablePtr.p->m_obj_ptr_i = RNIL;
 }//Dbdict::initialiseTableRecord()
 
 void Dbdict::initTriggerRecords()
@@ -2416,12 +2415,12 @@ Uint32 Dbdict::getFsConnRecord()
  * Search schemafile for free entry.  Its index is used as 'logical id'
  * of new disk-stored object.
  */
-Uint32 Dbdict::getFreeObjId(Uint32 minId, bool both)
+Uint32 Dbdict::getFreeObjId(bool both)
 {
   const XSchemaFile * newxsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
   const XSchemaFile * oldxsf = &c_schemaFile[SchemaRecord::OLD_SCHEMA_FILE];
   const Uint32 noOfEntries = newxsf->noOfPages * NDB_SF_PAGE_ENTRIES;
-  for (Uint32 i = minId; i<noOfEntries; i++)
+  for (Uint32 i = 0; i<noOfEntries; i++)
   {
     const SchemaFile::TableEntry * oldentry = getTableEntry(oldxsf, i);
     const SchemaFile::TableEntry * newentry = getTableEntry(newxsf, i);
@@ -2441,12 +2440,12 @@ Uint32 Dbdict::getFreeObjId(Uint32 minId
 
 Uint32 Dbdict::getFreeTableRecord()
 {
-  Uint32 i = getFreeObjId(0);
+  Uint32 i = getFreeObjId();
   if (i == RNIL) {
     jam();
     return RNIL;
   }
-  if (i >= c_tableRecordPool.getSize()) {
+  if (i >= c_noOfMetaTables) {
     jam();
     return RNIL;
   }
@@ -2632,11 +2631,11 @@ void Dbdict::execREAD_CONFIG_REQ(Signal*
     m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
 
-  Uint32 attributesize, tablerecSize;
+  Uint32 attributesize;
   ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TRIGGERS,
 					&c_maxNoOfTriggers));
   ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_ATTRIBUTE,&attributesize));
-  ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &tablerecSize));
+  ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &c_noOfMetaTables));
   c_indexStatAutoCreate = 0;
   ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_AUTO_CREATE,
                             &c_indexStatAutoCreate);
@@ -2655,8 +2654,8 @@ void Dbdict::execREAD_CONFIG_REQ(Signal*
   c_nodes.setSize(MAX_NDB_NODES);
   c_pageRecordArray.setSize(ZNUMBER_OF_PAGES);
   c_schemaPageRecordArray.setSize(2 * NDB_SF_MAX_PAGES);
-  c_tableRecordPool.setSize(tablerecSize);
-  g_key_descriptor_pool.setSize(tablerecSize);
+  c_tableRecordPool.setSize(c_noOfMetaTables);
+  g_key_descriptor_pool.setSize(c_noOfMetaTables);
   c_triggerRecordPool.setSize(c_maxNoOfTriggers);
 
   Record_info ri;
@@ -2669,13 +2668,11 @@ void Dbdict::execREAD_CONFIG_REQ(Signal*
   c_txHandlePool.setSize(2);
   c_txHandleHash.setSize(2);
 
-  c_obj_pool.setSize(tablerecSize+c_maxNoOfTriggers);
-  c_obj_hash.setSize((tablerecSize+c_maxNoOfTriggers+1)/2);
+  c_obj_pool.setSize(c_noOfMetaTables+c_maxNoOfTriggers);
+  c_obj_name_hash.setSize((c_noOfMetaTables+c_maxNoOfTriggers+1)/2);
+  c_obj_id_hash.setSize((c_noOfMetaTables+c_maxNoOfTriggers+1)/2);
   m_dict_lock_pool.setSize(MAX_NDB_NODES);
 
-  c_file_hash.setSize(16);
-  c_filegroup_hash.setSize(16);
-
   c_file_pool.init(RT_DBDICT_FILE, pc);
   c_filegroup_pool.init(RT_DBDICT_FILEGROUP, pc);
 
@@ -2704,7 +2701,6 @@ void Dbdict::execREAD_CONFIG_REQ(Signal*
   c_copyDataRecPool.arena_pool_init(&c_arenaAllocator, RT_DBDICT_COPY_DATA, pc);
   c_schemaOpPool.arena_pool_init(&c_arenaAllocator, RT_DBDICT_SCHEMA_OPERATION, pc);
 
-  c_hash_map_hash.setSize(4);
   c_hash_map_pool.setSize(32);
   g_hash_map.setSize(32);
 
@@ -2726,7 +2722,7 @@ void Dbdict::execREAD_CONFIG_REQ(Signal*
   c_schemaFile[1].noOfPages = 0;
 
   Uint32 rps = 0;
-  rps += tablerecSize * (MAX_TAB_NAME_SIZE + MAX_FRM_DATA_SIZE);
+  rps += c_noOfMetaTables * (MAX_TAB_NAME_SIZE + MAX_FRM_DATA_SIZE);
   rps += attributesize * (MAX_ATTR_NAME_SIZE + MAX_ATTR_DEFAULT_VALUE_SIZE);
   rps += c_maxNoOfTriggers * MAX_TAB_NAME_SIZE;
   rps += (10 + 10) * MAX_TAB_NAME_SIZE;
@@ -2896,7 +2892,7 @@ void Dbdict::execREAD_NODESCONF(Signal*
 void Dbdict::initSchemaFile(Signal* signal)
 {
   XSchemaFile * xsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
-  xsf->noOfPages = (c_tableRecordPool.getSize() + NDB_SF_PAGE_ENTRIES - 1)
+  xsf->noOfPages = (c_noOfMetaTables + NDB_SF_PAGE_ENTRIES - 1)
                    / NDB_SF_PAGE_ENTRIES;
   initSchemaFile(xsf, 0, xsf->noOfPages, true);
   // init alt copy too for INR
@@ -2966,7 +2962,7 @@ Dbdict::activateIndexes(Signal* signal,
 
   TableRecordPtr indexPtr;
   indexPtr.i = i;
-  for (; indexPtr.i < c_tableRecordPool.getSize(); indexPtr.i++)
+  for (; indexPtr.i < c_noOfMetaTables; indexPtr.i++)
   {
     c_tableRecordPool.getPtr(indexPtr);
 
@@ -3133,7 +3129,7 @@ Dbdict::rebuildIndexes(Signal* signal, U
 
   TableRecordPtr indexPtr;
   indexPtr.i = i;
-  for (; indexPtr.i < c_tableRecordPool.getSize(); indexPtr.i++) {
+  for (; indexPtr.i < c_noOfMetaTables; indexPtr.i++) {
     c_tableRecordPool.getPtr(indexPtr);
     if (check_read_obj(indexPtr.i))
       continue;
@@ -3656,7 +3652,7 @@ void Dbdict::checkSchemaStatus(Signal* s
     SchemaFile::EntryState ownState =
       (SchemaFile::EntryState)ownEntry->m_tableState;
 
-    if (c_restartRecord.activeTable >= c_tableRecordPool.getSize())
+    if (c_restartRecord.activeTable >= c_noOfMetaTables)
     {
       jam();
       ndbrequire(masterState == SchemaFile::SF_UNUSED);
@@ -4150,7 +4146,7 @@ Dbdict::execGET_TABINFO_CONF(Signal* sig
     {
       jam();
       FilePtr fg_ptr;
-      ndbrequire(c_file_hash.find(fg_ptr, conf->tableId));
+      ndbrequire(find_object(fg_ptr, conf->tableId));
       const Uint32 free_extents= conf->freeExtents;
       const Uint32 id= conf->tableId;
       const Uint32 type= conf->tableType;
@@ -4168,7 +4164,7 @@ Dbdict::execGET_TABINFO_CONF(Signal* sig
     {
       jam();
       FilegroupPtr fg_ptr;
-      ndbrequire(c_filegroup_hash.find(fg_ptr, conf->tableId));
+      ndbrequire(find_object(fg_ptr, conf->tableId));
       const Uint32 free_hi= conf->freeWordsHi;
       const Uint32 free_lo= conf->freeWordsLo;
       const Uint32 id= conf->tableId;
@@ -4643,8 +4639,8 @@ void Dbdict::execINCL_NODEREQ(Signal* si
 inline
 void Dbdict::printTables()
 {
-  DictObject_hash::Iterator iter;
-  bool moreTables = c_obj_hash.first(iter);
+  DictObjectName_hash::Iterator iter;
+  bool moreTables = c_obj_name_hash.first(iter);
   printf("OBJECTS IN DICT:\n");
   char name[PATH_MAX];
   while (moreTables) {
@@ -4652,7 +4648,7 @@ void Dbdict::printTables()
     ConstRope r(c_rope_pool, tablePtr.p->m_name);
     r.copy(name);
     printf("%s ", name);
-    moreTables = c_obj_hash.next(iter);
+    moreTables = c_obj_name_hash.next(iter);
   }
   printf("\n");
 }
@@ -4685,16 +4681,25 @@ Dbdict::get_object(DictObjectPtr& obj_pt
   key.m_key.m_name_len = len;
   key.m_key.m_pool = &c_rope_pool;
   key.m_name.m_hash = hash;
-  return c_obj_hash.find(obj_ptr, key);
+  return c_obj_name_hash.find(obj_ptr, key);
 }
 
 void
 Dbdict::release_object(Uint32 obj_ptr_i, DictObject* obj_ptr_p){
-  LocalRope name(c_rope_pool, obj_ptr_p->m_name);
+  jam();
+  RopeHandle obj_name = obj_ptr_p->m_name;
+  DictObjectPtr ptr = { obj_ptr_p, obj_ptr_i };
+
+  LocalRope name(c_rope_pool, obj_name);
   name.erase();
 
-  DictObjectPtr ptr = { obj_ptr_p, obj_ptr_i };
-  c_obj_hash.release(ptr);
+  c_obj_name_hash.remove(ptr);
+  if (!DictTabInfo::isTrigger(obj_ptr_p->m_type))
+  {
+    jam();
+    c_obj_id_hash.remove(ptr);
+  }
+  c_obj_pool.release(ptr);
 }
 
 void
@@ -4824,21 +4829,23 @@ void Dbdict::handleTabInfoInit(Signal *
 	       CreateTableRef::OutOfStringBuffer);
   }
 
-  DictObjectPtr obj_ptr;
   if (parseP->requestType != DictTabInfo::AlterTableFromAPI) {
     jam();
-    ndbrequire(c_obj_hash.seize(obj_ptr));
+
+    DictObjectPtr obj_ptr;
+    ndbrequire(c_obj_pool.seize(obj_ptr));
     new (obj_ptr.p) DictObject;
     obj_ptr.p->m_id = tablePtr.i;
     obj_ptr.p->m_type = c_tableDesc.TableType;
     obj_ptr.p->m_name = tablePtr.p->tableName;
     obj_ptr.p->m_ref_count = 0;
-    c_obj_hash.add(obj_ptr);
-    tablePtr.p->m_obj_ptr_i = obj_ptr.i;
+    ndbrequire(link_object(obj_ptr, tablePtr));
+    c_obj_id_hash.add(obj_ptr);
+    c_obj_name_hash.add(obj_ptr);
 
     if (g_trace)
     {
-      g_eventLogger->info("Dbdict: create name=%s,id=%u,obj_ptr_i=%d",
+      g_eventLogger->info("Dbdict: %u: create name=%s,id=%u,obj_ptr_i=%d",__LINE__,
                           c_tableDesc.TableName,
                           tablePtr.i, tablePtr.p->m_obj_ptr_i);
     }
@@ -4909,7 +4916,7 @@ void Dbdict::handleTabInfoInit(Signal *
     {
       jam();
       HashMapRecordPtr hm_ptr;
-      ndbrequire(c_hash_map_hash.find(hm_ptr, dictObj->m_id));
+      ndbrequire(find_object(hm_ptr, dictObj->m_id));
       tablePtr.p->hashMapObjectId = hm_ptr.p->m_object_id;
       tablePtr.p->hashMapVersion = hm_ptr.p->m_object_version;
     }
@@ -4919,7 +4926,7 @@ void Dbdict::handleTabInfoInit(Signal *
   {
     jam();
     HashMapRecordPtr hm_ptr;
-    tabRequire(c_hash_map_hash.find(hm_ptr, tablePtr.p->hashMapObjectId),
+    tabRequire(find_object(hm_ptr, tablePtr.p->hashMapObjectId),
                CreateTableRef::InvalidHashMap);
 
     tabRequire(hm_ptr.p->m_object_version ==  tablePtr.p->hashMapVersion,
@@ -5037,7 +5044,7 @@ void Dbdict::handleTabInfoInit(Signal *
      * Increase ref count
      */
     FilegroupPtr ptr;
-    ndbrequire(c_filegroup_hash.find(ptr, tablePtr.p->m_tablespace_id));
+    ndbrequire(find_object(ptr, tablePtr.p->m_tablespace_id));
     increase_ref_count(ptr.p->m_obj_ptr_i);
   }
 }//handleTabInfoInit()
@@ -5081,17 +5088,17 @@ Dbdict::upgrade_seizeTrigger(TableRecord
       }
 
       DictObjectPtr obj_ptr;
-      bool ok = c_obj_hash.seize(obj_ptr);
+      bool ok = c_obj_pool.seize(obj_ptr);
       ndbrequire(ok);
       new (obj_ptr.p) DictObject();
 
       obj_ptr.p->m_name = triggerPtr.p->triggerName;
-      c_obj_hash.add(obj_ptr);
       obj_ptr.p->m_ref_count = 0;
 
       triggerPtr.p->m_obj_ptr_i = obj_ptr.i;
       obj_ptr.p->m_id = triggerPtr.p->triggerId;
       obj_ptr.p->m_type =TriggerInfo::getTriggerType(triggerPtr.p->triggerInfo);
+      c_obj_name_hash.add(obj_ptr);
     }
   }
 
@@ -5119,17 +5126,17 @@ Dbdict::upgrade_seizeTrigger(TableRecord
       }
 
       DictObjectPtr obj_ptr;
-      bool ok = c_obj_hash.seize(obj_ptr);
+      bool ok = c_obj_pool.seize(obj_ptr);
       ndbrequire(ok);
       new (obj_ptr.p) DictObject();
 
       obj_ptr.p->m_name = triggerPtr.p->triggerName;
-      c_obj_hash.add(obj_ptr);
       obj_ptr.p->m_ref_count = 0;
 
       triggerPtr.p->m_obj_ptr_i = obj_ptr.i;
       obj_ptr.p->m_id = triggerPtr.p->triggerId;
       obj_ptr.p->m_type =TriggerInfo::getTriggerType(triggerPtr.p->triggerInfo);
+      c_obj_name_hash.add(obj_ptr);
     }
   }
 }
@@ -5421,7 +5428,7 @@ void Dbdict::handleTabInfo(SimplePropert
   if(tablePtr.p->m_tablespace_id != RNIL || counts[3] || counts[4])
   {
     FilegroupPtr tablespacePtr;
-    if(!c_filegroup_hash.find(tablespacePtr, tablePtr.p->m_tablespace_id))
+    if (!find_object(tablespacePtr, tablePtr.p->m_tablespace_id))
     {
       tabRequire(false, CreateTableRef::InvalidTablespace);
     }
@@ -5657,7 +5664,7 @@ Dbdict::create_fragmentation(Signal* sig
   {
     jam();
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, tabPtr.p->hashMapObjectId));
+    ndbrequire(find_object(hm_ptr, tabPtr.p->hashMapObjectId));
     frag_req->map_ptr_i = hm_ptr.p->m_map_ptr_i;
   }
   else
@@ -6388,7 +6395,7 @@ Dbdict::createTab_dih(Signal* signal, Sc
   if (tabPtr.p->hashMapObjectId != RNIL)
   {
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, tabPtr.p->hashMapObjectId));
+    ndbrequire(find_object(hm_ptr, tabPtr.p->hashMapObjectId));
     req->hashMapPtrI = hm_ptr.p->m_map_ptr_i;
   }
   else
@@ -6992,7 +6999,7 @@ Dbdict::createTable_abortPrepare(Signal*
 
   if (tabPtr.p->m_tablespace_id != RNIL) {
     FilegroupPtr ptr;
-    ndbrequire(c_filegroup_hash.find(ptr, tabPtr.p->m_tablespace_id));
+    ndbrequire(find_object(ptr, tabPtr.p->m_tablespace_id));
     decrease_ref_count(ptr.p->m_obj_ptr_i);
   }
 }
@@ -7069,11 +7076,13 @@ void Dbdict::releaseTableObject(Uint32 t
   if (removeFromHash)
   {
     jam();
+    ndbrequire(tablePtr.p->m_obj_ptr_i != RNIL);
     release_object(tablePtr.p->m_obj_ptr_i);
     tablePtr.p->m_obj_ptr_i = RNIL;
   }
   else
   {
+    ndbrequire(tablePtr.p->m_obj_ptr_i == RNIL);
     LocalRope tmp(c_rope_pool, tablePtr.p->tableName);
     tmp.erase();
   }
@@ -7245,7 +7254,7 @@ Dbdict::dropTable_parse(Signal* signal,
   Uint32 tableId = impl_req->tableId;
 
   TableRecordPtr tablePtr;
-  if (!(tableId < c_tableRecordPool.getSize())) {
+  if (!(tableId < c_noOfMetaTables)) {
     jam();
     setError(error, DropTableRef::NoSuchTable, __LINE__);
     return;
@@ -7422,7 +7431,7 @@ Dbdict::dropTable_commit(Signal* signal,
   if (tablePtr.p->m_tablespace_id != RNIL)
   {
     FilegroupPtr ptr;
-    ndbrequire(c_filegroup_hash.find(ptr, tablePtr.p->m_tablespace_id));
+    ndbrequire(find_object(ptr, tablePtr.p->m_tablespace_id));
     decrease_ref_count(ptr.p->m_obj_ptr_i);
   }
 
@@ -7934,7 +7943,7 @@ Dbdict::alterTable_parse(Signal* signal,
 
   // get table definition
   TableRecordPtr tablePtr;
-  if (!(impl_req->tableId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->tableId < c_noOfMetaTables)) {
     jam();
     setError(error, AlterTableRef::NoSuchTable, __LINE__);
     return;
@@ -8329,10 +8338,10 @@ Dbdict::check_supported_reorg(Uint32 org
   }
 
   HashMapRecordPtr orgmap_ptr;
-  ndbrequire(c_hash_map_hash.find(orgmap_ptr, org_map_id));
+  ndbrequire(find_object(orgmap_ptr, org_map_id));
 
   HashMapRecordPtr newmap_ptr;
-  ndbrequire(c_hash_map_hash.find(newmap_ptr, new_map_id));
+  ndbrequire(find_object(newmap_ptr, new_map_id));
 
   Ptr<Hash2FragmentMap> orgptr;
   g_hash_map.getPtr(orgptr, orgmap_ptr.p->m_map_ptr_i);
@@ -9072,7 +9081,7 @@ Dbdict::alterTable_toLocal(Signal* signa
     {
       jam();
       HashMapRecordPtr hm_ptr;
-      ndbrequire(c_hash_map_hash.find(hm_ptr,
+      ndbrequire(find_object(hm_ptr,
                                       alterTabPtr.p->m_newTablePtr.p->hashMapObjectId));
       req->new_map_ptr_i = hm_ptr.p->m_map_ptr_i;
     }
@@ -9177,7 +9186,7 @@ Dbdict::alterTable_commit(Signal* signal
       c_obj_pool.getPtr(obj_ptr, tablePtr.p->m_obj_ptr_i);
 
       // remove old name from hash
-      c_obj_hash.remove(obj_ptr);
+      c_obj_name_hash.remove(obj_ptr);
 
       // save old name and replace it by new
       bool ok =
@@ -9187,7 +9196,7 @@ Dbdict::alterTable_commit(Signal* signal
 
       // add new name to object hash
       obj_ptr.p->m_name = tablePtr.p->tableName;
-      c_obj_hash.add(obj_ptr);
+      c_obj_name_hash.add(obj_ptr);
     }
 
     if (AlterTableReq::getFrmFlag(changeMask))
@@ -10091,9 +10100,9 @@ void Dbdict::sendOLD_LIST_TABLES_CONF(Si
   conf->counter = 0;
   Uint32 pos = 0;
 
-  DictObject_hash::Iterator iter;
-  bool ok = c_obj_hash.first(iter);
-  for(; ok; ok = c_obj_hash.next(iter)){
+  DictObjectName_hash::Iterator iter;
+  bool ok = c_obj_name_hash.first(iter);
+  for (; ok; ok = c_obj_name_hash.next(iter)){
     Uint32 type = iter.curr.p->m_type;
     if ((reqTableType != (Uint32)0) && (reqTableType != type))
       continue;
@@ -10279,8 +10288,8 @@ void Dbdict::sendLIST_TABLES_CONF(Signal
   XSchemaFile * xsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
   NodeReceiverGroup rg(senderRef);
 
-  DictObject_hash::Iterator iter;
-  bool done = !c_obj_hash.first(iter);
+  DictObjectName_hash::Iterator iter;
+  bool done = !c_obj_name_hash.first(iter);
 
   if (done)
   {
@@ -10464,7 +10473,7 @@ flush:
     Uint32 tableDataWords = tableDataWriter.getWordsUsed();
     Uint32 tableNameWords = tableNamesWriter.getWordsUsed();
 
-    done = !c_obj_hash.next(iter);
+    done = !c_obj_name_hash.next(iter);
     if ((tableDataWords + tableNameWords) > fragSize || done)
     {
       jam();
@@ -10746,7 +10755,7 @@ Dbdict::createIndex_parse(Signal* signal
   // check primary table
   TableRecordPtr tablePtr;
   {
-    if (!(impl_req->tableId < c_tableRecordPool.getSize())) {
+    if (!(impl_req->tableId < c_noOfMetaTables)) {
       jam();
       setError(error, CreateIndxRef::InvalidPrimaryTable, __LINE__);
       return;
@@ -10898,7 +10907,7 @@ Dbdict::createIndex_parse(Signal* signal
   if (master)
   {
     jam();
-    impl_req->indexId = getFreeObjId(0);
+    impl_req->indexId = getFreeObjId();
   }
 
   if (impl_req->indexId == RNIL)
@@ -10908,7 +10917,7 @@ Dbdict::createIndex_parse(Signal* signal
     return;
   }
 
-  if (impl_req->indexId >= c_tableRecordPool.getSize())
+  if (impl_req->indexId >= c_noOfMetaTables)
   {
     jam();
     setError(error, CreateTableRef::NoMoreTableRecords, __LINE__);
@@ -11446,7 +11455,7 @@ Dbdict::dropIndex_parse(Signal* signal,
   DropIndxImplReq* impl_req = &dropIndexPtr.p->m_request;
 
   TableRecordPtr indexPtr;
-  if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->indexId < c_noOfMetaTables)) {
     jam();
     setError(error, DropIndxRef::IndexNotFound, __LINE__);
     return;
@@ -11928,7 +11937,7 @@ Dbdict::alterIndex_parse(Signal* signal,
   AlterIndxImplReq* impl_req = &alterIndexPtr.p->m_request;
 
   TableRecordPtr indexPtr;
-  if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->indexId < c_noOfMetaTables)) {
     jam();
     setError(error, AlterIndxRef::IndexNotFound, __LINE__);
     return;
@@ -12849,7 +12858,7 @@ Dbdict::alterIndex_abortParse(Signal* si
   D("alterIndex_abortParse" << *op_ptr.p);
 
   do {
-    if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
+    if (!(impl_req->indexId < c_noOfMetaTables)) {
       jam();
       D("invalid index id" << V(indexId));
       break;
@@ -13104,7 +13113,7 @@ Dbdict::buildIndex_parse(Signal* signal,
 
   // get index
   TableRecordPtr indexPtr;
-  if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->indexId < c_noOfMetaTables)) {
     jam();
     setError(error, BuildIndxRef::IndexNotFound, __LINE__);
     return;
@@ -13115,7 +13124,7 @@ Dbdict::buildIndex_parse(Signal* signal,
 
   // get primary table
   TableRecordPtr tablePtr;
-  if (!(impl_req->tableId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->tableId < c_noOfMetaTables)) {
     jam();
     setError(error, BuildIndxRef::IndexNotFound, __LINE__);
     return;
@@ -13877,7 +13886,7 @@ Dbdict::indexStat_parse(Signal* signal,
 
   // get index
   TableRecordPtr indexPtr;
-  if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
+  if (!(impl_req->indexId < c_noOfMetaTables)) {
     jam();
     setError(error, IndexStatRef::InvalidIndex, __LINE__);
     return;
@@ -14333,7 +14342,7 @@ Dbdict::execINDEX_STAT_REP(Signal* signa
 
   // check
   TableRecordPtr indexPtr;
-  if (rep->indexId >= c_tableRecordPool.getSize()) {
+  if (rep->indexId >= c_noOfMetaTables) {
     jam();
     return;
   }
@@ -14381,7 +14390,7 @@ Dbdict::indexStatBg_process(Signal* sign
   uint loop;
   for (loop = 0; loop < maxloop; loop++, c_indexStatBgId++) {
     jam();
-    c_indexStatBgId %= c_tableRecordPool.getSize();
+    c_indexStatBgId %= c_noOfMetaTables;
 
     // check
     TableRecordPtr indexPtr;
@@ -17648,7 +17657,7 @@ Dbdict::createTrigger_parse(Signal* sign
   // check the table
   {
     const Uint32 tableId = impl_req->tableId;
-    if (! (tableId < c_tableRecordPool.getSize()))
+    if (! (tableId < c_noOfMetaTables))
     {
       jam();
       setError(error, CreateTrigRef::InvalidTable, __LINE__);
@@ -20669,7 +20678,7 @@ Dbdict::createFile_parse(Signal* signal,
 
   // Get Filegroup
   FilegroupPtr fg_ptr;
-  if(!c_filegroup_hash.find(fg_ptr, f.FilegroupId))
+  if (!find_object(fg_ptr, f.FilegroupId))
   {
     jam();
     setError(error, CreateFileRef::NoSuchFilegroup, __LINE__, f.FileName);
@@ -20773,7 +20782,7 @@ Dbdict::createFile_parse(Signal* signal,
   {
     jam();
 
-    Uint32 objId = getFreeObjId(0);
+    Uint32 objId = getFreeObjId();
     if (objId == RNIL)
     {
       jam();
@@ -20853,6 +20862,8 @@ Dbdict::createFile_parse(Signal* signal,
   obj_ptr.p->m_type = f.FileType;
   obj_ptr.p->m_ref_count = 0;
 
+  ndbrequire(link_object(obj_ptr, filePtr));
+
   {
     SchemaFile::TableEntry te; te.init();
     te.m_tableState = SchemaFile::SF_CREATE;
@@ -20871,8 +20882,8 @@ Dbdict::createFile_parse(Signal* signal,
     }
   }
 
-  c_obj_hash.add(obj_ptr);
-  c_file_hash.add(filePtr);
+  c_obj_name_hash.add(obj_ptr);
+  c_obj_id_hash.add(obj_ptr);
 
   // save sections to DICT memory
   saveOpSection(op_ptr, handle, 0);
@@ -20900,8 +20911,8 @@ Dbdict::createFile_parse(Signal* signal,
 
   if (g_trace)
   {
-    g_eventLogger->info("Dbdict: create name=%s,id=%u,obj_ptr_i=%d,"
-                        "type=%s,bytes=%llu,warn=0x%x",
+    g_eventLogger->info("Dbdict: %u: create name=%s,id=%u,obj_ptr_i=%d,"
+                        "type=%s,bytes=%llu,warn=0x%x",__LINE__,
                         f.FileName,
                         impl_req->file_id,
                         filePtr.p->m_obj_ptr_i,
@@ -20944,8 +20955,8 @@ Dbdict::createFile_abortParse(Signal* si
   {
     FilePtr f_ptr;
     FilegroupPtr fg_ptr;
-    ndbrequire(c_file_hash.find(f_ptr, impl_req->file_id));
-    ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+    ndbrequire(find_object(f_ptr, impl_req->file_id));
+    ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
     if (f_ptr.p->m_type == DictTabInfo::Datafile)
     {
       jam();
@@ -20959,7 +20970,7 @@ Dbdict::createFile_abortParse(Signal* si
     }
 
     release_object(f_ptr.p->m_obj_ptr_i);
-    c_file_hash.release(f_ptr);
+    c_file_pool.release(f_ptr);
   }
 
   sendTransConf(signal, op_ptr);
@@ -21062,8 +21073,8 @@ Dbdict::createFile_fromWriteObjInfo(Sign
   FilePtr f_ptr;
   FilegroupPtr fg_ptr;
 
-  ndbrequire(c_file_hash.find(f_ptr, impl_req->file_id));
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+  ndbrequire(find_object(f_ptr, impl_req->file_id));
+  ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op_ptr.p->op_key;
   req->senderRef = reference();
@@ -21122,8 +21133,8 @@ Dbdict::createFile_abortPrepare(Signal*
   getOpRec(op_ptr, createFileRecPtr);
   CreateFileImplReq* impl_req = &createFileRecPtr.p->m_request;
 
-  ndbrequire(c_file_hash.find(f_ptr, impl_req->file_id));
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+  ndbrequire(find_object(f_ptr, impl_req->file_id));
+  ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op_ptr.p->op_key;
   req->senderRef = reference();
@@ -21178,8 +21189,8 @@ Dbdict::createFile_commit(Signal* signal
   FilegroupPtr fg_ptr;
 
   jam();
-  ndbrequire(c_file_hash.find(f_ptr, impl_req->file_id));
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+  ndbrequire(find_object(f_ptr, impl_req->file_id));
+  ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op_ptr.p->op_key;
   req->senderRef = reference();
@@ -21467,7 +21478,7 @@ Dbdict::createFilegroup_parse(Signal* si
     fg_ptr.p->m_tablespace.m_default_logfile_group_id = fg.TS_LogfileGroupId;
 
     FilegroupPtr lg_ptr;
-    if (!c_filegroup_hash.find(lg_ptr, fg.TS_LogfileGroupId))
+    if (!find_object(lg_ptr, fg.TS_LogfileGroupId))
     {
       jam();
       setError(error, CreateFilegroupRef::NoSuchLogfileGroup, __LINE__);
@@ -21512,7 +21523,7 @@ Dbdict::createFilegroup_parse(Signal* si
   {
     jam();
 
-    Uint32 objId = getFreeObjId(0);
+    Uint32 objId = getFreeObjId();
     if (objId == RNIL)
     {
       jam();
@@ -21532,7 +21543,6 @@ Dbdict::createFilegroup_parse(Signal* si
   }
 
   fg_ptr.p->key = impl_req->filegroup_id;
-  fg_ptr.p->m_obj_ptr_i = obj_ptr.i;
   fg_ptr.p->m_type = fg.FilegroupType;
   fg_ptr.p->m_version = impl_req->filegroup_version;
   fg_ptr.p->m_name = obj_ptr.p->m_name;
@@ -21541,6 +21551,8 @@ Dbdict::createFilegroup_parse(Signal* si
   obj_ptr.p->m_type = fg.FilegroupType;
   obj_ptr.p->m_ref_count = 0;
 
+  ndbrequire(link_object(obj_ptr, fg_ptr));
+
   if (master)
   {
     jam();
@@ -21570,8 +21582,8 @@ Dbdict::createFilegroup_parse(Signal* si
     }
   }
 
-  c_obj_hash.add(obj_ptr);
-  c_filegroup_hash.add(fg_ptr);
+  c_obj_name_hash.add(obj_ptr);
+  c_obj_id_hash.add(obj_ptr);
 
   // save sections to DICT memory
   saveOpSection(op_ptr, handle, 0);
@@ -21584,7 +21596,7 @@ Dbdict::createFilegroup_parse(Signal* si
   createFilegroupPtr.p->m_parsed = true;
 
 #if defined VM_TRACE || defined ERROR_INSERT
-  ndbout_c("Dbdict: create name=%s,id=%u,obj_ptr_i=%d",
+  ndbout_c("Dbdict: %u: create name=%s,id=%u,obj_ptr_i=%d",__LINE__,
            fg.FilegroupName, impl_req->filegroup_id, fg_ptr.p->m_obj_ptr_i);
 #endif
 
@@ -21617,19 +21629,19 @@ Dbdict::createFilegroup_abortParse(Signa
     CreateFilegroupImplReq* impl_req = &createFilegroupPtr.p->m_request;
 
     FilegroupPtr fg_ptr;
-    ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+    ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
     if (fg_ptr.p->m_type == DictTabInfo::Tablespace)
     {
       jam();
       FilegroupPtr lg_ptr;
-      ndbrequire(c_filegroup_hash.find
+      ndbrequire(find_object
                  (lg_ptr, fg_ptr.p->m_tablespace.m_default_logfile_group_id));
       decrease_ref_count(lg_ptr.p->m_obj_ptr_i);
     }
 
     release_object(fg_ptr.p->m_obj_ptr_i);
-    c_filegroup_hash.release(fg_ptr);
+    c_filegroup_pool.release(fg_ptr);
   }
 
   sendTransConf(signal, op_ptr);
@@ -21740,7 +21752,8 @@ Dbdict::createFilegroup_fromWriteObjInfo
   req->filegroup_version = impl_req->filegroup_version;
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+
+  ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
   Uint32 ref= 0;
   Uint32 len= 0;
@@ -21956,7 +21969,7 @@ Dbdict::dropFile_parse(Signal* signal, b
   DropFileImplReq* impl_req = &dropFileRecPtr.p->m_request;
 
   FilePtr f_ptr;
-  if (!c_file_hash.find(f_ptr, impl_req->file_id))
+  if (!find_object(f_ptr, impl_req->file_id))
   {
     jam();
     setError(error, DropFileRef::NoSuchFile, __LINE__);
@@ -22131,11 +22144,11 @@ Dbdict::dropFile_complete(Signal* signal
   FilegroupPtr fg_ptr;
 
   jam();
-  ndbrequire(c_file_hash.find(f_ptr, impl_req->file_id));
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+  ndbrequire(find_object(f_ptr, impl_req->file_id));
+  ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
   decrease_ref_count(fg_ptr.p->m_obj_ptr_i);
   release_object(f_ptr.p->m_obj_ptr_i);
-  c_file_hash.release(f_ptr);
+  c_file_pool.release(f_ptr);
 
   sendTransConf(signal, op_ptr);
 }
@@ -22186,8 +22199,8 @@ Dbdict::send_drop_file(Signal* signal, U
   FilegroupPtr fg_ptr;
 
   jam();
-  ndbrequire(c_file_hash.find(f_ptr, fileId));
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
+  ndbrequire(find_object(f_ptr, fileId));
+  ndbrequire(find_object(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op_key;
   req->senderRef = reference();
@@ -22314,7 +22327,7 @@ Dbdict::dropFilegroup_parse(Signal* sign
   DropFilegroupImplReq* impl_req = &dropFilegroupRecPtr.p->m_request;
 
   FilegroupPtr fg_ptr;
-  if (!c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id))
+  if (!find_object(fg_ptr, impl_req->filegroup_id))
   {
     jam();
     setError(error, DropFilegroupRef::NoSuchFilegroup, __LINE__);
@@ -22437,7 +22450,7 @@ Dbdict::dropFilegroup_prepare(Signal* si
                DropFilegroupImplReq::Prepare);
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+  ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
   if (fg_ptr.p->m_type == DictTabInfo::LogfileGroup)
   {
@@ -22475,7 +22488,7 @@ Dbdict::dropFilegroup_abortPrepare(Signa
                DropFilegroupImplReq::Abort);
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+  ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
   if (fg_ptr.p->m_type == DictTabInfo::LogfileGroup)
   {
@@ -22516,7 +22529,7 @@ Dbdict::dropFilegroup_commit(Signal* sig
                DropFilegroupImplReq::Commit);
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+  ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
   if (fg_ptr.p->m_type == DictTabInfo::LogfileGroup)
   {
@@ -22539,7 +22552,6 @@ Dbdict::dropFilegroup_commit(Signal* sig
       entry->m_transId = 0;
 
       release_object(objPtr.i, objPtr.p);
-      c_file_hash.remove(filePtr);
     }
     list.release();
   }
@@ -22547,8 +22559,7 @@ Dbdict::dropFilegroup_commit(Signal* sig
   {
     jam();
     FilegroupPtr lg_ptr;
-    ndbrequire(c_filegroup_hash.
-	       find(lg_ptr,
+    ndbrequire(find_object(lg_ptr,
 		    fg_ptr.p->m_tablespace.m_default_logfile_group_id));
 
     decrease_ref_count(lg_ptr.p->m_obj_ptr_i);
@@ -22568,10 +22579,10 @@ Dbdict::dropFilegroup_complete(Signal* s
   DropFilegroupImplReq* impl_req = &dropFilegroupRecPtr.p->m_request;
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, impl_req->filegroup_id));
+  ndbrequire(find_object(fg_ptr, impl_req->filegroup_id));
 
   release_object(fg_ptr.p->m_obj_ptr_i);
-  c_filegroup_hash.release(fg_ptr);
+  c_filegroup_pool.release(fg_ptr);
 
   sendTransConf(signal, op_ptr);
 }
@@ -22621,7 +22632,7 @@ Dbdict::send_drop_fg(Signal* signal, Uin
   DropFilegroupImplReq* req = (DropFilegroupImplReq*)signal->getDataPtrSend();
 
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, filegroupId));
+  ndbrequire(find_object(fg_ptr, filegroupId));
 
   req->senderData = op_key;
   req->senderRef = reference();
@@ -24318,12 +24329,12 @@ Dbdict::seizeDictObject(SchemaOpPtr op_p
 {
   D("seizeDictObject" << *op_ptr.p);
 
-  bool ok = c_obj_hash.seize(obj_ptr);
+  bool ok = c_obj_pool.seize(obj_ptr);
   ndbrequire(ok);
   new (obj_ptr.p) DictObject();
 
   obj_ptr.p->m_name = name;
-  c_obj_hash.add(obj_ptr);
+  c_obj_name_hash.add(obj_ptr);
   obj_ptr.p->m_ref_count = 0;
 
   linkDictObject(op_ptr, obj_ptr);
@@ -24576,7 +24587,7 @@ Dbdict::execSCHEMA_TRANS_BEGIN_REQ(Signa
     trans_ptr.p->m_clientRef = clientRef;
     trans_ptr.p->m_transId = transId;
     trans_ptr.p->m_requestInfo = requestInfo;
-    trans_ptr.p->m_obj_id = getFreeObjId(0);
+    trans_ptr.p->m_obj_id = getFreeObjId();
     if (localTrans)
     {
       /**
@@ -24586,7 +24597,7 @@ Dbdict::execSCHEMA_TRANS_BEGIN_REQ(Signa
        *   schema file so that we don't accidently allocate
        *   an objectId that should be used to recreate an object
        */
-      trans_ptr.p->m_obj_id = getFreeObjId(0, true);
+      trans_ptr.p->m_obj_id = getFreeObjId(true);
     }
 
     if (!localTrans)
@@ -26895,7 +26906,7 @@ Dbdict::execSCHEMA_TRANS_IMPL_REQ(Signal
     if (signal->getLength() < SchemaTransImplReq::SignalLengthStart)
     {
       jam();
-      reqCopy.start.objectId = getFreeObjId(0);
+      reqCopy.start.objectId = getFreeObjId();
     }
     slave_run_start(signal, req);
     return;
@@ -27044,9 +27055,9 @@ Dbdict::slave_run_start(Signal *signal,
   SchemaTransPtr trans_ptr;
   const Uint32 trans_key = req->transKey;
 
-  Uint32 objId = getFreeObjId(req->start.objectId);
-  if (objId != req->start.objectId)
-  {
+  Uint32 objId = req->start.objectId;
+  if (check_read_obj(objId,0) == 0)
+  { /* schema file id already in use */
     jam();
     setError(error, CreateTableRef::NoMoreTableRecords, __LINE__);
     goto err;
@@ -28442,7 +28453,7 @@ Dbdict::createHashMap_parse(Signal* sign
     }
 
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, objptr->m_id));
+    ndbrequire(find_object(hm_ptr, objptr->m_id));
 
     impl_req->objectId = objptr->m_id;
     impl_req->objectVersion = hm_ptr.p->m_object_version;
@@ -28496,7 +28507,7 @@ Dbdict::createHashMap_parse(Signal* sign
       goto error;
     }
 
-    objId = impl_req->objectId = getFreeObjId(0);
+    objId = impl_req->objectId = getFreeObjId();
     if (objId == RNIL)
     {
       jam();
@@ -28538,7 +28549,8 @@ Dbdict::createHashMap_parse(Signal* sign
   obj_ptr.p->m_type = DictTabInfo::HashMap;
   obj_ptr.p->m_ref_count = 0;
   obj_ptr.p->m_name = name;
-  c_obj_hash.add(obj_ptr);
+  c_obj_name_hash.add(obj_ptr);
+  c_obj_id_hash.add(obj_ptr);
 
   if (ERROR_INSERTED(6209))
   {
@@ -28577,9 +28589,8 @@ Dbdict::createHashMap_parse(Signal* sign
   hm_ptr.p->m_object_id = objId;
   hm_ptr.p->m_object_version = objVersion;
   hm_ptr.p->m_name = name;
-  hm_ptr.p->m_obj_ptr_i = obj_ptr.i;
   hm_ptr.p->m_map_ptr_i = map_ptr.i;
-  c_hash_map_hash.add(hm_ptr);
+  link_object(obj_ptr, hm_ptr);
 
   /**
    * pack is stupid...and requires bytes!
@@ -28627,7 +28638,7 @@ Dbdict::createHashMap_parse(Signal* sign
   handle.m_cnt = 1;
 
 #if defined VM_TRACE || defined ERROR_INSERT
-  ndbout_c("Dbdict: create name=%s,id=%u,obj_ptr_i=%d",
+  ndbout_c("Dbdict: %u: create name=%s,id=%u,obj_ptr_i=%d",__LINE__,
            hm.HashMapName, objId, hm_ptr.p->m_obj_ptr_i);
 #endif
 
@@ -28639,7 +28650,7 @@ error:
   if (!hm_ptr.isNull())
   {
     jam();
-    c_hash_map_hash.release(hm_ptr);
+    c_hash_map_pool.release(hm_ptr);
   }
 
   if (!map_ptr.isNull())
@@ -28681,11 +28692,11 @@ Dbdict::createHashMap_abortParse(Signal*
     jam();
 
     HashMapRecordPtr hm_ptr;
-    ndbrequire(c_hash_map_hash.find(hm_ptr, impl_req->objectId));
+    ndbrequire(find_object(hm_ptr, impl_req->objectId));
 
     release_object(hm_ptr.p->m_obj_ptr_i);
     g_hash_map.release(hm_ptr.p->m_map_ptr_i);
-    c_hash_map_hash.release(hm_ptr);
+    c_hash_map_pool.release(hm_ptr);
   }
 
   // wl3600_todo probably nothing..
@@ -28990,7 +29001,7 @@ Dbdict::check_consistency()
   // schema file entries // mis-named "tables"
   TableRecordPtr tablePtr;
   for (tablePtr.i = 0;
-      tablePtr.i < c_tableRecordPool.getSize();
+      tablePtr.i < c_noOfMetaTables;
       tablePtr.i++) {
     if (check_read_obj(tablePtr.i,
 

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2011-11-03 08:40:19 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2011-11-11 07:49:30 +0000
@@ -167,6 +167,7 @@ struct sysTab_NDBEVENTS_0 {
  */
 class Dbdict: public SimulatedBlock {
 public:
+
   /*
    *   2.3 RECORD AND FILESIZES
    */
@@ -229,7 +230,7 @@ public:
   };
   typedef Ptr<AttributeRecord> AttributeRecordPtr;
   typedef ArrayPool<AttributeRecord> AttributeRecord_pool;
-  typedef DLHashTable<AttributeRecord,AttributeRecord,AttributeRecord_pool> AttributeRecord_hash;
+  typedef DLMHashTable<AttributeRecord_pool, AttributeRecord> AttributeRecord_hash;
   typedef DLFifoList<AttributeRecord,AttributeRecord,AttributeRecord_pool> AttributeRecord_list;
   typedef LocalDLFifoList<AttributeRecord,AttributeRecord,AttributeRecord_pool> LocalAttributeRecord_list;
 
@@ -249,6 +250,8 @@ public:
 
   struct TableRecord {
     TableRecord(){ m_upgrade_trigger_handling.m_upgrade = false;}
+    static bool isCompatible(Uint32 type) { return DictTabInfo::isTable(type) || DictTabInfo::isIndex(type); }
+
     Uint32 maxRowsLow;
     Uint32 maxRowsHigh;
     Uint32 minRowsLow;
@@ -436,6 +439,7 @@ public:
 
   TableRecord_pool c_tableRecordPool;
   RSS_AP_SNAPSHOT(c_tableRecordPool);
+  TableRecord_pool& get_pool(TableRecordPtr) { return c_tableRecordPool; }
 
   /**  Node Group and Tablespace id+version + range or list data.
     *  This is only stored temporarily in DBDICT during an ongoing
@@ -604,6 +608,7 @@ public:
 
   struct File {
     File() {}
+    static bool isCompatible(Uint32 type) { return DictTabInfo::isFile(type); }
 
     Uint32 key;
     Uint32 m_magic;
@@ -620,19 +625,15 @@ public:
       Uint32 prevList;
       Uint32 nextPool;
     };
-    Uint32 nextHash, prevHash;
-
-    Uint32 hashValue() const { return key;}
-    bool equal(const File& obj) const { return key == obj.key;}
   };
   typedef Ptr<File> FilePtr;
   typedef RecordPool<File, RWPool> File_pool;
   typedef DLListImpl<File_pool, File> File_list;
   typedef LocalDLListImpl<File_pool, File> Local_file_list;
-  typedef KeyTableImpl<File_pool, File> File_hash;
 
   struct Filegroup {
     Filegroup(){}
+    static bool isCompatible(Uint32 type) { return DictTabInfo::isFilegroup(type); }
 
     Uint32 key;
     Uint32 m_obj_ptr_i;
@@ -657,25 +658,34 @@ public:
     union {
       Uint32 nextPool;
       Uint32 nextList;
-      Uint32 nextHash;
     };
-    Uint32 prevHash;
-
-    Uint32 hashValue() const { return key;}
-    bool equal(const Filegroup& obj) const { return key == obj.key;}
   };
   typedef Ptr<Filegroup> FilegroupPtr;
   typedef RecordPool<Filegroup, RWPool> Filegroup_pool;
-  typedef KeyTableImpl<Filegroup_pool, Filegroup> Filegroup_hash;
 
   File_pool c_file_pool;
   Filegroup_pool c_filegroup_pool;
-  File_hash c_file_hash;
-  Filegroup_hash c_filegroup_hash;
+
+  File_pool& get_pool(FilePtr) { return c_file_pool; }
+  Filegroup_pool& get_pool(FilegroupPtr) { return c_filegroup_pool; }
 
   RopePool c_rope_pool;
   RSS_AP_SNAPSHOT(c_rope_pool);
 
+  template <typename T, typename U = T> struct HashedById {
+    static Uint32& nextHash(U& t) { return t.nextHash_by_id; }
+    static Uint32& prevHash(U& t) { return t.prevHash_by_id; }
+    static Uint32 hashValue(T const& t) { return t.hashValue_by_id(); }
+    static bool equal(T const& lhs, T const& rhs) { return lhs.equal_by_id(rhs); }
+  };
+
+  template <typename T, typename U = T> struct HashedByName {
+    static Uint32& nextHash(U& t) { return t.nextHash_by_name; }
+    static Uint32& prevHash(U& t) { return t.prevHash_by_name; }
+    static Uint32 hashValue(T const& t) { return t.hashValue_by_name(); }
+    static bool equal(T const& lhs, T const& rhs) { return lhs.equal_by_name(rhs); }
+  };
+
   struct DictObject {
     DictObject() {
       m_trans_key = 0;
@@ -683,6 +693,7 @@ public:
     };
     Uint32 m_id;
     Uint32 m_type;
+    Uint32 m_object_ptr_i;
     Uint32 m_ref_count;
     RopeHandle m_name;
     union {
@@ -694,21 +705,34 @@ public:
       Uint32 nextPool;
       Uint32 nextList;
     };
-    Uint32 nextHash;
-    Uint32 prevHash;
 
-    Uint32 hashValue() const { return m_name.hashValue();}
-    bool equal(const DictObject& obj) const {
-      if(obj.hashValue() == hashValue()){
+    // SchemaOp -> DictObject -> SchemaTrans
+    Uint32 m_trans_key;
+    Uint32 m_op_ref_count;
+
+    // HashedById
+    Uint32 nextHash_by_id;
+    Uint32 prevHash_by_id;
+    Uint32 hashValue_by_id() const { return m_id; }
+    bool equal_by_id(DictObject const& obj) const {
+      bool isTrigger = DictTabInfo::isTrigger(m_type);
+      bool objIsTrigger = DictTabInfo::isTrigger(obj.m_type);
+      return (isTrigger == objIsTrigger) &&
+             (obj.m_id == m_id);
+    }
+
+    // HashedByName
+    Uint32 nextHash_by_name;
+    Uint32 prevHash_by_name;
+    Uint32 hashValue_by_name() const { return m_name.hashValue(); }
+    bool equal_by_name(DictObject const& obj) const {
+      if(obj.hashValue_by_name() == hashValue_by_name()){
 	ConstRope r(* m_key.m_pool, obj.m_name);
 	return r.compare(m_key.m_name_ptr, m_key.m_name_len) == 0;
       }
       return false;
     }
 
-    // SchemaOp -> DictObject -> SchemaTrans
-    Uint32 m_trans_key;
-    Uint32 m_op_ref_count;
 #ifdef VM_TRACE
     void print(NdbOut&) const;
 #endif
@@ -716,13 +740,57 @@ public:
 
   typedef Ptr<DictObject> DictObjectPtr;
   typedef ArrayPool<DictObject> DictObject_pool;
-  typedef DLHashTable<DictObject,DictObject,DictObject_pool> DictObject_hash;
+  typedef DLMHashTable<DictObject_pool, DictObject, HashedByName<DictObject> > DictObjectName_hash;
+  typedef DLMHashTable<DictObject_pool, DictObject, HashedById<DictObject> > DictObjectId_hash;
   typedef SLList<DictObject> DictObject_list;
 
-  DictObject_hash c_obj_hash; // Name
+  DictObjectName_hash c_obj_name_hash; // Name (not temporary TableRecords)
+  DictObjectId_hash c_obj_id_hash; // Schema file id / Trigger id
   DictObject_pool c_obj_pool;
   RSS_AP_SNAPSHOT(c_obj_pool);
 
+  template<typename T> bool find_object(DictObjectPtr& obj, Ptr<T>& object, Uint32 id)
+  {
+    if (!find_object(obj, id))
+    {
+      object.setNull();
+      return false;
+    }
+    if (!T::isCompatible(obj.p->m_type))
+    {
+      object.setNull();
+      return false;
+    }
+    get_pool(object).getPtr(object, obj.p->m_object_ptr_i);
+    return !object.isNull();
+  }
+
+  template<typename T> bool find_object(Ptr<T>& object, Uint32 id)
+  {
+    DictObjectPtr obj;
+    return find_object(obj, object, id);
+  }
+
+  bool find_object(DictObjectPtr& object, Uint32 id)
+  {
+    DictObject key;
+    key.m_id = id;
+    key.m_type = 0; // Not a trigger atleast
+    bool ok = c_obj_id_hash.find(object, key);
+    return ok;
+  }
+
+  template<typename T> bool link_object(DictObjectPtr obj, Ptr<T> object)
+  {
+    if (!T::isCompatible(obj.p->m_type))
+    {
+      return false;
+    }
+    obj.p->m_object_ptr_i = object.i;
+    object.p->m_obj_ptr_i = obj.i;
+    return true;
+  }
+
   // 1
   DictObject * get_object(const char * name){
     return get_object(name, Uint32(strlen(name) + 1));
@@ -1612,7 +1680,7 @@ private:
   };
 
   typedef RecordPool<SchemaOp,ArenaPool> SchemaOp_pool;
-  typedef DLHashTable<SchemaOp,SchemaOp,SchemaOp_pool> SchemaOp_hash;
+  typedef DLMHashTable<SchemaOp_pool, SchemaOp> SchemaOp_hash;
   typedef DLFifoList<SchemaOp,SchemaOp,SchemaOp_pool>::Head  SchemaOp_head;
   typedef LocalDLFifoList<SchemaOp,SchemaOp,SchemaOp_pool> LocalSchemaOp_list;
 
@@ -1857,7 +1925,7 @@ private:
       assert(false);
       return -1;
     }
-    // DLHashTable
+    // DLMHashTable
     Uint32 trans_key;
     Uint32 nextHash;
     Uint32 prevHash;
@@ -1975,7 +2043,7 @@ private:
   Uint32 check_write_obj(Uint32, Uint32, SchemaFile::EntryState, ErrorInfo&);
 
   typedef RecordPool<SchemaTrans,ArenaPool> SchemaTrans_pool;
-  typedef DLHashTable<SchemaTrans,SchemaTrans,SchemaTrans_pool> SchemaTrans_hash;
+  typedef DLMHashTable<SchemaTrans_pool, SchemaTrans> SchemaTrans_hash;
   typedef DLFifoList<SchemaTrans,SchemaTrans,SchemaTrans_pool> SchemaTrans_list;
 
   SchemaTrans_pool c_schemaTransPool;
@@ -2194,7 +2262,7 @@ private:
     // ArrayPool
     Uint32 nextPool;
 
-    // DLHashTable
+    // DLMHashTable
     Uint32 tx_key;
     Uint32 nextHash;
     Uint32 prevHash;
@@ -2246,7 +2314,7 @@ private:
   };
 
   typedef ArrayPool<TxHandle> TxHandle_pool;
-  typedef DLHashTable<TxHandle,TxHandle,TxHandle_pool> TxHandle_hash;
+  typedef DLMHashTable<TxHandle_pool, TxHandle> TxHandle_hash;
 
   TxHandle_pool c_txHandlePool;
   TxHandle_hash c_txHandleHash;
@@ -2929,6 +2997,7 @@ private:
 
   struct HashMapRecord {
     HashMapRecord(){}
+    static bool isCompatible(Uint32 type) { return DictTabInfo::isHashMap(type); }
 
     /* Table id (array index in DICT and other blocks) */
     union {
@@ -2944,24 +3013,15 @@ private:
      * ptr.i, in g_hash_map
      */
     Uint32 m_map_ptr_i;
-    union {
-      Uint32 nextPool;
-      Uint32 nextHash;
-    };
-    Uint32 prevHash;
-
-    Uint32 hashValue() const { return key;}
-    bool equal(const HashMapRecord& obj) const { return key == obj.key;}
-
+    Uint32 nextPool;
   };
   typedef Ptr<HashMapRecord> HashMapRecordPtr;
   typedef ArrayPool<HashMapRecord> HashMapRecord_pool;
-  typedef KeyTableImpl<HashMapRecord_pool, HashMapRecord> HashMapRecord_hash;
 
   HashMapRecord_pool c_hash_map_pool;
-  HashMapRecord_hash c_hash_map_hash;
   RSS_AP_SNAPSHOT(c_hash_map_pool);
   RSS_AP_SNAPSHOT(g_hash_map);
+  HashMapRecord_pool& get_pool(HashMapRecordPtr) { return c_hash_map_pool; }
 
   struct CreateHashMapRec;
   typedef RecordPool<CreateHashMapRec,ArenaPool> CreateHashMapRec_pool;
@@ -3673,7 +3733,7 @@ private:
   /* ------------------------------------------------------------ */
   // General Stuff
   /* ------------------------------------------------------------ */
-  Uint32 getFreeObjId(Uint32 minId, bool both = false);
+  Uint32 getFreeObjId(bool both = false);
   Uint32 getFreeTableRecord();
   Uint32 getFreeTriggerRecord();
   bool getNewAttributeRecord(TableRecordPtr tablePtr,
@@ -4037,6 +4097,7 @@ protected:
   virtual bool getParam(const char * param, Uint32 * retVal);
 private:
   ArenaAllocator c_arenaAllocator;
+  Uint32 c_noOfMetaTables;
 };
 
 inline bool

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-10-13 09:02:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-11-11 08:42:31 +0000
@@ -173,8 +173,8 @@ Dbtux::execTUX_BOUND_INFO(Signal* signal
   c_scanOpPool.getPtr(scanPtr);
   ScanOp& scan = *scanPtr.p;
   const Index& index = *c_indexPool.getPtr(scan.m_indexId);
-  const DescHead& descHead = getDescHead(index);
-  const KeyType* keyTypes = getKeyTypes(descHead);
+  // compiler warning unused: const DescHead& descHead = getDescHead(index);
+  // compiler warning unused: const KeyType* keyTypes = getKeyTypes(descHead);
   // data passed in Signal
   const Uint32* const boundData = &req->data[0];
   Uint32 boundLen = req->boundAiLength;

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp	2011-07-04 16:30:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp	2011-11-11 08:57:51 +0000
@@ -123,7 +123,7 @@ Dbtux::getEntriesBeforeOrAfter(Frag& fra
   Uint16 path[MaxTreeDepth + 1];
   unsigned depth = getPathToNode(node, path);
   ndbrequire(depth != 0 && depth <= MaxTreeDepth);
-  TreeHead& tree = frag.m_tree;
+  // compiler warning unused: TreeHead& tree = frag.m_tree;
   Uint32 cnt = 0;
   Uint32 tot = (Uint32)frag.m_entryCount;
   unsigned i = 0;

=== modified file 'storage/ndb/src/kernel/vm/DLFifoList.hpp'
--- a/storage/ndb/src/kernel/vm/DLFifoList.hpp	2011-10-07 11:46:40 +0000
+++ b/storage/ndb/src/kernel/vm/DLFifoList.hpp	2011-11-11 07:47:19 +0000
@@ -21,6 +21,7 @@
 
 #include <ndb_global.h>
 #include <kernel_types.h>
+#include "ArrayPool.hpp"
 #include "Pool.hpp"
 
 /**

=== modified file 'storage/ndb/src/kernel/vm/DLHashTable.hpp'
--- a/storage/ndb/src/kernel/vm/DLHashTable.hpp	2011-10-13 09:25:13 +0000
+++ b/storage/ndb/src/kernel/vm/DLHashTable.hpp	2011-11-11 07:46:17 +0000
@@ -1,6 +1,5 @@
 /*
-   Copyright (c) 2003-2006, 2008 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
-   Use is subject to license terms.
+   Copyright (c) 2003-2006, 2008, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,30 +19,38 @@
 #define DL_HASHTABLE_HPP
 
 #include <ndb_global.h>
-#include "ArrayPool.hpp"
 
 /**
- * DLHashTable implements a hashtable using chaining
+ * DLMHashTable implements a hashtable using chaining
  *   (with a double linked list)
  *
- * The entries in the hashtable must have the following methods:
- *  -# bool U::equal(const class U &) const;
- *     Which should return equal if the to objects have the same key
- *  -# Uint32 U::hashValue() const;
- *     Which should return a 32 bit hashvalue
+ * The entries in the (uninstansiated) meta class passed to the
+ * hashtable must have the following methods:
  *
- * and the following members:
- *  -# Uint32 U::nextHash;
- *  -# Uint32 U::prevHash;
+ *  -# nextHash(T&) returning a reference to the next link
+ *  -# prevHash(T&) returning a reference to the prev link
+ *  -# bool equal(T const&,T const&) returning equality of the objects keys
+ *  -# hashValue(T) calculating the hash value
  */
 
-template <typename P, typename T, typename U = T>
-class DLHashTableImpl 
+template <typename T, typename U = T> struct DLHashTableDefaultMethods {
+static Uint32& nextHash(U& t) { return t.nextHash; }
+static Uint32& prevHash(U& t) { return t.prevHash; }
+static Uint32 hashValue(T const& t) { return t.hashValue(); }
+static bool equal(T const& lhs, T const& rhs) { return lhs.equal(rhs); }
+};
+
+template <typename P, typename T, typename M = DLHashTableDefaultMethods<T> >
+class DLMHashTable
 {
 public:
-  DLHashTableImpl(P & thePool);
-  ~DLHashTableImpl();
-  
+  explicit DLMHashTable(P & thePool);
+  ~DLMHashTable();
+private:
+  DLMHashTable(const DLMHashTable&);
+  DLMHashTable&  operator=(const DLMHashTable&);
+
+public:
   /**
    * Set the no of bucket in the hashtable
    *
@@ -63,9 +70,9 @@ public:
    * Add an object to the hashtable
    */
   void add(Ptr<T> &);
-  
+
   /**
-   * Find element key in hashtable update Ptr (i & p) 
+   * Find element key in hashtable update Ptr (i & p)
    *   (using key.equal(...))
    * @return true if found and false otherwise
    */
@@ -108,7 +115,7 @@ public:
    * Remove all elements, but dont return them to pool
    */
   void removeAll();
-  
+
   /**
    * Remove element and return to pool
    */
@@ -118,7 +125,7 @@ public:
    * Remove element and return to pool
    */
   void release(Ptr<T> &);
-  
+
   class Iterator {
   public:
     Ptr<T> curr;
@@ -136,7 +143,7 @@ public:
    * First element in bucket
    */
   bool first(Iterator & iter) const;
-  
+
   /**
    * Next Element
    *
@@ -151,16 +158,16 @@ public:
    * @param iter - An "uninitialized" iterator
    */
   bool next(Uint32 bucket, Iterator & iter) const;
-  
+
 private:
   Uint32 mask;
   Uint32 * hashValues;
   P & thePool;
 };
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-DLHashTableImpl<P, T, U>::DLHashTableImpl(P & _pool)
+DLMHashTable<P, T, M>::DLMHashTable(P & _pool)
   : thePool(_pool)
 {
   // Require user defined constructor on T since we fiddle
@@ -171,23 +178,23 @@ DLHashTableImpl<P, T, U>::DLHashTableImp
   hashValues = 0;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-DLHashTableImpl<P, T, U>::~DLHashTableImpl()
+DLMHashTable<P, T, M>::~DLMHashTable()
 {
-  if(hashValues != 0)
+  if (hashValues != 0)
     delete [] hashValues;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::setSize(Uint32 size)
+DLMHashTable<P, T, M>::setSize(Uint32 size)
 {
   Uint32 i = 1;
-  while(i < size) i *= 2;
+  while (i < size) i *= 2;
 
-  if(mask == (i - 1))
+  if (mask == (i - 1))
   {
     /**
      * The size is already set to <b>size</b>
@@ -195,43 +202,43 @@ DLHashTableImpl<P, T, U>::setSize(Uint32
     return true;
   }
 
-  if(mask != 0)
+  if (mask != 0)
   {
     /**
      * The mask is already set
      */
     return false;
   }
-  
+
   mask = (i - 1);
   hashValues = new Uint32[i];
-  for(Uint32 j = 0; j<i; j++)
+  for (Uint32 j = 0; j<i; j++)
     hashValues[j] = RNIL;
-  
+
   return true;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::add(Ptr<T> & obj)
+DLMHashTable<P, T, M>::add(Ptr<T> & obj)
 {
-  const Uint32 hv = obj.p->U::hashValue() & mask;
+  const Uint32 hv = M::hashValue(*obj.p) & mask;
   const Uint32 i  = hashValues[hv];
-  
-  if(i == RNIL)
+
+  if (i == RNIL)
   {
     hashValues[hv] = obj.i;
-    obj.p->U::nextHash = RNIL;
-    obj.p->U::prevHash = RNIL;
-  } 
-  else 
+    M::nextHash(*obj.p) = RNIL;
+    M::prevHash(*obj.p) = RNIL;
+  }
+  else
   {
     T * tmp = thePool.getPtr(i);
-    tmp->U::prevHash = obj.i;
-    obj.p->U::nextHash = i;
-    obj.p->U::prevHash = RNIL;
-    
+    M::prevHash(*tmp) = obj.i;
+    M::nextHash(*obj.p) = i;
+    M::prevHash(*obj.p) = RNIL;
+
     hashValues[hv] = obj.i;
   }
 }
@@ -239,62 +246,62 @@ DLHashTableImpl<P, T, U>::add(Ptr<T> & o
 /**
  * First element
  */
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::first(Iterator & iter) const 
+DLMHashTable<P, T, M>::first(Iterator & iter) const
 {
   Uint32 i = 0;
-  while(i <= mask && hashValues[i] == RNIL) i++;
-  if(i <= mask)
+  while (i <= mask && hashValues[i] == RNIL) i++;
+  if (i <= mask)
   {
     iter.bucket = i;
     iter.curr.i = hashValues[i];
     iter.curr.p = thePool.getPtr(iter.curr.i);
     return true;
   }
-  else 
+  else
   {
     iter.curr.i = RNIL;
   }
   return false;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::next(Iterator & iter) const 
+DLMHashTable<P, T, M>::next(Iterator & iter) const
 {
-  if(iter.curr.p->U::nextHash == RNIL)
+  if (M::nextHash(*iter.curr.p) == RNIL)
   {
     Uint32 i = iter.bucket + 1;
-    while(i <= mask && hashValues[i] == RNIL) i++;
-    if(i <= mask)
+    while (i <= mask && hashValues[i] == RNIL) i++;
+    if (i <= mask)
     {
       iter.bucket = i;
       iter.curr.i = hashValues[i];
       iter.curr.p = thePool.getPtr(iter.curr.i);
       return true;
     }
-    else 
+    else
     {
       iter.curr.i = RNIL;
       return false;
     }
   }
-  
-  iter.curr.i = iter.curr.p->U::nextHash;
+
+  iter.curr.i = M::nextHash(*iter.curr.p);
   iter.curr.p = thePool.getPtr(iter.curr.i);
   return true;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::remove(Ptr<T> & ptr, const T & key)
+DLMHashTable<P, T, M>::remove(Ptr<T> & ptr, const T & key)
 {
-  const Uint32 hv = key.U::hashValue() & mask;  
-  
+  const Uint32 hv = M::hashValue(key) & mask;
+
   Uint32 i;
   T * p;
   Ptr<T> prev;
@@ -302,42 +309,42 @@ DLHashTableImpl<P, T, U>::remove(Ptr<T>
   prev.i = RNIL;
 
   i = hashValues[hv];
-  while(i != RNIL)
+  while (i != RNIL)
   {
     p = thePool.getPtr(i);
-    if(key.U::equal(* p))
+    if (M::equal(key, * p))
     {
-      const Uint32 next = p->U::nextHash;
-      if(prev.i == RNIL)
+      const Uint32 next = M::nextHash(*p);
+      if (prev.i == RNIL)
       {
-	hashValues[hv] = next;
-      } 
-      else 
+        hashValues[hv] = next;
+      }
+      else
       {
-	prev.p->U::nextHash = next;
+        M::nextHash(*prev.p) = next;
       }
-      
-      if(next != RNIL)
+
+      if (next != RNIL)
       {
-	T * nextP = thePool.getPtr(next);
-	nextP->U::prevHash = prev.i;
+        T * nextP = thePool.getPtr(next);
+        M::prevHash(*nextP) = prev.i;
       }
-      
+
       ptr.i = i;
       ptr.p = p;
       return;
     }
     prev.p = p;
     prev.i = i;
-    i = p->U::nextHash;
+    i = M::nextHash(*p);
   }
   ptr.i = RNIL;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::remove(Uint32 i)
+DLMHashTable<P, T, M>::remove(Uint32 i)
 {
   Ptr<T> tmp;
   tmp.i = i;
@@ -345,10 +352,10 @@ DLHashTableImpl<P, T, U>::remove(Uint32
   remove(tmp);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::release(Uint32 i)
+DLMHashTable<P, T, M>::release(Uint32 i)
 {
   Ptr<T> tmp;
   tmp.i = i;
@@ -356,22 +363,22 @@ DLHashTableImpl<P, T, U>::release(Uint32
   release(tmp);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-void 
-DLHashTableImpl<P, T, U>::remove(Ptr<T> & ptr)
+void
+DLMHashTable<P, T, M>::remove(Ptr<T> & ptr)
 {
-  const Uint32 next = ptr.p->U::nextHash;
-  const Uint32 prev = ptr.p->U::prevHash;
+  const Uint32 next = M::nextHash(*ptr.p);
+  const Uint32 prev = M::prevHash(*ptr.p);
 
-  if(prev != RNIL)
+  if (prev != RNIL)
   {
     T * prevP = thePool.getPtr(prev);
-    prevP->U::nextHash = next;
-  } 
-  else 
+    M::nextHash(*prevP) = next;
+  }
+  else
   {
-    const Uint32 hv = ptr.p->U::hashValue() & mask;  
+    const Uint32 hv = M::hashValue(*ptr.p) & mask;
     if (hashValues[hv] == ptr.i)
     {
       hashValues[hv] = next;
@@ -382,30 +389,30 @@ DLHashTableImpl<P, T, U>::remove(Ptr<T>
       assert(false);
     }
   }
-  
-  if(next != RNIL)
+
+  if (next != RNIL)
   {
     T * nextP = thePool.getPtr(next);
-    nextP->U::prevHash = prev;
+    M::prevHash(*nextP) = prev;
   }
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-void 
-DLHashTableImpl<P, T, U>::release(Ptr<T> & ptr)
+void
+DLMHashTable<P, T, M>::release(Ptr<T> & ptr)
 {
-  const Uint32 next = ptr.p->U::nextHash;
-  const Uint32 prev = ptr.p->U::prevHash;
+  const Uint32 next = M::nextHash(*ptr.p);
+  const Uint32 prev = M::prevHash(*ptr.p);
 
-  if(prev != RNIL)
+  if (prev != RNIL)
   {
     T * prevP = thePool.getPtr(prev);
-    prevP->U::nextHash = next;
-  } 
-  else 
+    M::nextHash(*prevP) = next;
+  }
+  else
   {
-    const Uint32 hv = ptr.p->U::hashValue() & mask;  
+    const Uint32 hv = M::hashValue(*ptr.p) & mask;
     if (hashValues[hv] == ptr.i)
     {
       hashValues[hv] = next;
@@ -416,104 +423,104 @@ DLHashTableImpl<P, T, U>::release(Ptr<T>
       // Will add assert in 5.1
     }
   }
-  
-  if(next != RNIL)
+
+  if (next != RNIL)
   {
     T * nextP = thePool.getPtr(next);
-    nextP->U::prevHash = prev;
+    M::prevHash(*nextP) = prev;
   }
-  
+
   thePool.release(ptr);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-void 
-DLHashTableImpl<P, T, U>::removeAll()
+void
+DLMHashTable<P, T, M>::removeAll()
 {
-  for(Uint32 i = 0; i<=mask; i++)
+  for (Uint32 i = 0; i<=mask; i++)
     hashValues[i] = RNIL;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::next(Uint32 bucket, Iterator & iter) const 
+DLMHashTable<P, T, M>::next(Uint32 bucket, Iterator & iter) const
 {
-  while (bucket <= mask && hashValues[bucket] == RNIL) 
-    bucket++; 
-  
-  if (bucket > mask) 
+  while (bucket <= mask && hashValues[bucket] == RNIL)
+    bucket++;
+
+  if (bucket > mask)
   {
     iter.bucket = bucket;
     iter.curr.i = RNIL;
     return false;
   }
-  
+
   iter.bucket = bucket;
   iter.curr.i = hashValues[bucket];
   iter.curr.p = thePool.getPtr(iter.curr.i);
   return true;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::seize(Ptr<T> & ptr)
+DLMHashTable<P, T, M>::seize(Ptr<T> & ptr)
 {
-  if(thePool.seize(ptr)){
-    ptr.p->U::nextHash = ptr.p->U::prevHash = RNIL;
+  if (thePool.seize(ptr)){
+    M::nextHash(*ptr.p) = M::prevHash(*ptr.p) = RNIL;
     return true;
   }
   return false;
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::getPtr(Ptr<T> & ptr, Uint32 i) const 
+DLMHashTable<P, T, M>::getPtr(Ptr<T> & ptr, Uint32 i) const
 {
   ptr.i = i;
   ptr.p = thePool.getPtr(i);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 void
-DLHashTableImpl<P, T, U>::getPtr(Ptr<T> & ptr) const 
+DLMHashTable<P, T, M>::getPtr(Ptr<T> & ptr) const
 {
   thePool.getPtr(ptr);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
-T * 
-DLHashTableImpl<P, T, U>::getPtr(Uint32 i) const 
+T *
+DLMHashTable<P, T, M>::getPtr(Uint32 i) const
 {
   return thePool.getPtr(i);
 }
 
-template <typename P, typename T, typename U>
+template <typename P, typename T, typename M>
 inline
 bool
-DLHashTableImpl<P, T, U>::find(Ptr<T> & ptr, const T & key) const 
+DLMHashTable<P, T, M>::find(Ptr<T> & ptr, const T & key) const
 {
-  const Uint32 hv = key.U::hashValue() & mask;  
-  
+  const Uint32 hv = M::hashValue(key) & mask;
+
   Uint32 i;
   T * p;
 
   i = hashValues[hv];
-  while(i != RNIL)
+  while (i != RNIL)
   {
     p = thePool.getPtr(i);
-    if(key.U::equal(* p))
+    if (M::equal(key, * p))
     {
       ptr.i = i;
       ptr.p = p;
       return true;
     }
-    i = p->U::nextHash;
+    i = M::nextHash(*p);
   }
   ptr.i = RNIL;
   ptr.p = NULL;
@@ -522,11 +529,26 @@ DLHashTableImpl<P, T, U>::find(Ptr<T> &
 
 // Specializations
 
+#include "ArrayPool.hpp"
+
+template <typename P, typename T, typename U = T >
+class DLHashTableImpl: public DLMHashTable<P, T, DLHashTableDefaultMethods<T, U> >
+{
+public:
+  explicit DLHashTableImpl(P & p): DLMHashTable<P, T, DLHashTableDefaultMethods<T, U> >(p) { }
+private:
+  DLHashTableImpl(const DLHashTableImpl&);
+  DLHashTableImpl&  operator=(const DLHashTableImpl&);
+};
+
 template <typename T, typename U = T, typename P = ArrayPool<T> >
-class DLHashTable : public DLHashTableImpl<P, T, U>
+class DLHashTable: public DLMHashTable<P, T, DLHashTableDefaultMethods<T, U> >
 {
 public:
-  DLHashTable(P & p) : DLHashTableImpl<P, T, U>(p) {}
+  explicit DLHashTable(P & p): DLMHashTable<P, T, DLHashTableDefaultMethods<T, U> >(p) { }
+private:
+  DLHashTable(const DLHashTable&);
+  DLHashTable&  operator=(const DLHashTable&);
 };
 
 #endif

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2011-10-07 08:07:21 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2011-11-11 07:46:17 +0000
@@ -507,7 +507,7 @@ protected:
     };
     Uint32 prevHash;
     
-    inline bool equal(FragmentInfo & p) const {
+    inline bool equal(FragmentInfo const & p) const {
       return m_senderRef == p.m_senderRef && m_fragmentId == p.m_fragmentId;
     }
     

=== modified file 'storage/ndb/test/ndbapi/flexAsynch.cpp'
--- a/storage/ndb/test/ndbapi/flexAsynch.cpp	2011-11-09 14:19:23 +0000
+++ b/storage/ndb/test/ndbapi/flexAsynch.cpp	2011-11-11 08:35:14 +0000
@@ -788,7 +788,7 @@ executeTransLoop(ThreadNdb* pThread,
     if (!executeTrans(pThread, aType, aNdbObject, threadBase, i++))
       return false;
     STOP_TIMER;
-    time_expired = timer.elapsedTime() / 1000;
+    time_expired = (int)(timer.elapsedTime() / 1000);
     if (time_expired < tWarmupTime)
       ; //Do nothing
     else if (time_expired < (tWarmupTime + tExecutionTime)){

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (jonas.oreland:4333 to 4334) jonas oreland11 Nov