List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:March 16 2009 5:05pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (pekka:2952) Bug#43632
View as plain text  
#At file:///export/space/pekka/ndb/version/my51-wl4391/

 2952 Pekka Nousiainen	2009-03-16
      bug#43632 01.diff
      TUP proxy: for UNDO execution keep track of which tables exist
      modified:
        storage/ndb/src/kernel/blocks/LocalProxy.cpp
        storage/ndb/src/kernel/blocks/LocalProxy.hpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp
        storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2009-03-12 06:52:39 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2009-03-16 17:05:07 +0000
@@ -276,11 +276,24 @@ LocalProxy::loadWorkers()
 void
 LocalProxy::execREAD_CONFIG_REQ(Signal* signal)
 {
-  Ss_READ_CONFIG_REQ& ss = ssSeize<Ss_READ_CONFIG_REQ>();
+  Ss_READ_CONFIG_REQ& ss = ssSeize<Ss_READ_CONFIG_REQ>(1);
 
   const ReadConfigReq* req = (const ReadConfigReq*)signal->getDataPtr();
   ss.m_req = *req;
   ndbrequire(ss.m_req.noOfParameters == 0);
+  callREAD_CONFIG_REQ(signal);
+}
+
+void
+LocalProxy::callREAD_CONFIG_REQ(Signal* signal)
+{
+  backREAD_CONFIG_REQ(signal);
+}
+
+void
+LocalProxy::backREAD_CONFIG_REQ(Signal* signal)
+{
+  Ss_READ_CONFIG_REQ& ss = ssFind<Ss_READ_CONFIG_REQ>(1);
 
   // run sequentially due to big mallocs and initializations
   sendREQ(signal, ss);

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.hpp	2009-03-14 20:42:04 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.hpp	2009-03-16 17:05:07 +0000
@@ -318,6 +318,8 @@ protected:
   };
   SsPool<Ss_READ_CONFIG_REQ> c_ss_READ_CONFIG_REQ;
   void execREAD_CONFIG_REQ(Signal*);
+  virtual void callREAD_CONFIG_REQ(Signal*);
+  void backREAD_CONFIG_REQ(Signal*);
   void sendREAD_CONFIG_REQ(Signal*, Uint32 ssId);
   void execREAD_CONFIG_CONF(Signal*);
   void sendREAD_CONFIG_CONF(Signal*, Uint32 ssId);

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2009-03-13 07:49:42 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2009-03-16 17:05:07 +0000
@@ -192,6 +192,12 @@ DblqhProxy::sendCREATE_TAB_CONF(Signal* 
     conf->lqhConnectPtr = ssId;
     sendSignal(dictRef, GSN_CREATE_TAB_CONF,
                signal, CreateTabConf::SignalLength, JBB);
+
+    // inform DBTUP proxy
+    CreateTabReq* req = (CreateTabReq*)signal->getDataPtrSend();
+    *req = ss.m_req;
+    EXECUTE_DIRECT(DBTUP, GSN_CREATE_TAB_REQ,
+                   signal, CreateTabReq::SignalLength);
   } else {
     CreateTabRef* ref = (CreateTabRef*)signal->getDataPtrSend();
     ref->senderRef = reference();

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2008-11-16 15:32:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2009-03-16 17:05:07 +0000
@@ -23,8 +23,13 @@
 
 DbtupProxy::DbtupProxy(Block_context& ctx) :
   LocalProxy(DBTUP, ctx),
-  c_pgman(0)
+  c_pgman(0),
+  c_tableRecSize(0),
+  c_tableRec(0)
 {
+  // 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);
@@ -45,6 +50,26 @@ DbtupProxy::newWorker(Uint32 instanceNo)
   return new Dbtup(m_ctx, instanceNo);
 }
 
+// GSN_READ_CONFIG_REQ
+void
+DbtupProxy::callREAD_CONFIG_REQ(Signal* signal)
+{
+  const ReadConfigReq* req = (const ReadConfigReq*)signal->getDataPtr();
+  ndbrequire(req->noOfParameters == 0);
+
+  const ndb_mgm_configuration_iterator * p = 
+    m_ctx.m_config.getOwnConfigIterator();
+  ndbrequire(p != 0);
+  
+  ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_TABLE, &c_tableRecSize));
+  c_tableRec = (Uint8*)allocRecord("TableRec", sizeof(Uint8), c_tableRecSize);
+  D("proxy:" << V(c_tableRecSize));
+  Uint32 i;
+  for (i = 0; i < c_tableRecSize; i++)
+    c_tableRec[i] = 0;
+  backREAD_CONFIG_REQ(signal);
+}
+
 // GSN_STTOR
 
 void
