List:Commits« Previous MessageNext Message »
From:jonas oreland Date:September 4 2011 5:35pm
Subject:bzr push into mysql-5.5-cluster branch (jonas.oreland:3457 to 3458)
View as plain text  
 3458 jonas oreland	2011-09-04 [merge]
      ndb - merge 71 to 55

    added:
      mysql-test/suite/ndb/ndb_config_threadconfig.ini
    modified:
      mysql-test/suite/ndb/r/ndb_config.result
      mysql-test/suite/ndb/t/ndb_config.test
      mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
      storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
      storage/ndb/src/kernel/vm/Configuration.cpp
      storage/ndb/src/kernel/vm/Configuration.hpp
      storage/ndb/src/kernel/vm/dummy_mt.cpp
      storage/ndb/src/kernel/vm/dummy_nonmt.cpp
      storage/ndb/src/kernel/vm/mt.cpp
      storage/ndb/src/kernel/vm/mt.hpp
      storage/ndb/src/kernel/vm/mt_thr_config.cpp
      storage/ndb/src/kernel/vm/mt_thr_config.hpp
      storage/ndb/src/mgmsrv/CMakeLists.txt
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
 3457 jonas oreland	2011-09-02 [merge]
      ndb - merge 70-spj into 55

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/t/ndb_join_pushdown.test
      sql/ha_ndbcluster_push.cc
=== added file 'mysql-test/suite/ndb/ndb_config_threadconfig.ini'
--- a/mysql-test/suite/ndb/ndb_config_threadconfig.ini	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/ndb_config_threadconfig.ini	2011-09-02 17:24:52 +0000
@@ -0,0 +1,36 @@
+[SYSTEM]
+Name=cluster1
+
+[ndbd default] 
+NoOfReplicas=1
+
+[ndbd] 
+NodeId=1
+LockExecuteThreadToCPU=0-3
+ThreadConfig: ldm={count=4}
+ 
+[ndbd] 
+NodeId=2
+LockExecuteThreadToCPU=4-8
+ThreadConfig: ldm={count=4,cpubind=0-3}
+
+[ndbd]
+NodeId=3
+MaxNoOfExecutionThreads=3
+ThreadConfig: ldm={count=4}
+
+[ndbd]
+NodeId=4
+LockExecuteThreadToCPU=0-3
+MaxNoOfExecutionThreads=7
+
+[ndbd]
+NodeId=5
+ThreadConfig: ldm,ldm
+
+[ndb_mgmd] 
+HostName= localhost 
+DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095    # 
+PortNumber= 10095 
+ 
+[mysqld]

=== modified file 'mysql-test/suite/ndb/r/ndb_config.result'
--- a/mysql-test/suite/ndb/r/ndb_config.result	2011-07-01 17:53:53 +0000
+++ b/mysql-test/suite/ndb/r/ndb_config.result	2011-09-04 17:04:25 +0000
@@ -41,3 +41,14 @@ tcp,3,4,55,3 tcp,3,5,55,3 tcp,3,6,55,3 t
 10485760 10485760 10485760 10485760 10485760
 1
 1
+== 21 == ThreadConfig
+ WARNING  -- at line 12: WARNING: Too few CPU's specified with LockExecuteThreadToCPU. Only 4 specified  but 7 was needed, this may cause contention.
+Assigning LQH threads round robin to CPU(s) and other threads will share CPU 0
+
+ WARNING  -- at line 17: Assigning each thread its own CPU
+
+ WARNING  -- at line 22: ThreadConfig overrides MaxNoOfExecutionThreads
+ WARNING  -- at line 27: WARNING: Too few CPU's specified with LockExecuteThreadToCPU. Only 4 specified  but 7 was needed, this may cause contention.
+Assigning LQH threads round robin to CPU(s) and other threads will share CPU 0
+
+6,, 7,, 1,0-3,ldm={count=4} 2,4-8,ldm={count=4,cpubind=0-3} 3,,ldm={count=4} 4,0-3,main={cpubind=0},ldm={cpubind=1},ldm={cpubind=2},ldm={cpubind=3},ldm={cpubind=1},recv={cpubind=0},rep={cpubind=0} 5,,ldm,ldm

=== modified file 'mysql-test/suite/ndb/t/ndb_config.test'
--- a/mysql-test/suite/ndb/t/ndb_config.test	2011-07-01 17:15:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_config.test	2011-09-02 17:24:52 +0000
@@ -69,3 +69,7 @@ echo == 19 == bug12712109;
 --exec $NDB_CONFIG --system --query=ConfigGenerationNumber
 # From a data node
 --exec $NDB_CONFIG --system --config-from-node=2 --query=ConfigGenerationNumber
+
+echo == 21 == ThreadConfig;
+--replace_regex /.*\[ndb_config\]//
+--exec $NDB_CONFIG --config-file=$MYSQL_TEST_DIR/suite/ndb/ndb_config_threadconfig.ini --query=NodeId,LockExecuteThreadToCPU,ThreadConfig 2>&1

=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc	2011-07-07 14:48:06 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc	2011-09-02 11:37:43 +0000
@@ -48,6 +48,9 @@ replace into test.t2 values (2, 1);
 --connection slave
 --echo -- Flushed to slave
 select * from test.t1 order by a;
