List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 15 2009 9:41am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:3003)
View as plain text  
#At file:///home/jonas/src/64-bug46873/ based on revid:magnus.blaudd@stripped

 3003 Jonas Oreland	2009-09-15
      ndb - bug-46873 - commit for autotest

    modified:
      storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
      storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
      storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.cpp
      storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.hpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
      storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
      storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.hpp
=== modified file 'storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2009-09-15 09:41:24 +0000
@@ -623,6 +623,7 @@ struct Tabrec {
   Uint32 fragptrholder[MAX_FRAG_PER_NODE];
   Uint32 tabUserPtr;
   BlockReference tabUserRef;
+  Uint32 tabUserGsn;
 };
   typedef Ptr<Tabrec> TabrecPtr;
 

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2009-08-07 12:02:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2009-09-15 09:41:24 +0000
@@ -679,7 +679,8 @@ Dbacc::execDROP_TAB_REQ(Signal* signal){
   
   tabPtr.p->tabUserRef = req->senderRef;
   tabPtr.p->tabUserPtr = req->senderData;
-  
+  tabPtr.p->tabUserGsn = GSN_DROP_TAB_REQ;
+
   signal->theData[0] = ZREL_ROOT_FRAG;
   signal->theData[1] = tabPtr.i;
   sendSignal(cownBlockref, GSN_CONTINUEB, signal, 2, JBB);
@@ -696,6 +697,7 @@ Dbacc::execDROP_FRAG_REQ(Signal* signal)
 
   tabPtr.p->tabUserRef = req->senderRef;
   tabPtr.p->tabUserPtr = req->senderData;
+  tabPtr.p->tabUserGsn = GSN_DROP_FRAG_REQ;
 
   for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++)
   {
@@ -718,19 +720,20 @@ void Dbacc::releaseRootFragResources(Sig
   tabPtr.i = tableId;
   ptrCheckGuard(tabPtr, ctablesize, tabrec);
 
-  const BlockNumber dictBlock = !isNdbMtLqh() ? DBDICT : DBACC;
-  if (refToBlock(tabPtr.p->tabUserRef) == dictBlock)
+  if (tabPtr.p->tabUserGsn == GSN_DROP_TAB_REQ)
   {
     jam();
-    for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++) {
+    for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++)
+    {
       jam();
-      if (tabPtr.p->fragholder[i] != RNIL) {
+      if (tabPtr.p->fragholder[i] != RNIL)
+      {
         jam();
         tabPtr.p->fragholder[i] = RNIL;
         releaseFragResources(signal, tabPtr.p->fragptrholder[i]);
         return;
-      }//if
-    }//for
+      }
+    }
 
     /**
      * Finished...
@@ -744,7 +747,7 @@ void Dbacc::releaseRootFragResources(Sig
   }
   else
   {
-    ndbrequire(refToMain(tabPtr.p->tabUserRef) == DBLQH);
+    ndbrequire(tabPtr.p->tabUserGsn == GSN_DROP_FRAG_REQ);
 
     DropFragConf * conf = (DropFragConf *)signal->getDataPtrSend();
     conf->senderRef = reference();
@@ -756,6 +759,7 @@ void Dbacc::releaseRootFragResources(Sig
   
   tabPtr.p->tabUserPtr = RNIL;
   tabPtr.p->tabUserRef = 0;
+  tabPtr.p->tabUserGsn = 0;
 }//Dbacc::releaseRootFragResources()
 
 void Dbacc::releaseFragResources(Signal* signal, Uint32 fragIndex)

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.cpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.cpp	2009-09-15 09:41:24 +0000
@@ -19,9 +19,6 @@
 DbaccProxy::DbaccProxy(Block_context& ctx) :
   LocalProxy(DBACC, ctx)
 {
-  // GSN_DROP_TAB_REQ
-  addRecSignal(GSN_DROP_TAB_REQ, &DbaccProxy::execDROP_TAB_REQ);
-  addRecSignal(GSN_DROP_TAB_CONF, &DbaccProxy::execDROP_TAB_CONF);
 }
 
 DbaccProxy::~DbaccProxy()
@@ -34,63 +31,4 @@ DbaccProxy::newWorker(Uint32 instanceNo)
   return new Dbacc(m_ctx, instanceNo);
 }
 
-// GSN_DROP_TAB_REQ
-
-void
-DbaccProxy::execDROP_TAB_REQ(Signal* signal)
-{
-  const DropTabReq* req = (const DropTabReq*)signal->getDataPtr();
-  Uint32 ssId = getSsId(req);
-  Ss_DROP_TAB_REQ& ss = ssSeize<Ss_DROP_TAB_REQ>(ssId);
-  ss.m_req = *req;
-  ndbrequire(signal->getLength() == DropTabReq::SignalLength);
-  sendREQ(signal, ss);
-}
-
-void
-DbaccProxy::sendDROP_TAB_REQ(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-
-  DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
-  *req = ss.m_req;
-  req->senderRef = reference();
-  req->senderData = ssId; // redundant since tableId is used
-  sendSignal(workerRef(ss.m_worker), GSN_DROP_TAB_REQ,
-             signal, DropTabReq::SignalLength, JBB);
-}
-
-void
-DbaccProxy::execDROP_TAB_CONF(Signal* signal)
-{
-  const DropTabConf* conf = (const DropTabConf*)signal->getDataPtr();
-  Uint32 ssId = getSsId(conf);
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  recvCONF(signal, ss);
-}
-
-void
-DbaccProxy::sendDROP_TAB_CONF(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  BlockReference dictRef = ss.m_req.senderRef;
-
-  if (!lastReply(ss))
-    return;
-
-  if (ss.m_error == 0) {
-    jam();
-    DropTabConf* conf = (DropTabConf*)signal->getDataPtrSend();
-    conf->senderRef = reference();
-    conf->senderData = ss.m_req.senderData;
-    conf->tableId = ss.m_req.tableId;
-    sendSignal(dictRef, GSN_DROP_TAB_CONF,
-               signal, DropTabConf::SignalLength, JBB);
-  } else {
-    ndbrequire(false);
-  }
-
-  ssRelease<Ss_DROP_TAB_REQ>(ssId);
-}
-
 BLOCK_FUNCTIONS(DbaccProxy)

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.hpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccProxy.hpp	2009-09-15 09:41:24 +0000
@@ -27,30 +27,6 @@ public:
 
 protected:
   virtual SimulatedBlock* newWorker(Uint32 instanceNo);
-
-  // GSN_DROP_TAB_REQ
-  struct Ss_DROP_TAB_REQ : SsParallel {
-    DropTabReq m_req;
-    Ss_DROP_TAB_REQ() {
-      m_sendREQ = (SsFUNC)&DbaccProxy::sendDROP_TAB_REQ;
-      m_sendCONF = (SsFUNC)&DbaccProxy::sendDROP_TAB_CONF;
-    }
-    enum { poolSize = 1 };
-    static SsPool<Ss_DROP_TAB_REQ>& pool(LocalProxy* proxy) {
-      return ((DbaccProxy*)proxy)->c_ss_DROP_TAB_REQ;
-    }
-  };
-  SsPool<Ss_DROP_TAB_REQ> c_ss_DROP_TAB_REQ;
-  Uint32 getSsId(const DropTabReq* req) {
-    return SsIdBase | req->tableId;
-  }
-  Uint32 getSsId(const DropTabConf* conf) {
-    return SsIdBase | conf->tableId;
-  }
-  void execDROP_TAB_REQ(Signal*);
-  void sendDROP_TAB_REQ(Signal*, Uint32 ssId);
-  void execDROP_TAB_CONF(Signal*);
-  void sendDROP_TAB_CONF(Signal*, Uint32 ssId);
 };
 
 #endif

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-09-09 10:58:10 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-09-15 09:41:24 +0000
@@ -455,6 +455,54 @@ void Dbdict::packTableIntoPages(Signal* 
   const Uint32 type= signal->theData[2];
   const Uint32 pageId= signal->theData[3];
 
+  {
+    Uint32 transId = c_retrieveRecord.schemaTransId;
+    GetTabInfoReq req_copy;
+    req_copy.senderRef = c_retrieveRecord.blockRef;
+    req_copy.senderData = c_retrieveRecord.m_senderData;
+    req_copy.schemaTransId = c_retrieveRecord.schemaTransId;
+    req_copy.requestType = c_retrieveRecord.requestType;
+    req_copy.tableId = tableId;
+
+    SchemaFile::TableEntry *objEntry = 0;
+    if(tableId != RNIL)
+    {
+      XSchemaFile * xsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
+      objEntry = getTableEntry(xsf, tableId);
+    }
+
+    // The table seached for was not found
+    if(objEntry == 0)
+    {
+      jam();
+      sendGET_TABINFOREF(signal, &req_copy,
+                         GetTabInfoRef::TableNotDefined, __LINE__);
+      initRetrieveRecord(0, 0, 0);
+      return;
+    }
+
+    if (transId != 0 && transId == objEntry->m_transId)
+    {
+      jam();
+      // see own trans always
+    }
+    else if (refToBlock(req_copy.senderRef) != DBUTIL && /** XXX cheat */
+             refToBlock(req_copy.senderRef) != SUMA)
+    {
+      jam();
+      Uint32 err;
+      if ((err = check_read_obj(objEntry)))
+      {
+        jam();
+        // cannot see another uncommitted trans
+        sendGET_TABINFOREF(signal, &req_copy,
+                           (GetTabInfoRef::ErrorCode)err, __LINE__);
+        initRetrieveRecord(0, 0, 0);
+        return;
+      }
+    }
+  }
+
   PageRecordPtr pagePtr;
   c_pageRecordArray.getPtr(pagePtr, pageId);
 
