List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:August 15 2008 11:03am
Subject:bzr push into mysql-5.1 branch (pekka:2716) WL#4391
View as plain text  
 2716 Pekka Nousiainen	2008-08-15
      wl#4391 13.diff
      sendpacked impl on VM level (fixes 02.diff) + misc reorg.
modified:
  storage/ndb/src/kernel/SimBlockList.cpp
  storage/ndb/src/kernel/blocks/LocalProxy.cpp
  storage/ndb/src/kernel/blocks/LocalProxy.hpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp
  storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp
  storage/ndb/src/kernel/main.cpp
  storage/ndb/src/kernel/vm/SimulatedBlock.cpp
  storage/ndb/src/kernel/vm/SimulatedBlock.hpp
  storage/ndb/src/kernel/vm/dummy_nonmt.cpp
  storage/ndb/src/kernel/vm/mt.cpp
  storage/ndb/src/kernel/vm/mt.hpp

=== modified file 'storage/ndb/src/kernel/SimBlockList.cpp'
--- a/storage/ndb/src/kernel/SimBlockList.cpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/SimBlockList.cpp	2008-08-15 11:01:41 +0000
@@ -43,6 +43,7 @@
 #include <DbtuxProxy.hpp>
 #include <BackupProxy.hpp>
 #include <RestoreProxy.hpp>
+#include <mt.hpp>
 
 #ifndef VM_TRACE
 #define NEW_BLOCK(B) new B