+--disable_query_log
+FLUSH LOGS;
+--enable_query_log
 --sync_slave_with_master master
 --connection master
 --echo -- Flushed back to Master

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2011-09-02 09:16:56 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2011-09-04 17:33:04 +0000
@@ -1687,13 +1687,9 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal
   }
   if (arg == DumpStateOrd::CmvmiExecuteLockCPU)
   {
-    Uint32 exec_cpu_id = signal->theData[1];
-    globalEmulatorData.theConfiguration->executeLockCPU(exec_cpu_id);
   }
   if (arg == DumpStateOrd::CmvmiMaintLockCPU)
   {
-    Uint32 maint_cpu_id = signal->theData[1];
-    globalEmulatorData.theConfiguration->maintLockCPU(maint_cpu_id);
   }
   if (arg == DumpStateOrd::CmvmiSetRestartOnErrorInsert)
   {

=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp	2011-09-02 07:40:42 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp	2011-09-04 17:33:04 +0000
@@ -36,6 +36,7 @@
 #include <NdbEnv.h>
 
 #include <ndbapi_limits.h>
+#include "mt.hpp"
 
 #include <EventLogger.hpp>
 extern EventLogger * g_eventLogger;
@@ -74,8 +75,7 @@ Configuration::init(int _no_start, int _
   return true;
 }
 
-Configuration::Configuration() :
-  _executeLockCPU(NO_LOCK_CPU-1)
+Configuration::Configuration()
 {
   _fsPath = 0;
   _backupPath = 0;
@@ -341,26 +341,6 @@ Configuration::setupConfiguration(){
   _realtimeScheduler = 0;
   iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler);
 
-  const char * mask;
-  if(iter.get(CFG_DB_EXECUTE_LOCK_CPU, &mask) == 0)
-  {
-
-    int res = parse_mask(mask, _executeLockCPU);
-    if (res < 0)
-    {
-      // Could not parse LockExecuteThreadToCPU mask
-      g_eventLogger->warning("Failed to parse 'LockExecuteThreadToCPU=%s' "
-                             "(error: %d), ignoring it!",
-                             mask, res);
-      _executeLockCPU.clear();
-    }
-  }
-
-  _maintLockCPU = NO_LOCK_CPU;
-  iter.get(CFG_DB_MAINT_LOCK_CPU, &_maintLockCPU);
-  if (_maintLockCPU == 65535)
-    _maintLockCPU = NO_LOCK_CPU; // Ignore old default(may come from old mgmd)
-
   if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL, 
               &_timeBetweenWatchDogCheckInitial)){
     ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
@@ -394,41 +374,45 @@ Configuration::setupConfiguration(){
     _timeBetweenWatchDogCheckInitial = t;
   }
 
-  const char * thrconfigstring = NdbEnv_GetEnv("NDB_MT_THREAD_CONFIG",
-                                               (char*)0, 0);
-  if (thrconfigstring ||
-      iter.get(CFG_DB_MT_THREAD_CONFIG, &thrconfigstring) == 0)
-  {
-    int res = m_thr_config.do_parse(thrconfigstring);
-    if (res != 0)
-    {
-      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
-                "Invalid configuration fetched, invalid ThreadConfig",
-                m_thr_config.getErrorMessage());
-    }
-  }
-  else
+  const char * lockmask = 0;
   {
-    const char * mask;
-    if (iter.get(CFG_DB_EXECUTE_LOCK_CPU, &mask) == 0)
+    if (iter.get(CFG_DB_EXECUTE_LOCK_CPU, &lockmask) == 0)
     {
-      int res = m_thr_config.setLockExecuteThreadToCPU(mask);
+      int res = m_thr_config.setLockExecuteThreadToCPU(lockmask);
       if (res < 0)
       {
         // Could not parse LockExecuteThreadToCPU mask
         g_eventLogger->warning("Failed to parse 'LockExecuteThreadToCPU=%s' "
                                "(error: %d), ignoring it!",
-                               mask, res);
+                               lockmask, res);
       }
     }
+  }
 
+  {
     Uint32 maintCPU = NO_LOCK_CPU;
     iter.get(CFG_DB_MAINT_LOCK_CPU, &maintCPU);
     if (maintCPU == 65535)
       maintCPU = NO_LOCK_CPU; // Ignore old default(may come from old mgmd)
     if (maintCPU != NO_LOCK_CPU)
-      m_thr_config.setLockMaintThreadsToCPU(maintCPU);
+      m_thr_config.setLockIoThreadsToCPU(maintCPU);
+  }
 