@@ -2313,6 +2361,12 @@ Dbdict::check_read_obj(Uint32 objId, Uin
 Uint32
 Dbdict::check_read_obj(SchemaFile::TableEntry* te, Uint32 transId)
 {
+  if (te->m_tableState == SchemaFile::SF_UNUSED)
+  {
+    jam();
+    return GetTabInfoRef::TableNotDefined;
+  }
+
   if (te->m_transId == 0 || te->m_transId == transId)
   {
     jam();
@@ -2323,6 +2377,7 @@ Dbdict::check_read_obj(SchemaFile::Table
   case SchemaFile::SF_CREATE:
     jam();
     return GetTabInfoRef::TableNotDefined;
+    break;
   case SchemaFile::SF_ALTER:
     jam();
     return 0;
@@ -2333,15 +2388,10 @@ Dbdict::check_read_obj(SchemaFile::Table
   case SchemaFile::SF_IN_USE:
     jam();
     return 0;
-  case SchemaFile::SF_UNUSED:
-    jam();
-    return GetTabInfoRef::TableNotDefined;   
   default:
-    jam();
     /** weird... */
-    return 0;
+    return GetTabInfoRef::TableNotDefined;
   }
-  return 0;
 }
 
 Uint32
@@ -4316,17 +4366,14 @@ void Dbdict::printTables()
 
 Dbdict::DictObject *
 Dbdict::get_object(const char * name, Uint32 len, Uint32 hash){
-  DictObject key;
-  key.m_key.m_name_ptr = name;
-  key.m_key.m_name_len = len;
-  key.m_key.m_pool = &c_rope_pool;
-  key.m_name.m_hash = hash;
   Ptr<DictObject> old_ptr;
-  c_obj_hash.find(old_ptr, key);
-  return old_ptr.p;
+  if (get_object(old_ptr, name, len, hash))
+  {
+    return old_ptr.p;
+  }
+  return 0;
 }
 
-//wl3600_todo remove the duplication
 bool
 Dbdict::get_object(DictObjectPtr& obj_ptr, const char* name, Uint32 len, Uint32 hash)
 {
@@ -6412,13 +6459,19 @@ Dbdict::createTable_abortPrepare(Signal*
   unlinkDictObject(op_ptr);
 
   dropTabPtr.p->m_block = 0;
+  dropTabPtr.p->m_blockNo[0] = DBTC;
+  dropTabPtr.p->m_blockNo[1] = DBLQH; // wait usage + LCP
+  dropTabPtr.p->m_blockNo[2] = DBDIH; //
+  dropTabPtr.p->m_blockNo[3] = DBLQH; // release
+  dropTabPtr.p->m_blockNo[4] = 0;
+
   dropTabPtr.p->m_callback.m_callbackData =
     oplnk_ptr.p->op_key;
   dropTabPtr.p->m_callback.m_callbackFunction =
     safe_cast(&Dbdict::createTable_abortLocalConf);
 
-  // invoke the "commit" phase of drop table
-  dropTab_nextStep(signal, oplnk_ptr);
+  // invoke the "complete" phase of drop table
+  dropTable_complete_nextStep(signal, oplnk_ptr);
 
   if (tabPtr.p->m_tablespace_id != RNIL) {
     FilegroupPtr ptr;
@@ -6760,8 +6813,6 @@ Dbdict::dropTable_prepare(Signal* signal
 
   D("dropTable_prepare" << *op_ptr.p);
 
-  dropTabPtr.p->m_block = 0;
-
   Mutex mutex(signal, c_mutexMgr, dropTabPtr.p->m_define_backup_mutex);
   Callback c = {
     safe_cast(&Dbdict::dropTable_backup_mutex_locked),
@@ -6803,11 +6854,60 @@ Dbdict::dropTable_backup_mutex_locked(Si
     return;
   }
 
-  prepDropTab_nextStep(signal, op_ptr);
+  sendTransConf(signal, op_ptr);
 }
+// DropTable: COMMIT
 
 void
-Dbdict::prepDropTab_nextStep(Signal* signal, SchemaOpPtr op_ptr)
+Dbdict::dropTable_commit(Signal* signal, SchemaOpPtr op_ptr)
+{
+  SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
+
+  DropTableRecPtr dropTabPtr;
+  getOpRec(op_ptr, dropTabPtr);
+
+  D("dropTable_commit" << *op_ptr.p);
+
+  TableRecordPtr tablePtr;
+  c_tableRecordPool.getPtr(tablePtr, dropTabPtr.p->m_request.tableId);
+
+  if (tablePtr.p->m_tablespace_id != RNIL)
+  {
+    FilegroupPtr ptr;
+    ndbrequire(c_filegroup_hash.find(ptr, tablePtr.p->m_tablespace_id));
+    decrease_ref_count(ptr.p->m_obj_ptr_i);
+  }
+
+#if defined VM_TRACE || defined ERROR_INSERT
+  // from a newer execDROP_TAB_REQ version
+  {
+    char buf[1024];
+    Rope name(c_rope_pool, tablePtr.p->tableName);
+    name.copy(buf);
+    ndbout_c("Dbdict: drop name=%s,id=%u,obj_id=%u", buf, tablePtr.i,
+             tablePtr.p->m_obj_ptr_i);
+  }
+#endif
+
+  if (DictTabInfo::isIndex(tablePtr.p->tableType))
+  {
+    Ptr<TableRecord> basePtr;
+    c_tableRecordPool.getPtr(basePtr, tablePtr.p->primaryTableId);
+
+    LocalDLFifoList<TableRecord> list(c_tableRecordPool, basePtr.p->m_indexes);
+    list.remove(tablePtr);
+  }
+  dropTabPtr.p->m_block = 0;
+  dropTabPtr.p->m_blockNo[0] = DBLQH;
+  dropTabPtr.p->m_blockNo[1] = DBTC;
+  dropTabPtr.p->m_blockNo[2] = DBDIH;
+  dropTabPtr.p->m_blockNo[3] = 0;
+  dropTable_commit_nextStep(signal, op_ptr);
+}
+
+
+void
+Dbdict::dropTable_commit_nextStep(Signal* signal, SchemaOpPtr op_ptr)
 {
   DropTableRecPtr dropTabPtr;
   getOpRec(op_ptr, dropTabPtr);
@@ -6818,38 +6918,19 @@ Dbdict::prepDropTab_nextStep(Signal* sig
    */
   ndbrequire(!hasError(op_ptr.p->m_error));
 
-  Uint32& block = dropTabPtr.p->m_block; // ref
-  D("prepDropTab_nextStep" << hex << V(block) << *op_ptr.p);
+  Uint32 block = dropTabPtr.p->m_block;
+  Uint32 blockNo = dropTabPtr.p->m_blockNo[block];
+  D("dropTable_commit_nextStep" << hex << V(blockNo) << *op_ptr.p);
 
-  switch (block) {
-  case 0:
-    jam();
-    block = DBDICT;
-    prepDropTab_writeSchema(signal, op_ptr);
-    return;
-  case DBDICT:
-    jam();
-    block = DBLQH;
-    break;
-  case DBLQH:
-    jam();
-    block = DBTC;
-    break;
-  case DBTC:
-    jam();
-    block = DBDIH;
-    break;
-  case DBDIH:
+  if (blockNo == 0)
+  {
     jam();
-    prepDropTab_complete(signal, op_ptr);
+    dropTable_commit_done(signal, op_ptr);
     return;
-  default:
-    ndbrequire(false);
-    break;
   }
 
   if (ERROR_INSERTED(6131) &&
-      block == DBDIH) {
+      blockNo == DBDIH) {
     jam();
     CLEAR_ERROR_INSERT_VALUE;
 
@@ -6870,7 +6951,7 @@ Dbdict::prepDropTab_nextStep(Signal* sig
   prep->tableId = impl_req->tableId;
   prep->requestType = impl_req->requestType;
 
-  BlockReference ref = numberToRef(block, getOwnNodeId());
+  BlockReference ref = numberToRef(blockNo, getOwnNodeId());
   sendSignal(ref, GSN_PREP_DROP_TAB_REQ, signal,
              PrepDropTabReq::SignalLength, JBB);
 }
@@ -6883,14 +6964,6 @@ Dbdict::execPREP_DROP_TAB_REQ(Signal* si
 }
 
 void
-Dbdict::prepDropTab_writeSchema(Signal* signal, SchemaOpPtr op_ptr)
-{
-  jamEntry();
-
-  prepDropTab_fromLocal(signal, op_ptr.p->op_key, 0);
-}
-
-void
 Dbdict::execPREP_DROP_TAB_CONF(Signal * signal)
 {
   jamEntry();
@@ -6900,7 +6973,7 @@ Dbdict::execPREP_DROP_TAB_CONF(Signal * 
   Uint32 block = refToBlock(conf->senderRef);
   ndbrequire(nodeId == getOwnNodeId() && block != DBDICT);
 
-  prepDropTab_fromLocal(signal, conf->senderData, 0);
+  dropTable_commit_fromLocal(signal, conf->senderData, 0);
 }
 
 void
@@ -6925,11 +6998,11 @@ Dbdict::execPREP_DROP_TAB_REF(Signal* si
      */
     errorCode = 0;
   }
-  prepDropTab_fromLocal(signal, ref->senderData, errorCode);
+  dropTable_commit_fromLocal(signal, ref->senderData, errorCode);
 }
 
 void
-Dbdict::prepDropTab_fromLocal(Signal* signal, Uint32 op_key, Uint32 errorCode)
+Dbdict::dropTable_commit_fromLocal(Signal* signal, Uint32 op_key, Uint32 errorCode)
 {
   SchemaOpPtr op_ptr;
   DropTableRecPtr dropTabPtr;
@@ -6942,71 +7015,50 @@ Dbdict::prepDropTab_fromLocal(Signal* si
     setError(op_ptr, errorCode, __LINE__);
   }
 
-  prepDropTab_nextStep(signal, op_ptr);
+  dropTabPtr.p->m_block++;
+  dropTable_commit_nextStep(signal, op_ptr);
 }
 
 void
-Dbdict::prepDropTab_complete(Signal* signal, SchemaOpPtr op_ptr)
+Dbdict::dropTable_commit_done(Signal* signal, SchemaOpPtr op_ptr)
 {
   jam();
-  D("prepDropTab_complete");
+  D("dropTable_commit_done");
 
   sendTransConf(signal, op_ptr);
 }
 
-// DropTable: COMMIT
+// DropTable: COMPLETE
 
 void
-Dbdict::dropTable_commit(Signal* signal, SchemaOpPtr op_ptr)
+Dbdict::dropTable_complete(Signal* signal, SchemaOpPtr op_ptr)
 {
+  jam();
+
   SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
 
   DropTableRecPtr dropTabPtr;
   getOpRec(op_ptr, dropTabPtr);
 
-  D("dropTable_commit" << *op_ptr.p);
-
   TableRecordPtr tablePtr;
   c_tableRecordPool.getPtr(tablePtr, dropTabPtr.p->m_request.tableId);
 
   dropTabPtr.p->m_block = 0;
+  dropTabPtr.p->m_blockNo[0] = DBTC;
+  dropTabPtr.p->m_blockNo[1] = DBLQH; // wait usage + LCP
+  dropTabPtr.p->m_blockNo[2] = DBDIH; //
+  dropTabPtr.p->m_blockNo[3] = DBLQH; // release
+  dropTabPtr.p->m_blockNo[4] = 0;
   dropTabPtr.p->m_callback.m_callbackData =
     op_ptr.p->op_key;
   dropTabPtr.p->m_callback.m_callbackFunction =
-    safe_cast(&Dbdict::dropTab_complete);
-
-  if (tablePtr.p->m_tablespace_id != RNIL)
-  {
-    FilegroupPtr ptr;
-    ndbrequire(c_filegroup_hash.find(ptr, tablePtr.p->m_tablespace_id));
-    decrease_ref_count(ptr.p->m_obj_ptr_i);
-  }
-
-#if defined VM_TRACE || defined ERROR_INSERT
-  // from a newer execDROP_TAB_REQ version
-  {
-    char buf[1024];
-    Rope name(c_rope_pool, tablePtr.p->tableName);
-    name.copy(buf);
-    ndbout_c("Dbdict: drop name=%s,id=%u,obj_id=%u", buf, tablePtr.i,
-             tablePtr.p->m_obj_ptr_i);
-  }
-#endif
-
-  if (DictTabInfo::isIndex(tablePtr.p->tableType))
-  {
-    Ptr<TableRecord> basePtr;
-    c_tableRecordPool.getPtr(basePtr, tablePtr.p->primaryTableId);
+    safe_cast(&Dbdict::dropTable_complete_done);
 
-    LocalDLFifoList<TableRecord> list(c_tableRecordPool, basePtr.p->m_indexes);
-    list.remove(tablePtr);
-  }
-
-  dropTab_nextStep(signal, op_ptr);
+  dropTable_complete_nextStep(signal, op_ptr);
 }
 
 void
-Dbdict::dropTab_nextStep(Signal* signal, SchemaOpPtr op_ptr)
+Dbdict::dropTable_complete_nextStep(Signal* signal, SchemaOpPtr op_ptr)
 {
   DropTableRecPtr dropTabPtr;
   getOpRec(op_ptr, dropTabPtr);
@@ -7020,47 +7072,15 @@ Dbdict::dropTab_nextStep(Signal* signal,
   TableRecordPtr tablePtr;
   c_tableRecordPool.getPtr(tablePtr, impl_req->tableId);
 
-  Uint32& block = dropTabPtr.p->m_block; // ref
-  D("dropTab_nextStep" << hex << V(block) << *op_ptr.p);
+  Uint32 block = dropTabPtr.p->m_block;
+  Uint32 blockNo = dropTabPtr.p->m_blockNo[block];
+  D("dropTable_complete_nextStep" << hex << V(blockNo) << *op_ptr.p);
 
-  switch (block) {
-  case 0:
-    jam();
-    block = DBTC;
-    break;
-  case DBTC:
-    jam();
-    if (tablePtr.p->isTable() || tablePtr.p->isHashIndex())
-      block = DBACC;
-    if (tablePtr.p->isOrderedIndex())
-      block = DBTUP;
-    break;
-  case DBACC:
-    jam();
-    block = DBTUP;
-    break;
-  case DBTUP:
-    jam();
-    if (tablePtr.p->isTable() || tablePtr.p->isHashIndex())
-      block = DBLQH;
-    if (tablePtr.p->isOrderedIndex())
-      block = DBTUX;
-    break;
-  case DBTUX:
-    jam();
-    block = DBLQH;
-    break;
-  case DBLQH:
-    jam();
-    block = DBDIH;
-    break;
-  case DBDIH:
+  if (blockNo == 0)
+  {
     jam();
     execute(signal, dropTabPtr.p->m_callback, 0);
     return;
-  default:
-    ndbrequire(false);
-    break;
   }
 
   DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
@@ -7069,7 +7089,7 @@ Dbdict::dropTab_nextStep(Signal* signal,
   req->tableId = impl_req->tableId;
   req->requestType = impl_req->requestType;
 
-  BlockReference ref = numberToRef(block, getOwnNodeId());
+  BlockReference ref = numberToRef(blockNo, getOwnNodeId());
   sendSignal(ref, GSN_DROP_TAB_REQ, signal,
              DropTabReq::SignalLength, JBB);
 }
@@ -7084,7 +7104,7 @@ Dbdict::execDROP_TAB_CONF(Signal* signal
   Uint32 block = refToBlock(conf->senderRef);
   ndbrequire(nodeId == getOwnNodeId() && block != DBDICT);
 
-  dropTab_fromLocal(signal, conf->senderData);
+  dropTable_complete_fromLocal(signal, conf->senderData);
 }
 
 void
@@ -7098,11 +7118,11 @@ Dbdict::execDROP_TAB_REF(Signal* signal)
   ndbrequire(nodeId == getOwnNodeId() && block != DBDICT);
   ndbrequire(ref->errorCode == DropTabRef::NoSuchTable);
 
-  dropTab_fromLocal(signal, ref->senderData);
+  dropTable_complete_fromLocal(signal, ref->senderData);
 }
 
 void
-Dbdict::dropTab_fromLocal(Signal* signal, Uint32 op_key)
+Dbdict::dropTable_complete_fromLocal(Signal* signal, Uint32 op_key)
 {
   jamEntry();
 
@@ -7112,15 +7132,16 @@ Dbdict::dropTab_fromLocal(Signal* signal
   ndbrequire(!op_ptr.isNull());
   //const DropTabReq* impl_req = &dropTabPtr.p->m_request;
 
-  D("dropTab_fromLocal" << *op_ptr.p);
+  D("dropTable_complete_fromLocal" << *op_ptr.p);
 
-  dropTab_nextStep(signal, op_ptr);
+  dropTabPtr.p->m_block++;
+  dropTable_complete_nextStep(signal, op_ptr);
 }
 
 void
-Dbdict::dropTab_complete(Signal* signal,
-                         Uint32 op_key,
-                         Uint32 ret)
+Dbdict::dropTable_complete_done(Signal* signal,
+                                Uint32 op_key,
+                                Uint32 ret)
 {
   jam();
 
@@ -7156,15 +7177,6 @@ Dbdict::dropTab_complete(Signal* signal,
   sendTransConf(signal, trans_ptr);
 }
 
-// DropTable: COMPLETE
-
-void
-Dbdict::dropTable_complete(Signal* signal, SchemaOpPtr op_ptr)
-{
-  jam();
-  sendTransConf(signal, op_ptr);
-}
-
 // DropTable: ABORT
 
 void
@@ -7180,9 +7192,6 @@ Dbdict::dropTable_abortPrepare(Signal* s
 {
   D("dropTable_abortPrepare" << *op_ptr.p);
 
-  // no errors currently allowed...
-  ndbrequire(false);
-
   sendTransConf(signal, op_ptr);
 }
 
@@ -9274,9 +9283,11 @@ void Dbdict::execGET_TABINFOREQ(Signal* 
   else if (refToBlock(req->senderRef) != DBUTIL && /** XXX cheat */
            refToBlock(req->senderRef) != SUMA)
   {
+    jam();
     Uint32 err;
     if ((err = check_read_obj(objEntry)))
     {
+      jam();
       // cannot see another uncommitted trans
       sendGET_TABINFOREF(signal, req, (GetTabInfoRef::ErrorCode)err, __LINE__);
       return;
@@ -9290,6 +9301,8 @@ void Dbdict::execGET_TABINFOREQ(Signal* 
   c_retrieveRecord.currentSent = 0;
   c_retrieveRecord.m_useLongSig = useLongSig;
   c_retrieveRecord.m_table_type = objEntry->m_tableType;
+  c_retrieveRecord.schemaTransId = transId;
+  c_retrieveRecord.requestType = req->requestType;
   c_packTable.m_state = PackTable::PTS_GET_TAB;
 
   Uint32 len = 4;

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2009-08-21 13:01:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2009-09-15 09:41:24 +0000
@@ -1079,6 +1079,9 @@ private:
      * Long signal stuff
      */
     bool m_useLongSig;
+
+    Uint32 schemaTransId;
+    Uint32 requestType;
   };
   RetrieveRecord c_retrieveRecord;
 
@@ -2264,6 +2267,8 @@ private:
     MutexHandle2<BACKUP_DEFINE_MUTEX> m_define_backup_mutex;
 
     Uint32 m_block;
+    enum { BlockCount = 5 };
+    Uint32 m_blockNo[BlockCount];
     Callback m_callback;
 
     DropTableRec() :
@@ -2298,15 +2303,16 @@ private:
 
   // prepare
   void dropTable_backup_mutex_locked(Signal*, Uint32 op_key, Uint32 ret);
-  void prepDropTab_nextStep(Signal*, SchemaOpPtr);
-  void prepDropTab_writeSchema(Signal* signal, SchemaOpPtr);
-  void prepDropTab_fromLocal(Signal*, Uint32 op_key, Uint32 errorCode);
-  void prepDropTab_complete(Signal*, SchemaOpPtr);
 
   // commit
-  void dropTab_nextStep(Signal*, SchemaOpPtr);
-  void dropTab_fromLocal(Signal*, Uint32 op_key);
-  void dropTab_complete(Signal*, Uint32 op_key, Uint32 ret);
+  void dropTable_commit_nextStep(Signal*, SchemaOpPtr);
+  void dropTable_commit_fromLocal(Signal*, Uint32 op_key, Uint32 errorCode);
+  void dropTable_commit_done(Signal*, SchemaOpPtr);
+
+  // complete
+  void dropTable_complete_nextStep(Signal*, SchemaOpPtr);
+  void dropTable_complete_fromLocal(Signal*, Uint32 op_key);
+  void dropTable_complete_done(Signal*, Uint32 op_key, Uint32 ret);
 
   // MODULE: AlterTable
 

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2009-08-24 08:18:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2009-09-15 09:41:24 +0000
@@ -522,12 +522,6 @@ public:
       Uint32 tabUserPtr;
     } m_dropTab;
 
-    struct DropTable {
-      Uint32 senderRef;
-      Uint32 senderData;
-      SignalCounter waitDropTabCount;
-    } m_prepDropTab;
-
     Uint8 kvalue;
     Uint8 noOfBackups;
     Uint8 noPages;
@@ -793,7 +787,7 @@ private:
   void execCREATE_FRAGMENTATION_REQ(Signal*);
   
   void waitDropTabWritingToFile(Signal *, TabRecordPtr tabPtr);
-  void checkPrepDropTabComplete(Signal *, TabRecordPtr tabPtr);
+  void checkDropTabComplete(Signal *, TabRecordPtr tabPtr);
 
   void execDICT_LOCK_CONF(Signal* signal);
   void execDICT_LOCK_REF(Signal* signal);

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2009-08-24 08:18:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2009-09-15 09:41:24 +0000
@@ -7699,7 +7699,8 @@ void Dbdih::addtabrefuseLab(Signal* sign
 /***********              DELETE TABLE  MODULE                   *************/
 /*****************************************************************************/
 void
-Dbdih::execDROP_TAB_REQ(Signal* signal){
+Dbdih::execDROP_TAB_REQ(Signal* signal)
+{
   jamEntry();
   DropTabReq* req = (DropTabReq*)signal->getDataPtr();
 
@@ -7716,17 +7717,91 @@ Dbdih::execDROP_TAB_REQ(Signal* signal){
   case DropTabReq::OnlineDropTab:
     jam();
     ndbrequire(tabPtr.p->tabStatus == TabRecord::TS_DROPPING);
-    releaseTable(tabPtr);
     break;
   case DropTabReq::CreateTabDrop:
     jam();
-    releaseTable(tabPtr);
     break;
   case DropTabReq::RestartDropTab:
     break;
   }
   
-  startDeleteFile(signal, tabPtr);
+  if(isMaster())
+  {
+    /**
+     * Remove from queue
+     */
+    NodeRecordPtr nodePtr;
+    for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
+      jam();
+      ptrAss(nodePtr, nodeRecord);
+      if (c_lcpState.m_participatingLQH.get(nodePtr.i))
+      {
+
+	Uint32 index = 0;
+	Uint32 count = nodePtr.p->noOfQueuedChkpt;
+	while(index < count){
+	  if(nodePtr.p->queuedChkpt[index].tableId == tabPtr.i){
+	    jam();
+	    //	    g_eventLogger->info("Unqueuing %d", index);
+
+	    count--;
+	    for(Uint32 i = index; i<count; i++){
+	      jam();
+	      nodePtr.p->queuedChkpt[i] = nodePtr.p->queuedChkpt[i + 1];
+	    }
+	  } else {
+	    index++;
+	  }
+	}
+	nodePtr.p->noOfQueuedChkpt = count;
+      }
+    }
+  }
+
+  {
+    /**
+     * Check table lcp state
+     */
+    bool ok = false;
+    switch(tabPtr.p->tabLcpStatus){
+    case TabRecord::TLS_COMPLETED:
+    case TabRecord::TLS_WRITING_TO_FILE:
+      ok = true;
+      jam();
+      break;
+      return;
+    case TabRecord::TLS_ACTIVE:
+      ok = true;
+      jam();
+
+      tabPtr.p->tabLcpStatus = TabRecord::TLS_COMPLETED;
+
+      /**
+       * First check if all fragments are done
+       */
+      if (checkLcpAllTablesDoneInLqh(__LINE__))
+      {
+	jam();
+
+        g_eventLogger->info("This is the last table");
+
+	/**
+	 * Then check if saving of tab info is done for all tables
+	 */
+	LcpStatus a = c_lcpState.lcpStatus;
+	checkLcpCompletedLab(signal);
+
+        if(a != c_lcpState.lcpStatus)
+        {
+          g_eventLogger->info("And all tables are written to already written disk");
+        }
+      }
+      break;
+    }
+    ndbrequire(ok);
+  }
+
+  waitDropTabWritingToFile(signal, tabPtr);
 }
 
 void Dbdih::startDeleteFile(Signal* signal, TabRecordPtr tabPtr)
@@ -7781,6 +7856,7 @@ void Dbdih::tableDeleteLab(Signal* signa
   
   tabPtr.p->m_dropTab.tabUserPtr = RNIL;
   tabPtr.p->m_dropTab.tabUserRef = 0;
+  releaseTable(tabPtr);
 }//Dbdih::tableDeleteLab()
 
 
@@ -10192,7 +10268,8 @@ void Dbdih::initLcpLab(Signal* signal, U
 
     ptrAss(tabPtr, tabRecord);
 
-    if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE) {
+    if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE)
+    {
       jam();
       tabPtr.p->tabLcpStatus = TabRecord::TLS_COMPLETED;
       continue;
@@ -12224,9 +12301,9 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
     return;
   }//if
   
-  if(fromTimeQueue){
+  if(fromTimeQueue)
+  {
     jam();
-    
     ndbrequire(c_lcpState.noOfLcpFragRepOutstanding > 0);
     c_lcpState.noOfLcpFragRepOutstanding--;
   }
@@ -12250,14 +12327,19 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
    */
   m_local_lcp_state.lcp_frag_rep(lcpReport);
 
-  if(tableDone){
+  if (tableDone)
+  {
     jam();
 
-    if(tabPtr.p->tabStatus == TabRecord::TS_DROPPING){
+    if (tabPtr.p->tabStatus == TabRecord::TS_IDLE ||
+        tabPtr.p->tabStatus == TabRecord::TS_DROPPING)
+    {
       jam();
       g_eventLogger->info("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ",
                           tableId, fragId);
-    } else {
+    }
+    else
+    {
       jam();
       /**
        * Write table description to file
@@ -12322,7 +12404,8 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
   /* ----------------------------------------------------------------------- */
   // Check if there are more LCP's to start up.
   /* ----------------------------------------------------------------------- */
-  if(isMaster()){
+  if(isMaster())
+  {
     jam();
 
     /**
@@ -12360,7 +12443,8 @@ Dbdih::checkLcpAllTablesDoneInLqh(Uint32
     jam();
     ptrAss(tabPtr, tabRecord);
     if ((tabPtr.p->tabStatus == TabRecord::TS_ACTIVE) &&
-        (tabPtr.p->tabLcpStatus == TabRecord::TLS_ACTIVE)) {
+        (tabPtr.p->tabLcpStatus == TabRecord::TLS_ACTIVE))
+    {
       jam();
       /**
        * Nope, not finished with all tables
@@ -12478,6 +12562,13 @@ Dbdih::reportLcpCompletion(const LcpFrag
   tabPtr.i = tableId;
   ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
   
+  if (tabPtr.p->tabStatus == TabRecord::TS_DROPPING ||
+      tabPtr.p->tabStatus == TabRecord::TS_IDLE)
+  {
+    jam();
+    return true;
+  }
+
   FragmentstorePtr fragPtr;
   getFragstore(tabPtr.p, fragId, fragPtr);
   
@@ -12601,7 +12692,8 @@ Dbdih::sendLCP_FRAG_ORD(Signal* signal, 
 
 void Dbdih::checkLcpCompletedLab(Signal* signal) 
 {
-  if(c_lcpState.lcpStatus < LCP_TAB_COMPLETED){
+  if(c_lcpState.lcpStatus < LCP_TAB_COMPLETED)
+  {
     jam();
     return;
   }
@@ -12610,13 +12702,12 @@ void Dbdih::checkLcpCompletedLab(Signal*
   for (tabPtr.i = 0; tabPtr.i < ctabFileSize; tabPtr.i++) {
     jam();
     ptrAss(tabPtr, tabRecord);
-    if (tabPtr.p->tabStatus == TabRecord::TS_ACTIVE) {
-      if (tabPtr.p->tabLcpStatus != TabRecord::TLS_COMPLETED) {
-        jam();
-        return;
-      }//if
-    }//if
-  }//for
+    if (tabPtr.p->tabLcpStatus != TabRecord::TLS_COMPLETED)
+    {
+      jam();
+      return;
+    }
+  }
 
   CRASH_INSERTION2(7027, isMaster());
   CRASH_INSERTION2(7018, !isMaster());
@@ -16513,7 +16604,8 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* sig
     ndbrequire(ok);
   }
 
-  if(err != PrepDropTabRef::OK){
+  if(err != PrepDropTabRef::OK)
+  {
     jam();
     PrepDropTabRef* ref = (PrepDropTabRef*)signal->getDataPtrSend();
     ref->senderRef = reference();
@@ -16526,88 +16618,19 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* sig
   }
 
   tabPtr.p->tabStatus = TabRecord::TS_DROPPING;
-  tabPtr.p->m_prepDropTab.senderRef = senderRef;
-  tabPtr.p->m_prepDropTab.senderData = senderData;
-  
-  if(isMaster()){
-    /**
-     * Remove from queue
-     */
-    NodeRecordPtr nodePtr;
-    for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
-      jam();
-      ptrAss(nodePtr, nodeRecord);
-      if (c_lcpState.m_participatingLQH.get(nodePtr.i)){
-	
-	Uint32 index = 0;
-	Uint32 count = nodePtr.p->noOfQueuedChkpt;
-	while(index < count){
-	  if(nodePtr.p->queuedChkpt[index].tableId == tabPtr.i){
-	    jam();
-	    //	    g_eventLogger->info("Unqueuing %d", index);
-	    
-	    count--;
-	    for(Uint32 i = index; i<count; i++){
-	      jam();
-	      nodePtr.p->queuedChkpt[i] = nodePtr.p->queuedChkpt[i + 1];
-	    }
-	  } else {
-	    index++;
-	  }
-	}
-	nodePtr.p->noOfQueuedChkpt = count;
-      }
-    }
-  }
-  
-  { /**
-     * Check table lcp state
-     */
-    
-    bool ok = false;
-    switch(tabPtr.p->tabLcpStatus){
-    case TabRecord::TLS_COMPLETED:
-    case TabRecord::TLS_WRITING_TO_FILE:
-      ok = true;
-      jam();
-      break;
-      return;
-    case TabRecord::TLS_ACTIVE:
-      ok = true;
-      jam();
-      
-      tabPtr.p->tabLcpStatus = TabRecord::TLS_COMPLETED;
-      
-      /**
-       * First check if all fragments are done
-       */
-      if(checkLcpAllTablesDoneInLqh(__LINE__)){
-	jam();
-	
-        g_eventLogger->info("This is the last table");
-	
-	/**
-	 * Then check if saving of tab info is done for all tables
-	 */
-	LcpStatus a = c_lcpState.lcpStatus;
-	checkLcpCompletedLab(signal);
-	
-        if(a != c_lcpState.lcpStatus){
-          g_eventLogger->info("And all tables are written to already written disk");
-        }
-      }
-      break;
-    }
-    ndbrequire(ok);
-  }  
-  
-  waitDropTabWritingToFile(signal, tabPtr);
+  PrepDropTabConf* conf = (PrepDropTabConf*)signal->getDataPtrSend();
+  conf->tableId = tabPtr.i;
+  conf->senderRef = reference();
+  conf->senderData = senderData;
+  sendSignal(senderRef, GSN_PREP_DROP_TAB_CONF,
+             signal, PrepDropTabConf::SignalLength, JBB);
 }
 
 void
 Dbdih::waitDropTabWritingToFile(Signal* signal, TabRecordPtr tabPtr){
   
-  if(tabPtr.p->tabLcpStatus == TabRecord::TLS_WRITING_TO_FILE){
+  if (tabPtr.p->tabLcpStatus == TabRecord::TLS_WRITING_TO_FILE)
+  {
     jam();
     signal->theData[0] = DihContinueB::WAIT_DROP_TAB_WRITING_TO_FILE;
     signal->theData[1] = tabPtr.i;
@@ -16616,33 +16639,13 @@ Dbdih::waitDropTabWritingToFile(Signal* 
   }
 
   ndbrequire(tabPtr.p->tabLcpStatus ==  TabRecord::TLS_COMPLETED);
-  checkPrepDropTabComplete(signal, tabPtr);
+  checkDropTabComplete(signal, tabPtr);
 }
 
 void
-Dbdih::checkPrepDropTabComplete(Signal* signal, TabRecordPtr tabPtr){
-  
-  if(tabPtr.p->tabLcpStatus !=  TabRecord::TLS_COMPLETED){
-    jam();
-    return;
-  }
-  
-  if(!tabPtr.p->m_prepDropTab.waitDropTabCount.done()){
-    jam();
-    return;
-  }
-  
-  const Uint32 ref = tabPtr.p->m_prepDropTab.senderRef;
-  if(ref != 0)
-  {
-    PrepDropTabConf* conf = (PrepDropTabConf*)signal->getDataPtrSend();
-    conf->tableId = tabPtr.i;
-    conf->senderRef = reference();
-    conf->senderData = tabPtr.p->m_prepDropTab.senderData;
-    sendSignal(tabPtr.p->m_prepDropTab.senderRef, GSN_PREP_DROP_TAB_CONF, 
-	       signal, PrepDropTabConf::SignalLength, JBB);
-    tabPtr.p->m_prepDropTab.senderRef = 0;
-  }
+Dbdih::checkDropTabComplete(Signal* signal, TabRecordPtr tabPtr)
+{
+  startDeleteFile(signal, tabPtr);
 }
 
 void

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2009-09-11 07:53:48 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2009-09-15 09:41:24 +0000
@@ -238,7 +238,7 @@ class Lgman;
 #define ZCHECK_LCP_STOP_BLOCKED 17
 #define ZSCAN_MARKERS 18
 #define ZOPERATION_EVENT_REP 19
-#define ZPREP_DROP_TABLE 20
+#define ZDROP_TABLE_WAIT_USAGE 20
 #define ZENABLE_EXPAND_CHECK 21
 #define ZRETRY_TCKEYREF 22
 #define ZWAIT_REORG_SUMA_FILTER_ENABLED 23
@@ -1819,8 +1819,12 @@ public:
       TABLE_DEFINED = 0,
       NOT_DEFINED = 1,
       ADD_TABLE_ONGOING = 2,
-      PREP_DROP_TABLE_ONGOING = 3,
-      PREP_DROP_TABLE_DONE = 4
+      PREP_DROP_TABLE_DONE = 3,
+      DROP_TABLE_WAIT_USAGE = 4,
+      DROP_TABLE_WAIT_DONE = 5,
+      DROP_TABLE_ACC = 6,
+      DROP_TABLE_TUP = 7,
+      DROP_TABLE_TUX = 8
     };
     
     UintR fragrec[MAX_FRAG_PER_NODE];
@@ -2186,6 +2190,9 @@ private:
 
   void execPREP_DROP_TAB_REQ(Signal* signal);
   void execDROP_TAB_REQ(Signal* signal);
+  void execDROP_TAB_REF(Signal*);
+  void execDROP_TAB_CONF(Signal*);
+  void dropTable_nextStep(Signal*, AddFragRecordPtr);
 
   void execLQH_ALLOCREQ(Signal* signal);
   void execTUP_DEALLOCREQ(Signal* signal);
@@ -2209,7 +2216,8 @@ private:
   void sendLCP_COMPLETE_REP(Signal* signal, Uint32 lcpId);
   void sendEMPTY_LCP_CONF(Signal* signal, bool idle);
   void sendLCP_FRAGIDREQ(Signal* signal);
-  void sendLCP_FRAG_REP(Signal * signal, const LcpRecord::FragOrd &) const;
+  void sendLCP_FRAG_REP(Signal * signal, const LcpRecord::FragOrd &,
+                        const Fragrecord*) const;
 
   void updatePackedList(Signal* signal, HostRecord * ahostptr, Uint16 hostId);
   void LQHKEY_abort(Signal* signal, int errortype);
@@ -2542,8 +2550,8 @@ private:
   void sendCreateTabReq(Signal*, AddFragRecordPtr);
   void sendAddAttrReq(Signal* signal);
   void sendAddFragReq(Signal* signal);
-  void checkDropTab(Signal*);
-  Uint32 checkDropTabState(Tablerec::TableStatus, Uint32) const;
+  void dropTab_wait_usage(Signal*);
+  Uint32 get_table_state_error(Ptr<Tablerec> tabPtr) const;
 
   void remove_commit_marker(TcConnectionrec * const regTcPtr);
   // Initialisation

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2009-09-15 09:41:24 +0000
@@ -318,6 +318,8 @@ Dblqh::Dblqh(Block_context& ctx, Uint32 
 
   addRecSignal(GSN_PREP_DROP_TAB_REQ, &Dblqh::execPREP_DROP_TAB_REQ);
   addRecSignal(GSN_DROP_TAB_REQ, &Dblqh::execDROP_TAB_REQ);
+  addRecSignal(GSN_DROP_TAB_REF, &Dblqh::execDROP_TAB_REF);
+  addRecSignal(GSN_DROP_TAB_CONF, &Dblqh::execDROP_TAB_CONF);
 
   addRecSignal(GSN_LQH_ALLOCREQ, &Dblqh::execLQH_ALLOCREQ);
   addRecSignal(GSN_LQH_WRITELOG_REQ, &Dblqh::execLQH_WRITELOG_REQ);

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2009-09-11 07:53:48 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2009-09-15 09:41:24 +0000
@@ -473,9 +473,9 @@ void Dblqh::execCONTINUEB(Signal* signal
     signal->theData[1] = 0;
     sendSignalWithDelay(cownref, GSN_CONTINUEB, signal, 5000, 2);
     break;
-  case ZPREP_DROP_TABLE:
+  case ZDROP_TABLE_WAIT_USAGE:
     jam();
-    checkDropTab(signal);
+    dropTab_wait_usage(signal);
     return;
     break;
   case ZENABLE_EXPAND_CHECK:
@@ -2141,7 +2141,31 @@ Dblqh::execPREP_DROP_TAB_REQ(Signal* sig
   ptrCheckGuard(tabPtr, ctabrecFileSize, tablerec);
   
   Uint32 errCode = 0;
-  errCode = checkDropTabState(tabPtr.p->tableStatus, GSN_PREP_DROP_TAB_REQ);
+  switch(tabPtr.p->tableStatus) {
+  case Tablerec::TABLE_DEFINED:
+    jam();
+    break;
+  case Tablerec::NOT_DEFINED:
+    jam();
+    // Fall through
+  case Tablerec::ADD_TABLE_ONGOING:
+    jam();
+    errCode = PrepDropTabRef::NoSuchTable;
+    break;
+  case Tablerec::PREP_DROP_TABLE_DONE:
+    jam();
+    errCode = PrepDropTabRef::DropInProgress;
+    break;
+  case Tablerec::DROP_TABLE_WAIT_USAGE:
+  case Tablerec::DROP_TABLE_WAIT_DONE:
+  case Tablerec::DROP_TABLE_ACC:
+  case Tablerec::DROP_TABLE_TUP:
+  case Tablerec::DROP_TABLE_TUX:
+    jam();
+    errCode = PrepDropTabRef::DropInProgress;
+    break;
+  }
+
   if(errCode != 0)
   {
     jam();
@@ -2156,17 +2180,18 @@ Dblqh::execPREP_DROP_TAB_REQ(Signal* sig
     return;
   }
   
-  tabPtr.p->tableStatus = Tablerec::PREP_DROP_TABLE_ONGOING;
+  tabPtr.p->tableStatus = Tablerec::PREP_DROP_TABLE_DONE;
   
-  signal->theData[0] = ZPREP_DROP_TABLE;
-  signal->theData[1] = tabPtr.i;
-  signal->theData[2] = senderRef;
-  signal->theData[3] = senderData;
-  checkDropTab(signal);
+  PrepDropTabConf * conf = (PrepDropTabConf*)signal->getDataPtrSend();
+  conf->tableId = tabPtr.i;
+  conf->senderRef = reference();
+  conf->senderData = senderData;
+  sendSignal(senderRef, GSN_PREP_DROP_TAB_CONF, signal,
+	     PrepDropTabConf::SignalLength, JBB);
 }
 
 void
-Dblqh::checkDropTab(Signal* signal){
+Dblqh::dropTab_wait_usage(Signal* signal){
 
   TablerecPtr tabPtr;
   tabPtr.i = signal->theData[1];
@@ -2175,9 +2200,10 @@ Dblqh::checkDropTab(Signal* signal){
   Uint32 senderRef = signal->theData[2];
   Uint32 senderData = signal->theData[3];
   
-  ndbrequire(tabPtr.p->tableStatus == Tablerec::PREP_DROP_TABLE_ONGOING);
+  ndbrequire(tabPtr.p->tableStatus == Tablerec::DROP_TABLE_WAIT_USAGE);
   
-  if(tabPtr.p->usageCount > 0){
+  if(tabPtr.p->usageCount > 0)
+  {
     jam();
     sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 4);
     return;
@@ -2186,35 +2212,39 @@ Dblqh::checkDropTab(Signal* signal){
   bool lcpDone = true;
   lcpPtr.i = 0;
   ptrAss(lcpPtr, lcpRecord);
-  if(lcpPtr.p->lcpState != LcpRecord::LCP_IDLE){
+  if(lcpPtr.p->lcpState != LcpRecord::LCP_IDLE)
+  {
     jam();
 
-    if(lcpPtr.p->currentFragment.lcpFragOrd.tableId == tabPtr.i){
+    if(lcpPtr.p->currentFragment.lcpFragOrd.tableId == tabPtr.i)
+    {
       jam();
       lcpDone = false;
     }
     
     if(lcpPtr.p->lcpQueued && 
-       lcpPtr.p->queuedFragment.lcpFragOrd.tableId == tabPtr.i){
+       lcpPtr.p->queuedFragment.lcpFragOrd.tableId == tabPtr.i)
+    {
       jam();
       lcpDone = false;
     }
   }
   
-  if(!lcpDone){
+  if(!lcpDone)
+  {
     jam();
     sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 4);
     return;
   }
   
-  tabPtr.p->tableStatus = Tablerec::PREP_DROP_TABLE_DONE;
+  tabPtr.p->tableStatus = Tablerec::DROP_TABLE_WAIT_DONE;
 
-  PrepDropTabConf * conf = (PrepDropTabConf*)signal->getDataPtrSend();
+  DropTabConf * conf = (DropTabConf*)signal->getDataPtrSend();
   conf->tableId = tabPtr.i;
   conf->senderRef = reference();
   conf->senderData = senderData;
-  sendSignal(senderRef, GSN_PREP_DROP_TAB_CONF, signal,
-	     PrepDropTabConf::SignalLength, JBB);
+  sendSignal(senderRef, GSN_DROP_TAB_CONF, signal,
+	     DropTabConf::SignalLength, JBB);
 }
 
 void
@@ -2230,98 +2260,173 @@ Dblqh::execDROP_TAB_REQ(Signal* signal){
   tabPtr.i = req->tableId;
   ptrCheckGuard(tabPtr, ctabrecFileSize, tablerec);
   
-  do {
-    if(req->requestType == DropTabReq::RestartDropTab){
+  Uint32 errCode = 0;
+  switch((DropTabReq::RequestType)req->requestType) {
+  case DropTabReq::RestartDropTab:
+    jam();
+    tabPtr.p->tableStatus = Tablerec::DROP_TABLE_WAIT_DONE;
+    break;
+  case DropTabReq::CreateTabDrop:
+    jam();
+    tabPtr.p->tableStatus = Tablerec::DROP_TABLE_WAIT_DONE;
+    break;
+  case DropTabReq::OnlineDropTab:
+    jam();
+    switch(tabPtr.p->tableStatus) {
+    case Tablerec::TABLE_DEFINED:
       jam();
+      errCode = DropTabRef::DropWoPrep;
       break;
-    }
-    
-    if(req->requestType == DropTabReq::OnlineDropTab){
-      jam();
-      Uint32 errCode = 0;
-      errCode = checkDropTabState(tabPtr.p->tableStatus, GSN_DROP_TAB_REQ);
-      if(errCode != 0){
-	jam();
-	
-	DropTabRef* ref = (DropTabRef*)signal->getDataPtrSend();
-	ref->senderRef = reference();
-	ref->senderData = senderData;
-	ref->tableId = tabPtr.i;
-	ref->errorCode = errCode;
-	sendSignal(senderRef, GSN_DROP_TAB_REF, signal,
-		   DropTabRef::SignalLength, JBB);
-	return;
-      }
-    }
-
-    removeTable(tabPtr.i);
-    
-  } while(false);
-  
-  ndbrequire(tabPtr.p->usageCount == 0);
-  tabPtr.p->tableStatus = Tablerec::NOT_DEFINED;
-  
-  DropTabConf * const dropConf = (DropTabConf *)signal->getDataPtrSend();
-  dropConf->senderRef = reference();
-  dropConf->senderData = senderData;
-  dropConf->tableId = tabPtr.i;
-  sendSignal(senderRef, GSN_DROP_TAB_CONF,
-             signal, DropTabConf::SignalLength, JBB);
-}
-
-Uint32
-Dblqh::checkDropTabState(Tablerec::TableStatus status, Uint32 gsn) const{
-  
-  if(gsn == GSN_PREP_DROP_TAB_REQ){
-    switch(status){
     case Tablerec::NOT_DEFINED:
       jam();
-      // Fall through
-    case Tablerec::ADD_TABLE_ONGOING:
-      jam();
-      return PrepDropTabRef::NoSuchTable;
+      errCode = DropTabRef::NoSuchTable;
       break;
-    case Tablerec::PREP_DROP_TABLE_ONGOING:
+    case Tablerec::ADD_TABLE_ONGOING:
       jam();
-      return PrepDropTabRef::PrepDropInProgress;
-      break;
+      ndbassert(false);
     case Tablerec::PREP_DROP_TABLE_DONE:
       jam();
-      return PrepDropTabRef::DropInProgress;
+      tabPtr.p->tableStatus = Tablerec::DROP_TABLE_WAIT_USAGE;
+      signal->theData[0] = ZDROP_TABLE_WAIT_USAGE;
+      signal->theData[1] = tabPtr.i;
+      signal->theData[2] = senderRef;
+      signal->theData[3] = senderData;
+      dropTab_wait_usage(signal);
+      return;
       break;
-    case Tablerec::TABLE_DEFINED:
+    case Tablerec::DROP_TABLE_WAIT_USAGE:
+    case Tablerec::DROP_TABLE_ACC:
+    case Tablerec::DROP_TABLE_TUP:
+    case Tablerec::DROP_TABLE_TUX:
+      ndbrequire(false);
+    case Tablerec::DROP_TABLE_WAIT_DONE:
       jam();
-      return 0;
       break;
     }
-    ndbrequire(0);
   }
 
-  if(gsn == GSN_DROP_TAB_REQ){
-    switch(status){
-    case Tablerec::NOT_DEFINED:
-      jam();
-      // Fall through
-    case Tablerec::ADD_TABLE_ONGOING:
-      jam();
-      return DropTabRef::NoSuchTable;
-      break;
-    case Tablerec::PREP_DROP_TABLE_ONGOING:
+  if (errCode)
+  {
+    jam();
+    DropTabRef * ref = (DropTabRef*)signal->getDataPtrSend();
+    ref->tableId = tabPtr.i;
+    ref->senderRef = reference();
+    ref->senderData = senderData;
+    ref->errorCode = errCode;
+    sendSignal(senderRef, GSN_DROP_TAB_REF, signal,
+               DropTabRef::SignalLength, JBB);
+    return;
+  }
+
+  ndbrequire(tabPtr.p->usageCount == 0);
+  seizeAddfragrec(signal);
+  addfragptr.p->m_dropFragReq.tableId = tabPtr.i;
+  addfragptr.p->m_dropFragReq.senderRef = senderRef;
+  addfragptr.p->m_dropFragReq.senderData = senderData;
+
+  dropTable_nextStep(signal, addfragptr);
+}
+
+void
+Dblqh::execDROP_TAB_REF(Signal* signal)
+{
+  jamEntry();
+  DropTabRef * ref = (DropTabRef*)signal->getDataPtr();
+
+#if defined ERROR_INSERT || defined VM_TRACE
+  jamLine(ref->errorCode);
+  ndbrequire(false);
+#endif
+
+  Ptr<AddFragRecord> addFragPtr;
+  addFragPtr.i = ref->senderData;
+  ptrCheckGuard(addFragPtr, caddfragrecFileSize, addFragRecord);
+  dropTable_nextStep(signal, addFragPtr);
+}
+
+void
+Dblqh::execDROP_TAB_CONF(Signal* signal)
+{
+  jamEntry();
+  DropTabConf * conf = (DropTabConf*)signal->getDataPtr();
+
+  Ptr<AddFragRecord> addFragPtr;
+  addFragPtr.i = conf->senderData;
+  ptrCheckGuard(addFragPtr, caddfragrecFileSize, addFragRecord);
+  dropTable_nextStep(signal, addFragPtr);
+}
+
+void
+Dblqh::dropTable_nextStep(Signal* signal, Ptr<AddFragRecord> addFragPtr)
+{
+  jam();
+
+  TablerecPtr tabPtr;
+  tabPtr.i = addFragPtr.p->m_dropFragReq.tableId;
+  ptrCheckGuard(tabPtr, ctabrecFileSize, tablerec);
+
+  Uint32 ref = 0;
+  if (tabPtr.p->tableStatus == Tablerec::DROP_TABLE_WAIT_DONE)
+  {
+    jam();
+    if (DictTabInfo::isTable(tabPtr.p->tableType) ||
+        DictTabInfo::isHashIndex(tabPtr.p->tableType))
+    {
       jam();
-      return DropTabRef::PrepDropInProgress;
-      break;
-    case Tablerec::PREP_DROP_TABLE_DONE:
+      ref = calcInstanceBlockRef(DBACC);
+      tabPtr.p->tableStatus = Tablerec::DROP_TABLE_ACC;
+    }
+    else
+    {
       jam();
-      return 0;
-      break;
-    case Tablerec::TABLE_DEFINED:
+      ref = calcInstanceBlockRef(DBTUP);
+      tabPtr.p->tableStatus = Tablerec::DROP_TABLE_TUP;
+    }
+  }
+  else if (tabPtr.p->tableStatus == Tablerec::DROP_TABLE_ACC)
+  {
+    jam();
+    ref = calcInstanceBlockRef(DBTUP);
+    tabPtr.p->tableStatus = Tablerec::DROP_TABLE_TUP;
+  }
+  else if (tabPtr.p->tableStatus == Tablerec::DROP_TABLE_TUP)
+  {
+    jam();
+    if (DictTabInfo::isOrderedIndex(tabPtr.p->tableType))
+    {
       jam();
-      return DropTabRef::DropWoPrep;
+      ref = calcInstanceBlockRef(DBTUX);
+      tabPtr.p->tableStatus = Tablerec::DROP_TABLE_TUX;
     }
-    ndbrequire(0);
   }
-  ndbrequire(0);
-  return RNIL;
+
+  if (ref)
+  {
+    jam();
+    DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
+    req->senderData = addFragPtr.i;
+    req->senderRef = reference();
+    req->tableId = tabPtr.i;
+    req->tableVersion = tabPtr.p->schemaVersion;
+    req->requestType = DropTabReq::OnlineDropTab;
+    sendSignal(ref, GSN_DROP_TAB_REQ, signal,
+               DropTabReq::SignalLength, JBB);
+    return;
+  }
+
+  removeTable(tabPtr.i);
+  tabPtr.p->tableStatus = Tablerec::NOT_DEFINED;
+
+  ref = addFragPtr.p->m_dropFragReq.senderRef;
+  DropTabConf* conf = (DropTabConf*)signal->getDataPtrSend();
+  conf->senderRef = reference();
+  conf->senderData = addFragPtr.p->m_dropFragReq.senderData;
+  conf->tableId = tabPtr.i;
+  sendSignal(ref, GSN_DROP_TAB_CONF, signal,
+             DropTabConf::SignalLength, JBB);
+
+  addfragptr = addFragPtr;
+  releaseAddfragrec(signal);
 }
 
 void Dblqh::removeTable(Uint32 tableId)
@@ -2605,6 +2710,39 @@ void Dblqh::noFreeRecordLab(Signal* sign
   return;
 }//Dblqh::noFreeRecordLab()
 
+Uint32
+Dblqh::get_table_state_error(Ptr<Tablerec> tabPtr) const
+{
+  switch(tabPtr.p->tableStatus){
+  case Tablerec::NOT_DEFINED:
+    jam();
+    return ZTABLE_NOT_DEFINED;
+    break;
+  case Tablerec::ADD_TABLE_ONGOING:
+    jam();
+  case Tablerec::PREP_DROP_TABLE_DONE:
+    jam();
+  case Tablerec::DROP_TABLE_WAIT_USAGE:
+    jam();
+  case Tablerec::DROP_TABLE_WAIT_DONE:
+    jam();
+  case Tablerec::DROP_TABLE_ACC:
+    jam();
+  case Tablerec::DROP_TABLE_TUP:
+    jam();
+  case Tablerec::DROP_TABLE_TUX:
+    jam();
+    return PrepDropTabRef::DropInProgress;
+    break;
+  case Tablerec::TABLE_DEFINED:
+    ndbassert(0);
+    return ZTABLE_NOT_DEFINED;
+    break;
+  }
+  ndbassert(0);
+  return ~Uint32(0);
+}
+
 void Dblqh::LQHKEY_abort(Signal* signal, int errortype)
 {
   switch (errortype) {
@@ -2629,16 +2767,7 @@ void Dblqh::LQHKEY_abort(Signal* signal,
     break;
   case 4:
     jam();
-    if(tabptr.p->tableStatus == Tablerec::NOT_DEFINED){
-      jam();
-      terrorCode = ZTABLE_NOT_DEFINED;
-    } else if (tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_ONGOING ||
-	       tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_DONE){
-      jam();
-      terrorCode = ZDROP_TABLE_IN_PROGRESS;
-    } else {
-      ndbrequire(0);
-    }
+    terrorCode = get_table_state_error(tabptr);
     break;
   case 5:
     jam();
@@ -9296,16 +9425,8 @@ error_handler:
   return;
 
  error_handler_early_1:
-  if(tabptr.p->tableStatus == Tablerec::NOT_DEFINED){
-    jam();
-    errorCode = ZTABLE_NOT_DEFINED;
-  } else if (tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_ONGOING ||
-	     tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_DONE){
-    jam();
-    errorCode = ZDROP_TABLE_IN_PROGRESS;
-  } else {
-    ndbrequire(0);
-  }
+  errorCode = get_table_state_error(tabptr);
+
  error_handler_early:
   releaseSections(handle);
   ref = (ScanFragRef*)&signal->theData[0];
@@ -12177,7 +12298,8 @@ void Dblqh::execLCP_FRAG_ORD(Signal* sig
   ptrAss(lcpPtr, lcpRecord);
   
   lcpPtr.p->lastFragmentFlag = lcpFragOrd->lastFragmentFlag;
-  if (lcpFragOrd->lastFragmentFlag) {
+  if (lcpFragOrd->lastFragmentFlag)
+  {
     jam();
     if (lcpPtr.p->lcpState == LcpRecord::LCP_IDLE) {
       jam();
@@ -12198,17 +12320,12 @@ void Dblqh::execLCP_FRAG_ORD(Signal* sig
   tabptr.i = lcpFragOrd->tableId;
   ptrCheckGuard(tabptr, ctabrecFileSize, tablerec);
   
-  ndbrequire(tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_ONGOING ||
-	     tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_DONE ||
-	     tabptr.p->tableStatus == Tablerec::TABLE_DEFINED);
-
-  ndbrequire(getFragmentrec(signal, lcpFragOrd->fragmentId));
-  
   lcpPtr.i = 0;
   ptrAss(lcpPtr, lcpRecord);
   ndbrequire(!lcpPtr.p->lcpQueued);
 
-  if (c_lcpId < lcpFragOrd->lcpId) {
+  if (c_lcpId < lcpFragOrd->lcpId)
+  {
     jam();
 
     lcpPtr.p->firstFragmentFlag= true;
@@ -12220,18 +12337,25 @@ void Dblqh::execLCP_FRAG_ORD(Signal* sig
     clcpCompletedState = LCP_RUNNING;
   }
   
-  if(tabptr.p->tableStatus == Tablerec::PREP_DROP_TABLE_DONE){
+  if (tabptr.p->tableStatus != Tablerec::TABLE_DEFINED)
+  {
     jam();
     LcpRecord::FragOrd fragOrd;
-    fragOrd.fragPtrI = fragptr.i;
+    fragOrd.fragPtrI = RNIL;
     fragOrd.lcpFragOrd = * lcpFragOrd;
-    sendLCP_FRAG_REP(signal, fragOrd);
+
+    Fragrecord tmp;
+    tmp.maxGciInLcp = cnewestGci;
+    tmp.maxGciCompletedInLcp = cnewestCompletedGci;
+    sendLCP_FRAG_REP(signal, fragOrd, &tmp);
     return;
   }
 
   cnoOfFragsCheckpointed++;
+  ndbrequire(getFragmentrec(signal, lcpFragOrd->fragmentId));
 
-  if (lcpPtr.p->lcpState != LcpRecord::LCP_IDLE) {
+  if (lcpPtr.p->lcpState != LcpRecord::LCP_IDLE)
+  {
     ndbrequire(lcpPtr.p->lcpQueued == false);
     lcpPtr.p->lcpQueued = true;
     lcpPtr.p->queuedFragment.fragPtrI = fragptr.i;
@@ -12490,10 +12614,9 @@ void Dblqh::execBACKUP_FRAGMENT_CONF(Sig
 
 void
 Dblqh::sendLCP_FRAG_REP(Signal * signal, 
-			const LcpRecord::FragOrd & fragOrd) const {
-  
-  const Fragrecord* fragPtrP = c_fragment_pool.getConstPtr(fragOrd.fragPtrI);
-  
+			const LcpRecord::FragOrd & fragOrd,
+                        const Fragrecord * fragPtrP) const
+{
   ndbrequire(fragOrd.lcpFragOrd.lcpNo < MAX_LCP_STORED);
   LcpFragRep * const lcpReport = (LcpFragRep *)&signal->theData[0];
   lcpReport->nodeId = cownNodeid;
@@ -12535,7 +12658,8 @@ void Dblqh::contChkpNextFragLab(Signal* 
   /**
    * Send rep when fragment is done + unblocked
    */
-  sendLCP_FRAG_REP(signal, lcpPtr.p->currentFragment);
+  sendLCP_FRAG_REP(signal, lcpPtr.p->currentFragment,
+                   c_fragment_pool.getPtr(lcpPtr.p->currentFragment.fragPtrI));
   
   /* ------------------------------------------------------------------------
    *       WE ALSO RELEASE THE LOCAL LCP RECORDS.
@@ -12577,8 +12701,9 @@ void Dblqh::sendLCP_FRAGIDREQ(Signal* si
   TablerecPtr tabPtr;
   tabPtr.i = lcpPtr.p->currentFragment.lcpFragOrd.tableId;
   ptrAss(tabPtr, tablerec);
-  if(tabPtr.p->tableStatus == Tablerec::PREP_DROP_TABLE_ONGOING ||
-     tabPtr.p->tableStatus == Tablerec::PREP_DROP_TABLE_DONE){
+
+  if(tabPtr.p->tableStatus != Tablerec::TABLE_DEFINED)
+  {
     jam();
     /**
      * Fake that the fragment is done

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2009-03-20 09:58:04 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2009-09-15 09:41:24 +0000
@@ -989,6 +989,12 @@ DblqhProxy::sendDROP_TAB_CONF(Signal* si
     conf->tableId = ss.m_req.tableId;
     sendSignal(dictRef, GSN_DROP_TAB_CONF,
                signal, DropTabConf::SignalLength, JBB);
+
+    // inform DBTUP proxy
+    DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
+    *req = ss.m_req;
+    EXECUTE_DIRECT(DBTUP, GSN_DROP_TAB_REQ,
+                   signal, DropTabReq::SignalLength);
   } else {
     jam();
     DropTabRef* ref = (DropTabRef*)signal->getDataPtrSend();

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2009-04-17 19:02:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2009-09-15 09:41:24 +0000
@@ -32,10 +32,7 @@ DbtupProxy::DbtupProxy(Block_context& ct
 {
   // GSN_CREATE_TAB_REQ
   addRecSignal(GSN_CREATE_TAB_REQ, &DbtupProxy::execCREATE_TAB_REQ);
-
-  // GSN_DROP_TAB_REQ
   addRecSignal(GSN_DROP_TAB_REQ, &DbtupProxy::execDROP_TAB_REQ);
-  addRecSignal(GSN_DROP_TAB_CONF, &DbtupProxy::execDROP_TAB_CONF);
 
   // GSN_BUILD_INDX_IMPL_REQ
   addRecSignal(GSN_BUILD_INDX_IMPL_REQ, &DbtupProxy::execBUILD_INDX_IMPL_REQ);
@@ -101,71 +98,14 @@ DbtupProxy::execCREATE_TAB_REQ(Signal* s
   D("proxy: created table" << V(tableId));
 }
 
-// GSN_DROP_TAB_REQ
-
 void
 DbtupProxy::execDROP_TAB_REQ(Signal* signal)
 {
   const DropTabReq* req = (const DropTabReq*)signal->getDataPtr();
-  Uint32 ssId = getSsId(req);
-  Ss_DROP_TAB_REQ& ss = ssSeize<Ss_DROP_TAB_REQ>(ssId);
-  ss.m_req = *req;
-  ndbrequire(signal->getLength() == DropTabReq::SignalLength);
-  sendREQ(signal, ss);
-}
-
-void
-DbtupProxy::sendDROP_TAB_REQ(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-
-  DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
-  *req = ss.m_req;
-  req->senderRef = reference();
-  req->senderData = ssId; // redundant since tableId is used
-  sendSignal(workerRef(ss.m_worker), GSN_DROP_TAB_REQ,
-             signal, DropTabReq::SignalLength, JBB);
-}
-
-void
-DbtupProxy::execDROP_TAB_CONF(Signal* signal)
-{
-  const DropTabConf* conf = (const DropTabConf*)signal->getDataPtr();
-  Uint32 ssId = getSsId(conf);
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  recvCONF(signal, ss);
-}
-
-void
-DbtupProxy::sendDROP_TAB_CONF(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  BlockReference dictRef = ss.m_req.senderRef;
-
-  if (!lastReply(ss))
-    return;
-
-  if (ss.m_error == 0) {
-    jam();
-    DropTabConf* conf = (DropTabConf*)signal->getDataPtrSend();
-    conf->senderRef = reference();
-    conf->senderData = ss.m_req.senderData;
-    conf->tableId = ss.m_req.tableId;
-    sendSignal(dictRef, GSN_DROP_TAB_CONF,
-               signal, DropTabConf::SignalLength, JBB);
-    // for completeness (not needed for UNDO code)
-    const Uint32 tableId = conf->tableId;
-    // make sure to not crash for nothing
-    if (tableId < c_tableRecSize && c_tableRec[tableId] == 1) {
-      jam();
-      c_tableRec[tableId] = 0;
-      D("proxy: dropped table" << V(tableId));
-    }
-  } else {
-    ndbrequire(false);
-  }
-
-  ssRelease<Ss_DROP_TAB_REQ>(ssId);
+  const Uint32 tableId = req->tableId;
+  ndbrequire(tableId < c_tableRecSize);
+  c_tableRec[tableId] = 0;
+  D("proxy: dropped table" << V(tableId));
 }
 
 // GSN_BUILD_INDX_IMPL_REQ

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2009-04-17 19:02:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2009-09-15 09:41:24 +0000
@@ -43,30 +43,8 @@ protected:
 
   // GSN_CREATE_TAB_REQ
   void execCREATE_TAB_REQ(Signal*);
-
   // GSN_DROP_TAB_REQ
-  struct Ss_DROP_TAB_REQ : SsParallel {
-    DropTabReq m_req;
-    Ss_DROP_TAB_REQ() {
-      m_sendREQ = (SsFUNC)&DbtupProxy::sendDROP_TAB_REQ;
-      m_sendCONF = (SsFUNC)&DbtupProxy::sendDROP_TAB_CONF;
-    }
-    enum { poolSize = 1 };
-    static SsPool<Ss_DROP_TAB_REQ>& pool(LocalProxy* proxy) {
-      return ((DbtupProxy*)proxy)->c_ss_DROP_TAB_REQ;
-    }
-  };
-  SsPool<Ss_DROP_TAB_REQ> c_ss_DROP_TAB_REQ;
-  Uint32 getSsId(const DropTabReq* req) {
-    return SsIdBase | req->tableId;
-  }
-  Uint32 getSsId(const DropTabConf* conf) {
-    return SsIdBase | conf->tableId;
-  }
   void execDROP_TAB_REQ(Signal*);
-  void sendDROP_TAB_REQ(Signal*, Uint32 ssId);
-  void execDROP_TAB_CONF(Signal*);
-  void sendDROP_TAB_CONF(Signal*, Uint32 ssId);
 
   // GSN_BUILD_INDX_IMPL_REQ
   struct Ss_BUILD_INDX_IMPL_REQ : SsParallel {

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.cpp	2008-08-27 07:54:42 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.cpp	2009-09-15 09:41:24 +0000
@@ -23,10 +23,6 @@ DbtuxProxy::DbtuxProxy(Block_context& ct
   addRecSignal(GSN_ALTER_INDX_IMPL_REQ, &DbtuxProxy::execALTER_INDX_IMPL_REQ);
   addRecSignal(GSN_ALTER_INDX_IMPL_CONF, &DbtuxProxy::execALTER_INDX_IMPL_CONF);
   addRecSignal(GSN_ALTER_INDX_IMPL_REF, &DbtuxProxy::execALTER_INDX_IMPL_REF);
-
-  // GSN_DROP_TAB_REQ
-  addRecSignal(GSN_DROP_TAB_REQ, &DbtuxProxy::execDROP_TAB_REQ);
-  addRecSignal(GSN_DROP_TAB_CONF, &DbtuxProxy::execDROP_TAB_CONF);
 }
 
 DbtuxProxy::~DbtuxProxy()
@@ -110,63 +106,4 @@ DbtuxProxy::sendALTER_INDX_IMPL_CONF(Sig
   ssRelease<Ss_ALTER_INDX_IMPL_REQ>(ssId);
 }
 
-// GSN_DROP_TAB_REQ
-
-void
-DbtuxProxy::execDROP_TAB_REQ(Signal* signal)
-{
-  const DropTabReq* req = (const DropTabReq*)signal->getDataPtr();
-  Uint32 ssId = getSsId(req);
-  Ss_DROP_TAB_REQ& ss = ssSeize<Ss_DROP_TAB_REQ>(ssId);
-  ss.m_req = *req;
-  ndbrequire(signal->getLength() == DropTabReq::SignalLength);
-  sendREQ(signal, ss);
-}
-
-void
-DbtuxProxy::sendDROP_TAB_REQ(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-
-  DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
-  *req = ss.m_req;
-  req->senderRef = reference();
-  req->senderData = ssId; // redundant since tableId is used
-  sendSignal(workerRef(ss.m_worker), GSN_DROP_TAB_REQ,
-             signal, DropTabReq::SignalLength, JBB);
-}
-
-void
-DbtuxProxy::execDROP_TAB_CONF(Signal* signal)
-{
-  const DropTabConf* conf = (const DropTabConf*)signal->getDataPtr();
-  Uint32 ssId = getSsId(conf);
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  recvCONF(signal, ss);
-}
-
-void
-DbtuxProxy::sendDROP_TAB_CONF(Signal* signal, Uint32 ssId)
-{
-  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
-  BlockReference dictRef = ss.m_req.senderRef;
-
-  if (!lastReply(ss))
-    return;
-
-  if (ss.m_error == 0) {
-    jam();
-    DropTabConf* conf = (DropTabConf*)signal->getDataPtrSend();
-    conf->senderRef = reference();
-    conf->senderData = ss.m_req.senderData;
-    conf->tableId = ss.m_req.tableId;
-    sendSignal(dictRef, GSN_DROP_TAB_CONF,
-               signal, DropTabConf::SignalLength, JBB);
-  } else {
-    ndbrequire(false);
-  }
-
-  ssRelease<Ss_DROP_TAB_REQ>(ssId);
-}
-
 BLOCK_FUNCTIONS(DbtuxProxy)

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.hpp	2008-08-27 07:54:42 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxProxy.hpp	2009-09-15 09:41:24 +0000
@@ -47,30 +47,6 @@ protected:
   void execALTER_INDX_IMPL_CONF(Signal*);
   void execALTER_INDX_IMPL_REF(Signal*);
   void sendALTER_INDX_IMPL_CONF(Signal*, Uint32 ssId);
-
-  // GSN_DROP_TAB_REQ
-  struct Ss_DROP_TAB_REQ : SsParallel {
-    DropTabReq m_req;
-    Ss_DROP_TAB_REQ() {
-      m_sendREQ = (SsFUNC)&DbtuxProxy::sendDROP_TAB_REQ;
-      m_sendCONF = (SsFUNC)&DbtuxProxy::sendDROP_TAB_CONF;
-    }
-    enum { poolSize = 1 };
-    static SsPool<Ss_DROP_TAB_REQ>& pool(LocalProxy* proxy) {
-      return ((DbtuxProxy*)proxy)->c_ss_DROP_TAB_REQ;
-    }
-  };
-  SsPool<Ss_DROP_TAB_REQ> c_ss_DROP_TAB_REQ;
-  Uint32 getSsId(const DropTabReq* req) {
-    return SsIdBase | req->tableId;
-  }
-  Uint32 getSsId(const DropTabConf* conf) {
-    return SsIdBase | conf->tableId;
-  }
-  void execDROP_TAB_REQ(Signal*);
-  void sendDROP_TAB_REQ(Signal*, Uint32 ssId);
-  void execDROP_TAB_CONF(Signal*);
-  void sendDROP_TAB_CONF(Signal*, Uint32 ssId);
 };
 
 #endif


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090915094124-8415fg7e93flukc4.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:3003)Jonas Oreland15 Sep