@@ -139,6 +140,15 @@ SimBlockList::load(EmulatorData& data){
   else
     theList[18] = NEW_BLOCK(RestoreProxy)(ctx);
   assert(NO_OF_BLOCKS == 19);
+
+  if (globalData.isNdbMt) {
+    add_main_thr_map();
+    if (globalData.isNdbMtLqh) {
+      Uint32 i;
+      for (i = 0; i < NO_OF_BLOCKS; i++)
+        theList[i]->loadWorkers();
+    }
+  }
 }
 
 void

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2008-08-11 11:39:17 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2008-08-15 11:01:41 +0000
@@ -24,7 +24,6 @@ LocalProxy::LocalProxy(BlockNumber block
 
   ndbrequire(instance() == 0); // this is main block
   c_workers = 0;
-  c_threads = 0;
   Uint32 i;
   for (i = 0; i < MaxWorkers; i++)
     c_worker[i] = 0;
@@ -184,22 +183,15 @@ LocalProxy::lastReply(const SsParallel& 
   return ss.m_workerMask.isclear();
 }
 
-// GSN_READ_CONFIG_REQ
+// load workers (before first signal)
 
 void
-LocalProxy::execREAD_CONFIG_REQ(Signal* signal)
+LocalProxy::loadWorkers()
 {
-  Ss_READ_CONFIG_REQ& ss = ssSeize<Ss_READ_CONFIG_REQ>();
-
-  const ReadConfigReq* req = (const ReadConfigReq*)signal->getDataPtr();
-  ss.m_req = *req;
-  ndbrequire(ss.m_req.noOfParameters == 0);
-
-  const Uint32 workers = globalData.ndbMtLqhWorkers;
-  const Uint32 threads = globalData.ndbMtLqhThreads;
+  c_workers = getLqhWorkers();
 
   Uint32 i;
-  for (i = 0; i < workers; i++) {
+  for (i = 0; i < c_workers; i++) {
     const Uint32 instanceNo = 1 + i;
     SimulatedBlock* worker = newWorker(instanceNo);
     ndbrequire(worker->instance() == instanceNo);
@@ -208,10 +200,18 @@ LocalProxy::execREAD_CONFIG_REQ(Signal* 
 
     add_lqh_worker_thr_map(number(), instanceNo);
   }
+}
 
-  // set after instances are created (sendpacked)
-  c_workers = workers;
-  c_threads = threads;
+// GSN_READ_CONFIG_REQ
+
+void
+LocalProxy::execREAD_CONFIG_REQ(Signal* signal)
+{
+  Ss_READ_CONFIG_REQ& ss = ssSeize<Ss_READ_CONFIG_REQ>();
+
+  const ReadConfigReq* req = (const ReadConfigReq*)signal->getDataPtr();
+  ss.m_req = *req;
+  ndbrequire(ss.m_req.noOfParameters == 0);
 
   // 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	2008-08-11 11:39:17 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.hpp	2008-08-15 11:01:41 +0000
@@ -45,10 +45,10 @@ protected:
   enum { MaxWorkers = MAX_NDBMT_LQH_WORKERS };
   typedef Bitmask<MaxWorkers> WorkerMask;
   Uint32 c_workers;
-  Uint32 c_threads;
   SimulatedBlock* c_worker[MaxWorkers];
 
   virtual SimulatedBlock* newWorker(Uint32 instanceNo) = 0;
+  virtual void loadWorkers();
 
   // worker index to worker ref
   BlockReference workerRef(Uint32 i) {

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2008-08-07 11:52:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2008-08-15 11:01:41 +0000
@@ -214,7 +214,7 @@ Dblqh::Dblqh(Block_context& ctx, Uint32 
   addRecSignal(GSN_DUMP_STATE_ORD, &Dblqh::execDUMP_STATE_ORD);
   addRecSignal(GSN_NODE_FAILREP, &Dblqh::execNODE_FAILREP);
   addRecSignal(GSN_CHECK_LCP_STOP, &Dblqh::execCHECK_LCP_STOP);
-  addRecSignal(GSN_SEND_PACKED, &Dblqh::execSEND_PACKED);
+  addRecSignal(GSN_SEND_PACKED, &Dblqh::execSEND_PACKED, true);
   addRecSignal(GSN_TUP_ATTRINFO, &Dblqh::execTUP_ATTRINFO);
   addRecSignal(GSN_READ_CONFIG_REQ, &Dblqh::execREAD_CONFIG_REQ, true);
   addRecSignal(GSN_LQHFRAGREQ, &Dblqh::execLQHFRAGREQ);

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2008-08-15 11:01:41 +0000
@@ -19,9 +19,6 @@
 DblqhProxy::DblqhProxy(Block_context& ctx) :
   LocalProxy(DBLQH, ctx)
 {
-  // GSN_SEND_PACKED
-  addRecSignal(GSN_SEND_PACKED, &DblqhProxy::execSEND_PACKED);
-
   // GSN_CREATE_TAB_REQ
   addRecSignal(GSN_CREATE_TAB_REQ, &DblqhProxy::execCREATE_TAB_REQ);
   addRecSignal(GSN_CREATE_TAB_CONF, &DblqhProxy::execCREATE_TAB_CONF);
@@ -72,19 +69,6 @@ DblqhProxy::newWorker(Uint32 instanceNo)
   return new Dblqh(m_ctx, instanceNo);
 }
 
-// GSN_SEND_PACKED
-
-void
-DblqhProxy::execSEND_PACKED(Signal* signal)
-{
-  Uint32 i;
-  for (i = 0; i < c_workers; i++) {
-    ndbrequire(c_worker[i] != 0);
-    Dblqh* dblqh = static_cast<Dblqh*>(c_worker[i]);
-    dblqh->execSEND_PACKED(signal);
-  }
-}
-
 // GSN_NDB_STTOR
 
 void

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp	2008-08-15 11:01:41 +0000
@@ -34,9 +34,6 @@ public:
 protected:
   virtual SimulatedBlock* newWorker(Uint32 instanceNo);
 
-  // GSN_SEND_PACKED
-  void execSEND_PACKED(Signal*);
-
   // GSN_NDB_STTOR
   virtual void callNDB_STTOR(Signal*);
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2008-08-11 11:30:18 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2008-08-15 11:01:41 +0000
@@ -208,7 +208,7 @@ Dbtc::Dbtc(Block_context& ctx):
   // Received signals
 
   addRecSignal(GSN_DUMP_STATE_ORD, &Dbtc::execDUMP_STATE_ORD);
-  addRecSignal(GSN_SEND_PACKED, &Dbtc::execSEND_PACKED);
+  addRecSignal(GSN_SEND_PACKED, &Dbtc::execSEND_PACKED, true);
   addRecSignal(GSN_SCAN_HBREP, &Dbtc::execSCAN_HBREP);
   addRecSignal(GSN_COMPLETED, &Dbtc::execCOMPLETED);
   addRecSignal(GSN_COMMITTED, &Dbtc::execCOMMITTED);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2008-08-11 11:44:42 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2008-08-15 11:01:41 +0000
@@ -65,7 +65,7 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* 
   addRecSignal(GSN_LCP_FRAG_ORD, &Dbtup::execLCP_FRAG_ORD);
 
   addRecSignal(GSN_DUMP_STATE_ORD, &Dbtup::execDUMP_STATE_ORD);
-  addRecSignal(GSN_SEND_PACKED, &Dbtup::execSEND_PACKED);
+  addRecSignal(GSN_SEND_PACKED, &Dbtup::execSEND_PACKED, true);
   addRecSignal(GSN_ATTRINFO, &Dbtup::execATTRINFO);
   addRecSignal(GSN_STTOR, &Dbtup::execSTTOR);
   addRecSignal(GSN_MEMCHECKREQ, &Dbtup::execMEMCHECKREQ);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.cpp	2008-08-15 11:01:41 +0000
@@ -19,8 +19,6 @@
 DbtupProxy::DbtupProxy(Block_context& ctx) :
   LocalProxy(DBTUP, ctx)
 {
-  addRecSignal(GSN_SEND_PACKED, &DbtupProxy::execSEND_PACKED);
-
   // GSN_DROP_TAB_REQ
   addRecSignal(GSN_DROP_TAB_REQ, &DbtupProxy::execDROP_TAB_REQ);
   addRecSignal(GSN_DROP_TAB_CONF, &DbtupProxy::execDROP_TAB_CONF);
@@ -36,18 +34,6 @@ DbtupProxy::newWorker(Uint32 instanceNo)
   return new Dbtup(m_ctx, 0, instanceNo);
 }
 
-// GSN_SEND_PACKED
-
-void
-DbtupProxy::execSEND_PACKED(Signal* signal)
-{
-  Uint32 i;
-  for (i = 0; i < c_workers; i++) {
-    Dbtup* dbtup = static_cast<Dbtup*>(c_worker[i]);
-    dbtup->execSEND_PACKED(signal);
-  }
-}
-
 // GSN_DROP_TAB_REQ
 
 void

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2008-08-11 11:53:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupProxy.hpp	2008-08-15 11:01:41 +0000
@@ -28,9 +28,6 @@ public:
 protected:
   virtual SimulatedBlock* newWorker(Uint32 instanceNo);
 
-  // GSN_SEND_PACKED
-  void execSEND_PACKED(Signal*);
-
   // GSN_DROP_TAB_REQ
   struct Ss_DROP_TAB_REQ : SsParallel {
     DropTabReq m_req;

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2008-08-15 11:01:41 +0000
@@ -320,6 +320,17 @@ get_multithreaded_config(EmulatorData& e
     return -1;
   }
 
+  // testing
+  {
+    const char* p;
+    p = NdbEnv_GetEnv("NDBMT_LQH_WORKERS", (char*)0, 0);
+    if (p != 0)
+      workers = atoi(p);
+    p = NdbEnv_GetEnv("NDBMT_LQH_THREADS", (char*)0, 0);
+    if (p != 0)
+      threads = atoi(p);
+  }
+
   ndbout << "NDBMT: workers=" << workers
          << " threads=" << threads << endl;
 
@@ -556,7 +567,7 @@ int main(int argc, char** argv)
 #endif
 #endif
 
-    // Load blocks
+  // Load blocks (both main and workers)
   globalEmulatorData.theSimBlockList->load(globalEmulatorData);
     
   // Set thread concurrency for Solaris' light weight processes

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.cpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp	2008-08-11 12:48:03 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp	2008-08-15 11:01:41 +0000
@@ -202,6 +202,7 @@ SimulatedBlock::installSimulatedBlockFun
   a[GSN_FSAPPENDREF]  = &SimulatedBlock::execFSAPPENDREF;
   a[GSN_NODE_START_REP] = &SimulatedBlock::execNODE_START_REP;
   a[GSN_API_START_REP] = &SimulatedBlock::execAPI_START_REP;
+  a[GSN_SEND_PACKED] = &SimulatedBlock::execSEND_PACKED;
 }
 
 void
@@ -1671,6 +1672,11 @@ SimulatedBlock::execAPI_START_REP(Signal
 {
 }
 
+void
+SimulatedBlock::execSEND_PACKED(Signal* signal)
+{
+}
+
 #ifdef VM_TRACE_TIME
 void
 SimulatedBlock::clearTimes() {

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2008-08-15 11:01:41 +0000
@@ -158,6 +158,7 @@ public:
     }
     return 0;
   }
+  virtual void loadWorkers() {}
 
   /* Setup state of a block object for executing in a particular thread. */
   void assignToThread(Uint32 threadId, EmulatedJamBuffer *jamBuffer,
@@ -169,6 +170,7 @@ public:
   /* Configuration based alternative.  Applies only to this node */
   static bool isNdbMt() { return globalData.isNdbMt; }
   static bool isNdbMtLqh() { return globalData.isNdbMtLqh; }
+  static Uint32 getLqhWorkers() { return globalData.ndbMtLqhWorkers; }
 
   /*
    * Instance key (1-4, even if not MT LQH) is set in receiver block ref.
@@ -577,6 +579,7 @@ protected:  
   void execSTOP_FOR_CRASH(Signal* signal);
   void execAPI_START_REP(Signal* signal);
   void execNODE_START_REP(Signal* signal);
+  void execSEND_PACKED(Signal* signal);
 private:
   /**
    * Node state

=== modified file 'storage/ndb/src/kernel/vm/dummy_nonmt.cpp'
--- a/storage/ndb/src/kernel/vm/dummy_nonmt.cpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/vm/dummy_nonmt.cpp	2008-08-15 11:01:41 +0000
@@ -8,6 +8,12 @@ add_thr_map(Uint32, Uint32, Uint32)
 }
 
 void
+add_main_thr_map()
+{
+  assert(false);
+}
+
+void
 add_lqh_worker_thr_map(Uint32, Uint32)
 {
   assert(false);

=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp	2008-08-15 11:01:41 +0000
@@ -47,6 +47,9 @@ static const Uint32 MAX_SIGNALS_PER_JB =
 #define NUM_MAIN_THREADS 2 // except receiver
 #define MAX_THREADS (NUM_MAIN_THREADS + MAX_NDBMT_LQH_THREADS + 1)
 
+/* If this is too small it crashes before first signal. */
+#define MAX_INSTANCES_PER_THREAD 16
+
 static Uint32 ndbmt_workers = 0;
 static Uint32 ndbmt_threads = 0;
 static Uint32 num_threads = 0;
@@ -520,6 +523,11 @@ struct thr_data
    * Used to quickly check if a node id is already in m_pending_send_nodes.
    */
   Bitmask<(MAX_NTRANSPORTERS+31)/32> m_pending_send_mask;
+
+  /* Block instances (main and worker) handled by this thread. */
+  /* Used for sendpacked (send-at-job-buffer-end). */
+  Uint32 m_instance_count;
+  BlockNumber m_instance_list[MAX_INSTANCES_PER_THREAD];
 };
 
 template<typename T>
@@ -1577,20 +1585,20 @@ thr_send_buf::forceSend(NodeId nodeId)
   return true;
 }
 
-static
-inline
-void
-sendpacked(struct thr_data* selfptr, Signal* signal, Uint32 thr_no)
+static void
+sendpacked(struct thr_data* thr_ptr, Signal* signal)
 {
-  SimulatedBlock* b_lqh = globalData.getBlock(DBLQH);
-  SimulatedBlock* b_tc = globalData.getBlock(DBTC);
-  SimulatedBlock* b_tup = globalData.getBlock(DBTUP);
-  if (thr_no == 1)
-    b_lqh->executeFunction(GSN_SEND_PACKED, signal);
-  if (thr_no == 0)
-    b_tc->executeFunction(GSN_SEND_PACKED, signal);
-  if (thr_no == 1)
-    b_tup->executeFunction(GSN_SEND_PACKED, signal);
+  Uint32 i;
+  for (i = 0; i < thr_ptr->m_instance_count; i++) {
+    BlockReference block = thr_ptr->m_instance_list[i];
+    Uint32 main = blockToMain(block);
+    Uint32 instance = blockToInstance(block);
+    SimulatedBlock* b = globalData.getBlock(main, instance);
+    // wl4391_todo remove useless assert
+    assert(b != 0 && b->getThreadId() == thr_ptr->m_thr_no);
+    /* b->send_at_job_buffer_end(); */
+    b->executeFunction(GSN_SEND_PACKED, signal);
+  }
 }
 
 /*
@@ -1870,44 +1878,51 @@ run_job_buffers(thr_data *selfptr, Signa
 struct thr_map_entry {
   enum { NULL_THR_NO = 0xFFFF };
   Uint32 thr_no;
-  SimulatedBlock* block;
-  thr_map_entry() : thr_no(NULL_THR_NO), block(0) {}
+  thr_map_entry() : thr_no(NULL_THR_NO) {}
 };
 
 static struct thr_map_entry thr_map[NO_OF_BLOCKS][MAX_BLOCK_INSTANCES];
 
 void
-add_thr_map(Uint32 block, Uint32 instance, Uint32 thr_no)
+add_thr_map(Uint32 main, Uint32 instance, Uint32 thr_no)
 {
-  Uint32 index = block - MIN_BLOCK_NO;
+  assert(main == blockToMain(main));
+  Uint32 index = main - MIN_BLOCK_NO;
   assert(index < NO_OF_BLOCKS);
   assert(instance < MAX_BLOCK_INSTANCES);
 
-  SimulatedBlock* main = globalData.getBlock(block);
-  assert(main != 0);
-  SimulatedBlock* b = main->getInstance(instance);
+  SimulatedBlock* b = globalData.getBlock(main, instance);
   assert(b != 0);
 
+  /* Block number including instance. */
+  Uint32 block = numberToBlock(main, instance);
+
   assert(thr_no < num_threads);
   struct thr_repository* rep = &g_thr_repository;
   thr_data* thr_ptr = rep->m_thread + thr_no;
 
+  /* Add to list. */
+  {
+    Uint32 i;
+    for (i = 0; i < thr_ptr->m_instance_count; i++)
+      assert(thr_ptr->m_instance_list[i] != block);
+  }
+  assert(thr_ptr->m_instance_count < MAX_INSTANCES_PER_THREAD);
+  thr_ptr->m_instance_list[thr_ptr->m_instance_count++] = block;
+
   b->assignToThread(thr_no, &thr_ptr->m_jam, &thr_ptr->m_watchdog_counter);
 
+  /* Create entry mapping block to thread. */
   thr_map_entry& entry = thr_map[index][instance];
   assert(entry.thr_no == thr_map_entry::NULL_THR_NO);
   entry.thr_no = thr_no;
-  entry.block = b;
 }
 
-// static assignment of main instances before first signal
-static void
+/* Static assignment of main instances (before first signal). */
+void
 add_main_thr_map()
 {
-  static int done = 0;
-  if (done++)
-    return;
-
+  /* Keep mt-classic assignments in MT LQH. */
   const Uint32 thr_GLOBAL = 0;
   const Uint32 thr_LOCAL = 1;
   const Uint32 thr_RECEIVER = receiver_thread_no;
@@ -1933,7 +1948,7 @@ add_main_thr_map()
   add_thr_map(RESTORE, 0, thr_LOCAL);
 }
 
-// workers added by LocalProxy
+/* Workers added by LocalProxy (before first signal). */
 void
 add_lqh_worker_thr_map(Uint32 block, Uint32 instance)
 {
@@ -2091,9 +2106,6 @@ mt_receiver_thread_main(void *thr_arg)
     Uint32 sum = run_job_buffers(selfptr, signal,
                                  &watchDogCounter, &thrSignalId);
 
-    watchDogCounter = 1;
-    sendpacked(selfptr, signal, thr_no);
-
     if (sum)
     {
       watchDogCounter = 6;
@@ -2155,7 +2167,7 @@ mt_job_thread_main(void *thr_arg)
     
     watchDogCounter = 1;
     signal->header.m_noOfSections = 0; /* valgrind */
-    sendpacked(selfptr, signal, thr_no);
+    sendpacked(selfptr, signal);
     
     if (sum)
     {
@@ -2558,6 +2570,10 @@ thr_init(struct thr_repository* rep, str
 
   selfptr->m_pending_send_count = 0;
   selfptr->m_pending_send_mask.clear();
+
+  selfptr->m_instance_count = 0;
+  for (i = 0; i < MAX_INSTANCES_PER_THREAD; i++)
+    selfptr->m_instance_list[i] = 0;
 }
 
 /* Have to do this after init of all m_in_queues is done. */
@@ -2646,8 +2662,6 @@ void ThreadConfig::ipControlLoop(Uint32 
   struct thr_repository* rep = &g_thr_repository;
   NdbThread *threads[MAX_THREADS];
 
-  add_main_thr_map();
-
   /*
    * Start threads for all execution threads, except for the receiver
    * thread, which runs in the main thread.
@@ -2687,8 +2701,6 @@ void ThreadConfig::ipControlLoop(Uint32 
 int
 ThreadConfig::doStart(NodeState::StartLevel startLevel)
 {
-  add_main_thr_map();
-
   SignalT<3> signalT;
   memset(&signalT.header, 0, sizeof(SignalHeader));
   

=== modified file 'storage/ndb/src/kernel/vm/mt.hpp'
--- a/storage/ndb/src/kernel/vm/mt.hpp	2008-08-11 11:21:36 +0000
+++ b/storage/ndb/src/kernel/vm/mt.hpp	2008-08-15 11:01:41 +0000
@@ -14,8 +14,9 @@
 */
 extern Uint32 receiverThreadId;
 
-/* Assign block instance to thread */
+/* Assign block instances to thread */
 void add_thr_map(Uint32 block, Uint32 instance, Uint32 thr_no);
+void add_main_thr_map();
 void add_lqh_worker_thr_map(Uint32 block, Uint32 instance);
 
 void sendlocal(Uint32 self, const struct SignalHeader *s,

Thread
bzr push into mysql-5.1 branch (pekka:2716) WL#4391Pekka Nousiainen15 Aug