+  const char * thrconfigstring = NdbEnv_GetEnv("NDB_MT_THREAD_CONFIG",
+                                               (char*)0, 0);
+  if (thrconfigstring ||
+      iter.get(CFG_DB_MT_THREAD_CONFIG, &thrconfigstring) == 0)
+  {
+    int res = m_thr_config.do_parse(thrconfigstring);
+    if (res != 0)
+    {
+      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
+                "Invalid configuration fetched, invalid ThreadConfig",
+                m_thr_config.getErrorMessage());
+    }
+  }
+  else
+  {
     Uint32 mtthreads = 0;
     iter.get(CFG_DB_MT_THREADS, &mtthreads);
 
@@ -454,13 +438,15 @@ Configuration::setupConfiguration(){
   }
   if (thrconfigstring)
   {
-    ndbout_c("ThreadConfig: input: %s parsed: %s",
+    ndbout_c("ThreadConfig: input: %s LockExecuteThreadToCPU: %s => parsed: %s",
              thrconfigstring,
+             lockmask ? lockmask : "",
              m_thr_config.getConfigString());
   }
   else
   {
-    ndbout_c("ThreadConfig (old ndb_mgmd): parsed: %s",
+    ndbout_c("ThreadConfig (old ndb_mgmd) LockExecuteThreadToCPU: %s => parsed: %s",
+             lockmask ? lockmask : "",
              m_thr_config.getConfigString());
   }
 
@@ -519,58 +505,6 @@ Configuration::realtimeScheduler(bool re
     setAllRealtimeScheduler();
 }
 
-Uint32
-Configuration::executeLockCPU() const
-{
-  unsigned res = _executeLockCPU.find(0);
-  if (res == _executeLockCPU.NotFound)
-    return NO_LOCK_CPU;
-  else
-    return res;
-}
-
-void
-Configuration::executeLockCPU(Uint32 value)
-{
-  if (value >= _executeLockCPU.max_size())
-  {
-    value = NO_LOCK_CPU;
-  }
-
-  bool changed = false;
-  if (value == NO_LOCK_CPU)
-  {
-    changed = _executeLockCPU.count() > 0;
-    _executeLockCPU.clear();
-  }
-  else
-  {
-    changed = _executeLockCPU.get(value) == false;
-    _executeLockCPU.clear();
-    _executeLockCPU.set(value);
-  }
-
-  if (changed)
-  {
-    setAllLockCPU(TRUE);
-  }
-}
-
-Uint32
-Configuration::maintLockCPU() const
-{
-  return _maintLockCPU;
-}
-
-void
-Configuration::maintLockCPU(Uint32 value)
-{
-  Uint32 old_value = _maintLockCPU;
-  _maintLockCPU = value;
-  if (value != old_value)
-    setAllLockCPU(FALSE);
-}
-
 int 
 Configuration::timeBetweenWatchDogCheck() const {
   return _timeBetweenWatchDogCheck;
@@ -1042,33 +976,31 @@ int
 Configuration::setLockCPU(NdbThread * pThread,
                           enum ThreadTypes type)
 {
-  Uint32 cpu_id;
-  int tid = NdbThread_GetTid(pThread);
-  if (tid == -1)
-    return 0;
-  /*
-    We ignore thread characteristics on platforms where we cannot
-    determine the thread id.
-    We only set new lock CPU characteristics for the threads for which
-    it has changed
-  */
-  if (type == MainThread)
-    cpu_id = executeLockCPU();
-  else
-    cpu_id = _maintLockCPU;
+  int res = 0;
+  if (type != MainThread)
+  {
+    res = m_thr_config.do_bind_io(pThread);
+  }
+  else if (!NdbIsMultiThreaded())
+  {
+    BlockNumber list[] = { CMVMI };
+    res = m_thr_config.do_bind(pThread, list, 1);
+  }
 
-  if (cpu_id != NO_LOCK_CPU)
+  if (res != 0)
   {
-    int error_no;
-    ndbout << "Lock threadId = " << tid;
-    ndbout << " to CPU id = " << cpu_id << endl;
-    if ((error_no = NdbThread_LockCPU(pThread, cpu_id)))
+    if (res > 0)
     {
-      ndbout << "Failed to lock CPU, error_no = " << error_no << endl;
-      ;//Warning, no permission to lock thread to CPU
+      ndbout << "Locked to CPU ok" << endl;
+      return 0;
+    }
+    else
+    {
+      ndbout << "Failed to lock CPU, error_no = " << (-res) << endl;
       return 1;
     }
   }
+
   return 0;
 }
 

=== modified file 'storage/ndb/src/kernel/vm/Configuration.hpp'
--- a/storage/ndb/src/kernel/vm/Configuration.hpp	2011-09-02 07:40:42 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp	2011-09-04 17:33:04 +0000
@@ -78,9 +78,6 @@ public:
 
   Uint32 executeLockCPU() const;
   void executeLockCPU(Uint32 value);
-  const SparseBitmask& getExecuteCpuMask() const {
-    return _executeLockCPU;
-  }
 
   Uint32 maintLockCPU() const;
   void maintLockCPU(Uint32 value);
@@ -138,8 +135,6 @@ private:
   Uint32 _schedulerExecutionTimer;
   Uint32 _schedulerSpinTimer;
   Uint32 _realtimeScheduler;
-  SparseBitmask _executeLockCPU;
-  Uint32 _maintLockCPU;
   Uint32 _timeBetweenWatchDogCheckInitial;
 
   Vector<struct ThreadInfo> threadInfo;

=== modified file 'storage/ndb/src/kernel/vm/dummy_mt.cpp'
--- a/storage/ndb/src/kernel/vm/dummy_mt.cpp	2011-01-30 23:13:49 +0000
+++ b/storage/ndb/src/kernel/vm/dummy_mt.cpp	2011-09-02 17:24:52 +0000
@@ -86,3 +86,8 @@ TimeQueue::~TimeQueue()
 {
 }
 
+bool
+NdbIsMultiThreaded()
+{
+  return true;
+}

=== modified file 'storage/ndb/src/kernel/vm/dummy_nonmt.cpp'
--- a/storage/ndb/src/kernel/vm/dummy_nonmt.cpp	2011-08-27 13:06:42 +0000
+++ b/storage/ndb/src/kernel/vm/dummy_nonmt.cpp	2011-09-04 17:33:04 +0000
@@ -54,3 +54,9 @@ compute_jb_pages(struct EmulatorData*)
 {
   return 0;
 }
+
+bool
+NdbIsMultiThreaded()
+{
+  return false;
+}

=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp	2011-09-02 09:16:56 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp	2011-09-04 17:33:04 +0000
@@ -2754,6 +2754,7 @@ init_thread(thr_data *selfptr)
       NdbSleep_MilliSleep(30);
   }
 
+  THRConfigApplier & conf = globalEmulatorData.theConfiguration->m_thr_config;
   BaseString tmp;
   tmp.appfmt("thr: %u ", thr_no);
 
@@ -2763,22 +2764,21 @@ init_thread(thr_data *selfptr)
     tmp.appfmt("tid: %u ", tid);
   }
 
-  if (selfptr->m_cpu != NO_LOCK_CPU)
+  conf.appendInfo(tmp,
+                  selfptr->m_instance_list, selfptr->m_instance_count);
+  int res = conf.do_bind(selfptr->m_thread,
+                         selfptr->m_instance_list, selfptr->m_instance_count);
+  if (res < 0)
   {
-    tmp.appfmt("cpu: %u ", selfptr->m_cpu);
-    int res = NdbThread_LockCPU(selfptr->m_thread, selfptr->m_cpu);
-    if (res == 0)
-    {
-      tmp.appfmt("OK ");
-    }
-    else
-    {
-      tmp.appfmt("err: %u ", res);
-    }
+    tmp.appfmt("err: %d ", -res);
+  }
+  else if (res > 0)
+  {
+    tmp.appfmt("OK ");
   }
 
   selfptr->m_thr_id = pthread_self();
-  
+
   for (Uint32 i = 0; i < selfptr->m_instance_count; i++) 
   {
     BlockReference block = selfptr->m_instance_list[i];
@@ -3499,109 +3499,13 @@ static
 void
 setcpuaffinity(struct thr_repository* rep)
 {
-  SparseBitmask mask =
-    globalEmulatorData.theConfiguration->getExecuteCpuMask();
-
-
-  bool mtlqh = globalData.ndbMtLqhThreads > 0;
-  unsigned cnt = mask.count();
-  if (cnt == 0)
-  {
-    return;
-  }
-
-  if (cnt < num_threads)
-  {
-    ndbout_c("WARNING: Too few CPU's specified with "
-             "LockExecuteThreadToCPU. Only %d specified "
-             " but %d was needed, this may cause contention.",
-             cnt, num_threads);
-  }
-
-  if (cnt >= num_threads)
-  {
-    ndbout_c("Assigning each thread its own CPU");
-    unsigned cpu = mask.find(0);
-    for (unsigned thr_no = 0; thr_no < num_threads; thr_no++)
-    {
-      rep->m_thread[thr_no].m_cpu = cpu;
-      cpu = mask.find(cpu + 1);
-    }
-  }
-  else if (cnt == 1)
-  {
-    unsigned cpu = mask.find(0);
-    ndbout_c("Assigning all threads to CPU %u", cpu);
-    for (unsigned thr_no = 0; thr_no < num_threads; thr_no++)
-    {
-      rep->m_thread[thr_no].m_cpu = cpu;
-    }
-  }
-  else if (mtlqh)
+  THRConfigApplier & conf = globalEmulatorData.theConfiguration->m_thr_config;
+  conf.create_cpusets();
+  if (conf.getInfoMessage())
   {
-    if (cnt > globalData.ndbMtLqhThreads)
-    {
-      /**
-       * let each LQH have it's own CPU and rest share...
-       */
-      ndbout_c("Assigning LQH threads to dedicated CPU(s) and "
-               "other threads will share remaining");
-      // LQH threads start with 2
-      unsigned cpu = mask.find(0);
-      for (unsigned thr_no = 2; thr_no < num_threads - 1; thr_no++)
-      {
-        rep->m_thread[thr_no].m_cpu = cpu;
-        mask.clear(cpu);
-        cpu = mask.find(cpu + 1);
-      }
-
-      cpu = mask.find(0);
-      rep->m_thread[0].m_cpu = cpu; // TC
-      rep->m_thread[1].m_cpu = cpu; // backup/suma
-      if ((cpu = mask.find(cpu + 1)) == mask.NotFound)
-      {
-        cpu = mask.find(0);
-      }
-      rep->m_thread[receiver_thread_no].m_cpu = cpu; // receiver
-    }
-    else
-    {
-      // put receiver, tc, backup/suma in 1 thread,
-      // and round robin LQH for rest
-      unsigned cpu = mask.find(0);
-      ndbout_c("Assigning LQH threads round robin to CPU(s) and "
-               "other threads will share CPU %u", cpu);
-      rep->m_thread[0].m_cpu = cpu; // TC
-      rep->m_thread[1].m_cpu = cpu; // backup/suma
-      rep->m_thread[receiver_thread_no].m_cpu = cpu; // receiver
-      mask.clear(cpu);
-      cpu = mask.find(0);
-      for (unsigned thr_no = 2; thr_no < num_threads - 1; thr_no++)
-      {
-        rep->m_thread[thr_no].m_cpu = cpu;
-        cpu = mask.find(cpu + 1);
-        if (cpu == mask.NotFound)
-        {
-          cpu = mask.find(0);
-        }
-      }
-    }
+    printf("%s", conf.getInfoMessage());
+    fflush(stdout);
   }
-  else
-  {
-    /**
-     * mt-classic and cnt > 1
-     */
-    require(num_threads == 3);
-    unsigned cpu = mask.find(0);
-    ndbout_c("Assigning LQH thread to CPU %u and "
-             "other threads will share", cpu);
-    rep->m_thread[1].m_cpu = cpu; // LQH
-    cpu = mask.find(cpu + 1);
-    rep->m_thread[0].m_cpu = cpu;
-    rep->m_thread[2].m_cpu = cpu;
-  }
-
 }
 
 void

=== modified file 'storage/ndb/src/kernel/vm/mt.hpp'
--- a/storage/ndb/src/kernel/vm/mt.hpp	2011-08-27 13:06:42 +0000
+++ b/storage/ndb/src/kernel/vm/mt.hpp	2011-09-04 17:33:04 +0000
@@ -59,6 +59,11 @@ void mt_section_lock();
 void mt_section_unlock();
 
 /**
+ * Are we (not) multi threaded
+ */
+bool NdbIsMultiThreaded();
+
+/**
  * Get list of BlockReferences so that
  *   each thread holding an instance of any block in blocks[] get "covered"
  *   (excluding ownThreadId

=== modified file 'storage/ndb/src/kernel/vm/mt_thr_config.cpp'
--- a/storage/ndb/src/kernel/vm/mt_thr_config.cpp	2011-08-30 14:13:15 +0000
+++ b/storage/ndb/src/kernel/vm/mt_thr_config.cpp	2011-09-04 08:52:42 +0000
@@ -19,6 +19,11 @@
 #include <kernel/ndb_limits.h>
 #include "../../common/util/parse_mask.hpp"
 
+#ifndef TEST_MT_THR_CONFIG
+#define SUPPORT_CPU_SET 0
+#else
+#define SUPPORT_CPU_SET 1
+#endif
 
 static const struct THRConfig::Entries m_entries[] =
 {
@@ -27,7 +32,7 @@ static const struct THRConfig::Entries m
   { "ldm",   THRConfig::T_LDM,   1, MAX_NDBMT_LQH_THREADS },
   { "recv",  THRConfig::T_RECV,  1, 1 },
   { "rep",   THRConfig::T_REP,   1, 1 },
-  { "maint", THRConfig::T_MAINT, 1, 1 }
+  { "io",    THRConfig::T_IO,    1, 1 }
 };
 
 static const struct THRConfig::Param m_params[] =
@@ -102,9 +107,9 @@ THRConfig::setLockExecuteThreadToCPU(con
 }
 
 int
-THRConfig::setLockMaintThreadsToCPU(unsigned val)
+THRConfig::setLockIoThreadsToCPU(unsigned val)
 {
-  m_LockMaintThreadsToCPU.set(val);
+  m_LockIoThreadsToCPU.set(val);
   return 0;
 }
 
@@ -131,8 +136,8 @@ THRConfig::do_parse(unsigned MaxNoOfExec
     m_classic = true;
     add(T_LDM);
     add(T_MAIN);
-    add(T_MAINT);
-    return 0;
+    add(T_IO);
+    return do_bindings();
   }
 
   Uint32 lqhthreads = 0;
@@ -160,7 +165,7 @@ THRConfig::do_parse(unsigned MaxNoOfExec
   add(T_MAIN);
   add(T_REP);
   add(T_RECV);
-  add(T_MAINT);
+  add(T_IO);
   for(Uint32 i = 0; i < lqhthreads; i++)
   {
     add(T_LDM);
@@ -172,16 +177,16 @@ THRConfig::do_parse(unsigned MaxNoOfExec
 int
 THRConfig::do_bindings()
 {
-  if (m_LockMaintThreadsToCPU.count() == 1)
+  if (m_LockIoThreadsToCPU.count() == 1)
   {
-    m_threads[T_MAINT][0].m_bind_type = T_Thread::B_CPU_BOUND;
-    m_threads[T_MAINT][0].m_bind_no = m_LockMaintThreadsToCPU.getBitNo(0);
+    m_threads[T_IO][0].m_bind_type = T_Thread::B_CPU_BOUND;
+    m_threads[T_IO][0].m_bind_no = m_LockIoThreadsToCPU.getBitNo(0);
   }
-  else if (m_LockMaintThreadsToCPU.count() > 1)
+  else if (m_LockIoThreadsToCPU.count() > 1)
   {
-    unsigned no = createCpuSet(m_LockMaintThreadsToCPU);
-    m_threads[T_MAINT][0].m_bind_type = T_Thread::B_CPUSET_BOUND;
-    m_threads[T_MAINT][0].m_bind_no = no;
+    unsigned no = createCpuSet(m_LockIoThreadsToCPU);
+    m_threads[T_IO][0].m_bind_type = T_Thread::B_CPUSET_BOUND;
+    m_threads[T_IO][0].m_bind_no = no;
   }
 
   /**
@@ -254,7 +259,7 @@ THRConfig::do_bindings()
     }
   }
 
-  if (m_threads[T_MAINT][0].m_bind_type == T_Thread::B_UNBOUND)
+  if (m_threads[T_IO][0].m_bind_type == T_Thread::B_UNBOUND)
   {
     /**
      * don't count this one...
@@ -286,7 +291,7 @@ THRConfig::do_bindings()
       unsigned no = 0;
       for (unsigned i = 0; i < NDB_ARRAY_SIZE(m_threads); i++)
       {
-        if (i == T_MAINT)
+        if (i == T_IO)
           continue;
         for (unsigned j = 0; j < m_threads[i].size(); j++)
         {
@@ -305,7 +310,7 @@ THRConfig::do_bindings()
       m_info_msg.appfmt("Assigning all threads to CPU %u\n", cpu);
       for (unsigned i = 0; i < NDB_ARRAY_SIZE(m_threads); i++)
       {
-        if (i == T_MAINT)
+        if (i == T_IO)
           continue;
         bind_unbound(m_threads[i], cpu);
       }
@@ -449,7 +454,7 @@ THRConfig::getConfigString()
     if (m_threads[i].size())
     {
       const char * name = getEntryName(i);
-      if (i != T_MAINT)
+      if (i != T_IO)
       {
         for (unsigned j = 0; j < m_threads[i].size(); j++)
         {
@@ -503,11 +508,11 @@ THRConfig::getConfigString()
 Uint32
 THRConfig::getThreadCount() const
 {
-  // Note! not counting T_MAINT
+  // Note! not counting T_IO
   Uint32 cnt = 0;
   for (Uint32 i = 0; i < NDB_ARRAY_SIZE(m_threads); i++)
   {
-    if (i != T_MAINT)
+    if (i != T_IO)
     {
       cnt += m_threads[i].size();
     }
@@ -531,12 +536,16 @@ THRConfig::getThreadCount(T_Type type) c
 const char *
 THRConfig::getErrorMessage() const
 {
+  if (m_err_msg.empty())
+    return 0;
   return m_err_msg.c_str();
 }
 
 const char *
 THRConfig::getInfoMessage() const
 {
+  if (m_info_msg.empty())
+    return 0;
   return m_info_msg.c_str();
 }
 
@@ -637,6 +646,12 @@ parseParams(char * str, ParamValue value
     unsigned idx = 0;
     for (; idx < NDB_ARRAY_SIZE(m_params); idx++)
     {
+
+#if ! SUPPORT_CPU_SET
+      if (idx == IX_CPUSET)
+        continue;
+#endif
+
       if (strncasecmp(str, m_params[idx].name, strlen(m_params[idx].name)) == 0)
       {
         str += strlen(m_params[idx].name);
@@ -869,6 +884,112 @@ THRConfig::createCpuSet(const SparseBitm
 template class Vector<SparseBitmask>;
 template class Vector<THRConfig::T_Thread>;
 
+#ifndef TEST_MT_THR_CONFIG
+#include <BlockNumbers.h>
+#include <NdbThread.h>
+
+static
+int
+findBlock(Uint32 blockNo, const unsigned short list[], unsigned cnt)
+{
+  for (Uint32 i = 0; i < cnt; i++)
+  {
+    if (blockToMain(list[i]) == blockNo)
+      return blockToInstance(list[i]);
+  }
+  return -1;
+}
+
+const THRConfig::T_Thread*
+THRConfigApplier::find_thread(const unsigned short instancelist[], unsigned cnt) const
+{
+  int instanceNo;
+  if ((instanceNo = findBlock(SUMA, instancelist, cnt)) >= 0)
+  {
+    return &m_threads[T_REP][instanceNo];
+  }
+  else if ((instanceNo = findBlock(CMVMI, instancelist, cnt)) >= 0)
+  {
+    return &m_threads[T_RECV][instanceNo];
+  }
+  else if ((instanceNo = findBlock(DBDIH, instancelist, cnt)) >= 0)
+  {
+    return &m_threads[T_MAIN][instanceNo];
+  }
+  else if ((instanceNo = findBlock(DBLQH, instancelist, cnt)) >= 0)
+  {
+    return &m_threads[T_LDM][instanceNo - 1]; // remove proxy...
+  }
+  return 0;
+}
+
+void
+THRConfigApplier::appendInfo(BaseString& str,
+                             const unsigned short list[], unsigned cnt) const
+{
+  const T_Thread* thr = find_thread(list, cnt);
+  assert(thr != 0);
+  str.appfmt("(%s) ", getEntryName(thr->m_type));
+  if (thr->m_bind_type == T_Thread::B_CPU_BOUND)
+  {
+    str.appfmt("cpu: %u ", thr->m_bind_no);
+  }
+  else if (thr->m_bind_type == T_Thread::B_CPUSET_BOUND)
+  {
+    str.appfmt("cpuset: [ %s ] ", m_cpu_sets[thr->m_bind_no].str().c_str());
+  }
+}
+
+int
+THRConfigApplier::create_cpusets()
+{
+  return 0;
+}
+
+int
+THRConfigApplier::do_bind(NdbThread* thread,
+                          const unsigned short list[], unsigned cnt)
+{
+  const T_Thread* thr = find_thread(list, cnt);
+  if (thr->m_bind_type == T_Thread::B_CPU_BOUND)
+  {
+    int res = NdbThread_LockCPU(thread, thr->m_bind_no);
+    if (res == 0)
+      return 1;
+    else
+      return -res;
+  }
+#if TODO
+  else if (thr->m_bind_type == T_Thread::B_CPUSET_BOUND)
+  {
+  }
+#endif
+
+  return 0;
+}
+
+int
+THRConfigApplier::do_bind_io(NdbThread* thread)
+{
+  const T_Thread* thr = &m_threads[T_IO][0];
+  if (thr->m_bind_type == T_Thread::B_CPU_BOUND)
+  {
+    int res = NdbThread_LockCPU(thread, thr->m_bind_no);
+    if (res == 0)
+      return 1;
+    else
+      return -res;
+  }
+#if TODO
+  else if (thr->m_bind_type == T_Thread::B_CPUSET_BOUND)
+  {
+  }
+#endif
+
+  return 0;
+}
+#endif
+
 #ifdef TEST_MT_THR_CONFIG
 
 #include <NdbTap.hpp>
@@ -959,8 +1080,8 @@ TAPTEST(mt_thr_config)
       "main={cpubind=1},ldm={cpubind=2},ldm={cpubind=3},ldm={cpubind=4},ldm={cpubind=2},recv={cpubind=1},rep={cpubind=1}",
 
       "1-8",
-      "ldm={count=4},maint={cpubind=8}",
-      "main={cpubind=1},ldm={cpubind=2},ldm={cpubind=3},ldm={cpubind=4},ldm={cpubind=5},recv={cpubind=6},rep={cpubind=7},maint={cpubind=8}",
+      "ldm={count=4},io={cpubind=8}",
+      "main={cpubind=1},ldm={cpubind=2},ldm={cpubind=3},ldm={cpubind=4},ldm={cpubind=5},recv={cpubind=6},rep={cpubind=7},io={cpubind=8}",
 
       "1-8",
       "ldm={count=4,cpubind=1,4,5,6}",

=== modified file 'storage/ndb/src/kernel/vm/mt_thr_config.hpp'
--- a/storage/ndb/src/kernel/vm/mt_thr_config.hpp	2011-08-30 12:00:48 +0000
+++ b/storage/ndb/src/kernel/vm/mt_thr_config.hpp	2011-09-02 17:24:52 +0000
@@ -42,7 +42,7 @@ public:
     T_LDM   = 1, /* LQH/ACC/TUP/TUX etc */
     T_RECV  = 2, /* CMVMI */
     T_REP   = 3, /* SUMA */
-    T_MAINT = 4, /* FS, SocketServer etc */
+    T_IO    = 4, /* FS, SocketServer etc */
 
     T_END  = 5
   };
@@ -52,7 +52,7 @@ public:
 
   // NOTE: needs to be called before do_parse
   int setLockExecuteThreadToCPU(const char * val);
-  int setLockMaintThreadsToCPU(unsigned val);
+  int setLockIoThreadsToCPU(unsigned val);
 
   int do_parse(const char * ThreadConfig);
   int do_parse(unsigned MaxNoOfExecutionThreads,
@@ -64,10 +64,10 @@ public:
   const char * getErrorMessage() const;
   const char * getInfoMessage() const;
 
-  Uint32 getThreadCount() const; // Don't count FS/MAINT thread
+  Uint32 getThreadCount() const; // Don't count FS/IO thread
   Uint32 getThreadCount(T_Type) const;
   Uint32 getMtClassic() const { return m_classic; }
-private:
+protected:
   struct T_Thread
   {
     unsigned m_type;
@@ -77,7 +77,7 @@ private:
   };
   bool m_classic;
   SparseBitmask m_LockExecuteThreadToCPU;
-  SparseBitmask m_LockMaintThreadsToCPU;
+  SparseBitmask m_LockIoThreadsToCPU;
   Vector<SparseBitmask> m_cpu_sets;
   Vector<T_Thread> m_threads[T_END];
 
@@ -122,7 +122,13 @@ class THRConfigApplier : public THRConfi
 {
 public:
   int create_cpusets();
-  int do_bind(unsigned t_type, unsigned no, NdbThread*);
+
+  void appendInfo(BaseString&, const unsigned short list[], unsigned cnt) const;
+  int do_bind(NdbThread*, const unsigned short list[], unsigned cnt);
+  int do_bind_io(NdbThread*);
+
+protected:
+  const T_Thread* find_thread(const unsigned short list[], unsigned cnt) const;
 };
 
 #endif // IPCConfig_H

=== modified file 'storage/ndb/src/mgmsrv/CMakeLists.txt'
--- a/storage/ndb/src/mgmsrv/CMakeLists.txt	2011-07-05 12:46:07 +0000
+++ b/storage/ndb/src/mgmsrv/CMakeLists.txt	2011-09-04 17:33:04 +0000
@@ -22,6 +22,7 @@ ADD_CONVENIENCE_LIBRARY(ndbconf
                Config.cpp
                ConfigInfo.cpp
                InitConfigFileParser.cpp
+               ${NDB_SOURCE_DIR}/src/kernel/vm/mt_thr_config.cpp
 )
 TARGET_LINK_LIBRARIES(ndbconf ndbmgmapi)
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2011-07-05 12:46:07 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2011-09-04 17:33:04 +0000
@@ -104,6 +104,7 @@ static bool fixBackupDataDir(InitConfigF
 static bool fixShmUniqueId(InitConfigFileParser::Context & ctx, const char * data);
 static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx, const char * data);
 static bool checkThreadPrioSpec(InitConfigFileParser::Context & ctx, const char * data);
+static bool checkThreadConfig(InitConfigFileParser::Context & ctx, const char * data);
 
 const ConfigInfo::SectionRule 
 ConfigInfo::m_SectionRules[] = {
@@ -166,6 +167,7 @@ ConfigInfo::m_SectionRules[] = {
   { DB_TOKEN,   fixBackupDataDir, 0 },
 
   { DB_TOKEN,   checkDbConstraints, 0 },
+  { DB_TOKEN,   checkThreadConfig, 0 },
 
   { API_TOKEN, checkThreadPrioSpec, 0 },
   { MGM_TOKEN, checkThreadPrioSpec, 0 },
@@ -1721,7 +1723,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "2",
+    "0",
     "2",
     "8"
   },
@@ -1766,6 +1768,19 @@ const ConfigInfo::ParamInfo ConfigInfo::
   },
 
   {
+    CFG_DB_MT_THREAD_CONFIG,
+    "ThreadConfig",
+    DB_TOKEN,
+    "Thread configuration",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    0,
+    0,
+    0
+  },
+
+  {
     CFG_DB_DD_FILESYSTEM_PATH,
     "FileSystemPathDD",
     DB_TOKEN,
@@ -4758,6 +4773,78 @@ checkThreadPrioSpec(InitConfigFileParser
   return true;
 }
 
+#include "../kernel/vm/mt_thr_config.hpp"
+
+static
+bool
+checkThreadConfig(InitConfigFileParser::Context & ctx, const char * unused)
+{
+  (void)unused;
+  Uint32 maxExecuteThreads = 0;
+  Uint32 lqhThreads = 0;
+  Uint32 classic = 0;
+  const char * thrconfig = 0;
+  const char * locktocpu = 0;
+
+  THRConfig tmp;
+  if (ctx.m_currentSection->get("LockExecuteThreadToCPU", &locktocpu))
+  {
+    tmp.setLockExecuteThreadToCPU(locktocpu);
+  }
+
+  ctx.m_currentSection->get("MaxNoOfExecutionThreads", &maxExecuteThreads);
+  ctx.m_currentSection->get("__ndbmt_lqh_threads", &lqhThreads);
+  ctx.m_currentSection->get("__ndbmt_classic", &classic);
+
+  if (ctx.m_currentSection->get("ThreadConfig", &thrconfig))
+  {
+    int ret = tmp.do_parse(thrconfig);
+    if (ret)
+    {
+      ctx.reportError("Unable to parse ThreadConfig: %s",
+                      tmp.getErrorMessage());
+      return false;
+    }
+
+    if (maxExecuteThreads)
+    {
+      ctx.reportWarning("ThreadConfig overrides MaxNoOfExecutionThreads");
+    }
+
+    if (lqhThreads)
+    {
+      ctx.reportWarning("ThreadConfig overrides __ndbmt_lqh_threads");
+    }
+
+    if (classic)
+    {
+      ctx.reportWarning("ThreadConfig overrides __ndbmt_classic");
+    }
+  }
+  else if (maxExecuteThreads || lqhThreads || classic)
+  {
+    int ret = tmp.do_parse(maxExecuteThreads, lqhThreads, classic);
+    if (ret)
+    {
+      ctx.reportError("Unable to set thread configuration: %s",
+                      tmp.getErrorMessage());
+      return false;
+    }
+  }
+
+  if (tmp.getInfoMessage())
+  {
+    ctx.reportWarning("%s", tmp.getInfoMessage());
+  }
+
+  if (thrconfig == 0)
+  {
+    ctx.m_currentSection->put("ThreadConfig", tmp.getConfigString());
+  }
+
+  return true;
+}
+
 /**
  * Connection rule: Check varius constraints
  */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (jonas.oreland:3457 to 3458) jonas oreland5 Sep