@@ -60,6 +85,19 @@ DbtupProxy::callSTTOR(Signal* signal)
   backSTTOR(signal);
 }
 
+// GSN_CREATE_TAB_REQ
+
+void
+DbtupProxy::execCREATE_TAB_REQ(Signal* signal)
+{
+  const CreateTabReq* req = (const CreateTabReq*)signal->getDataPtr();
+  const Uint32 tableId = req->tableId;
+  ndbrequire(tableId < c_tableRecSize);
+  ndbrequire(c_tableRec[tableId] == 0);
+  c_tableRec[tableId] = 1;
+  D("proxy: created table" << V(tableId));
+}
+
 // GSN_DROP_TAB_REQ
 
 void
@@ -112,6 +150,14 @@ DbtupProxy::sendDROP_TAB_CONF(Signal* si
     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);
   }
@@ -297,7 +343,6 @@ DbtupProxy::disk_restart_undo(Signal* si
      * Page request goes to the extra PGMAN worker (our thread).
      * TUP worker reads same page again via another PGMAN worker.
      * MT-LGMAN is planned, do not optimize (pass page) now
-     * wl4391 todo - extra worker to free unlocked pages after SR
      */
     Page_cache_client pgman(this, c_pgman);
     Page_cache_client::Request req;
@@ -348,6 +393,12 @@ DbtupProxy::disk_restart_undo_callback(S
       undo.m_table_id = page->m_table_id;
       undo.m_fragment_id = page->m_fragment_id;
       D("proxy: callback" << V(undo.m_table_id) << V(undo.m_fragment_id));
+      const Uint32 tableId = undo.m_table_id;
+      if (tableId >= c_tableRecSize || c_tableRec[tableId] == 0) {
+        D("proxy: table dropped" << V(tableId));
+        undo.m_actions |= Proxy_undo::NoExecute;
+        undo.m_actions |= Proxy_undo::SendUndoNext;
+      }
     }
   }
 
@@ -421,6 +472,12 @@ int
 DbtupProxy::disk_restart_alloc_extent(Uint32 tableId, Uint32 fragId, 
                                       const Local_key* key, Uint32 pages)
 {
+  if (tableId >= c_tableRecSize || c_tableRec[tableId] == 0) {
+    jam();
+    D("proxy: table dropped" << V(tableId));
+    return -1;
+  }
+
   // local call so mapping instance key to number is ok
   Uint32 instanceKey = getInstanceKey(tableId, fragId);
   Uint32 instanceNo = getInstanceFromKey(instanceKey);
@@ -434,6 +491,8 @@ void
 DbtupProxy::disk_restart_page_bits(Uint32 tableId, Uint32 fragId,
                                    const Local_key* key, Uint32 bits)
 {
+  ndbrequire(tableId < c_tableRecSize && c_tableRec[tableId] == 1);
+
   // local call so mapping instance key to number is ok
   Uint32 instanceKey = getInstanceKey(tableId, fragId);
   Uint32 instanceNo = getInstanceFromKey(instanceKey);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2008-11-16 15:32:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2009-03-16 17:05:07 +0000
@@ -17,6 +17,7 @@
 #define NDB_DBTUP_PROXY
 
 #include <LocalProxy.hpp>
+#include <signaldata/CreateTab.hpp>
 #include <signaldata/DropTab.hpp>
 #include <signaldata/BuildIndxImpl.hpp>
 
@@ -31,9 +32,18 @@ protected:
 
   class Pgman* c_pgman; // PGMAN proxy
 
+  Uint32 c_tableRecSize;
+  Uint8* c_tableRec;    // bool => table exists
+
+  // GSN_READ_CONFIG_REQ
+  virtual void callREAD_CONFIG_REQ(Signal*);
+
   // GSN_STTOR
   virtual void callSTTOR(Signal*);
 
+  // GSN_CREATE_TAB_REQ
+  void execCREATE_TAB_REQ(Signal*);
+
   // GSN_DROP_TAB_REQ
   struct Ss_DROP_TAB_REQ : SsParallel {
     DropTabReq m_req;

Thread
bzr commit into mysql-5.1-telco-7.0 branch (pekka:2952) Bug#43632Pekka Nousiainen16 Mar