List:Commits« Previous MessageNext Message »
From:Monty Taylor Date:January 16 2007 10:26pm
Subject:bk commit into 5.1 tree (mtaylor:1.2383)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mtaylor. When mtaylor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-16 14:26:46-08:00, mtaylor@qualinost.(none) +32 -0
  Merge qualinost.(none):/home/mtaylor/src/mysql-5.1-maint
  into  qualinost.(none):/home/mtaylor/client/current/myspace/mysql-5.1.12-dolphin
  MERGE: 1.2303.4.24

  BUILD/Makefile.am@stripped, 2007-01-16 13:50:54-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.11.1.1

  config/ac-macros/ha_ndbcluster.m4@stripped, 2007-01-16 13:50:54-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.19.1.1

  configure.in@stripped, 2007-01-16 13:50:54-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.385.2.2

  libmysqld/Makefile.am@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.101.1.1

  libmysqld/examples/Makefile.am@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.35.1.1

  sql/Makefile.am@stripped, 2007-01-16 14:26:42-08:00, mtaylor@qualinost.(none) +0 -0
    merging dolphin patch for local work.
    MERGE: 1.162.2.1

  storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.11.1.1

  storage/ndb/include/mgmapi/mgmapi_config_parameters.h@stripped, 2007-01-16 14:26:42-08:00, mtaylor@qualinost.(none) +1 -2
    merging dolphin patch for local work.
    MERGE: 1.28.2.1

  storage/ndb/include/mgmapi/ndb_logevent.h@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.8.1.1

  storage/ndb/include/portlib/NdbThread.h@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.6.1.1

  storage/ndb/include/portlib/NdbTick.h@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.3.1.1

  storage/ndb/include/transporter/TransporterCallback.hpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.4.1.1

  storage/ndb/src/common/debugger/EventLogger.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.27.1.1

  storage/ndb/src/common/debugger/signaldata/SignalNames.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.14.1.1

  storage/ndb/src/common/portlib/NdbThread.c@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.31.1.1

  storage/ndb/src/common/transporter/SCI_Transporter.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.11.1.1

  storage/ndb/src/common/transporter/SCI_Transporter.hpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.6.1.1

  storage/ndb/src/common/transporter/TransporterRegistry.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.65.2.1

  storage/ndb/src/common/util/SocketServer.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.22.1.1

  storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp@stripped, 2007-01-16 14:26:42-08:00, mtaylor@qualinost.(none) +16 -2
    merging dolphin patch for local work.
    MERGE: 1.32.4.1

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-01-16 14:26:42-08:00, mtaylor@qualinost.(none) +0 -2
    merging dolphin patch for local work.
    MERGE: 1.103.2.1

  storage/ndb/src/kernel/blocks/lgman.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.19.2.1

  storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.35.1.1

  storage/ndb/src/kernel/main.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.60.1.1

  storage/ndb/src/kernel/vm/Configuration.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.51.1.1

  storage/ndb/src/kernel/vm/Configuration.hpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.19.1.1

  storage/ndb/src/kernel/vm/FastScheduler.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.9.1.1

  storage/ndb/src/kernel/vm/FastScheduler.hpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.4.1.1

  storage/ndb/src/kernel/vm/ThreadConfig.cpp@stripped, 2007-01-16 14:26:42-08:00, mtaylor@qualinost.(none) +20 -0
    merging dolphin patch for local work.
    MERGE: 1.4.1.1

  storage/ndb/src/kernel/vm/WatchDog.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.5.1.1

  storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.90.3.1

  storage/ndb/src/ndbapi/TransporterFacade.cpp@stripped, 2007-01-16 13:50:55-08:00, mtaylor@qualinost.(none) +0 -0
    Auto merged
    MERGE: 1.52.3.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mtaylor
# Host:	qualinost.(none)
# Root:	/home/mtaylor/client/current/myspace/mysql-5.1.12-dolphin/RESYNC

--- 1.412/configure.in	2007-01-16 14:26:52 -08:00
+++ 1.413/configure.in	2007-01-16 14:26:52 -08:00
@@ -1866,6 +1866,8 @@
   pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
   pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
   pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
+  pthread_self sched_get_priority_min sched_get_priority_max \
+  sched_setaffinity processor_bind sched_setscheduler \
   pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
   realpath rename rint rwlock_init setupterm \
   shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
@@ -1887,6 +1889,47 @@
  *) AC_CHECK_FUNCS(clock_gettime)
     ;;
 esac
+#checking for Linux Scheduling Support
+AC_MSG_CHECKING(for Linux scheduling support)
+AC_TRY_LINK(
+  [#include <sys/types.h>
+   #include <linux/unistd.h>
+   #include <sched.h>
+   _syscall0(pid_t,gettid)],
+  [const struct sched_param *p= (const struct sched_param*)0;
+   pid_t tid = gettid();
+   int ret = sched_setaffinity(tid, 0, p);],
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_LINUX_SCHEDULING, [1], [Linux scheduling function]),
+  AC_MSG_RESULT(no))
+
+#checking for Locking CPU support
+AC_MSG_CHECKING(for Linux affinity support)
+AC_TRY_LINK(
+  [#include <sys/types.h>
+   #include <linux/unistd.h>
+   #include <sched.h>
+   _syscall0(pid_t,gettid)],
+  [unsigned long *mask = (unsigned long *)0;
+   pid_t tid = gettid();
+   int ret = sched_setaffinity(tid, sizeof(unsigned long), mask);],
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_LINUX_AFFINITY, [1], [Linux affinity function]),
+  AC_MSG_RESULT(no))
+
+AC_MSG_CHECKING(for Solaris affinity support)
+AC_TRY_LINK(
+  [#include <sys/types.h>
+   #include <sys/lwp.h>
+   #include <sys/processor.h>
+   #include <sys/procset.h>],
+  [processor_id_t *pid = (processor_id_t *)0;
+   processor_id_t cpu_id = (processor_id_t)0;
+   id_t tid = _lw_self();
+   int ret = processor_bind(P_LWPID, tid, cpu_id, bind);],
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_SOLARIS_AFFINITY, [1], [Solaris affinity function]),
+  AC_MSG_RESULT(no))
 
 # isinf() could be a function or a macro (HPUX)
 AC_MSG_CHECKING(for isinf with <math.h>)

--- 1.170/sql/Makefile.am	2007-01-16 14:26:52 -08:00
+++ 1.171/sql/Makefile.am	2007-01-16 14:26:52 -08:00
@@ -33,6 +33,8 @@
 			$(top_builddir)/mysys/libmysys.a \
 			$(top_builddir)/dbug/libdbug.a \
 			$(top_builddir)/regex/libregex.a \
+			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ \
+                        @NDB_SCI_LIBS@
 			$(top_builddir)/strings/libmystrings.a
 mysqld_DEPENDENCIES=	@mysql_plugin_libs@ $(SUPPORTING_LIBS)
 LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@

--- 1.21/config/ac-macros/ha_ndbcluster.m4	2007-01-16 14:26:52 -08:00
+++ 1.22/config/ac-macros/ha_ndbcluster.m4	2007-01-16 14:26:52 -08:00
@@ -43,7 +43,7 @@
       if test -f "$mysql_sci_dir/lib/libsisci.a" -a \ 
               -f "$mysql_sci_dir/include/sisci_api.h"; then
         NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
-        NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
+        NDB_SCI_LIBS="$mysql_sci_dir/lib/libsisci.a"
         AC_MSG_RESULT([-- including sci transporter])
         AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
                   [Including Ndb Cluster DB sci transporter])

--- 1.23/storage/ndb/src/kernel/blocks/lgman.cpp	2007-01-16 14:26:52 -08:00
+++ 1.24/storage/ndb/src/kernel/blocks/lgman.cpp	2007-01-16 14:26:52 -08:00
@@ -467,7 +467,8 @@
 }
 
 void
-Lgman::execCREATE_FILE_REQ(Signal* signal){
+Lgman::execCREATE_FILE_REQ(Signal* signal)
+{
   jamEntry();
   CreateFileImplReq* req= (CreateFileImplReq*)signal->getDataPtr();
   
@@ -496,6 +497,7 @@
     switch(requestInfo){
     case CreateFileImplReq::Commit:
     {
+      jam();
       ndbrequire(find_file_by_id(file_ptr, ptr.p->m_meta_files, req->file_id));
       file_ptr.p->m_create.m_senderRef = req->senderRef;
       file_ptr.p->m_create.m_senderData = req->senderData;
@@ -508,6 +510,7 @@
       Uint32 senderData = req->senderData;
       if (find_file_by_id(file_ptr, ptr.p->m_meta_files, req->file_id))
       {
+        jam();
 	file_ptr.p->m_create.m_senderRef = senderRef;
 	file_ptr.p->m_create.m_senderData = senderData;
 	create_file_abort(signal, ptr, file_ptr);
@@ -515,11 +518,11 @@
       else
       {
 	CreateFileImplConf* conf= (CreateFileImplConf*)signal->getDataPtr();
+        jam();
 	conf->senderData = senderData;
 	conf->senderRef = reference();
 	sendSignal(senderRef, GSN_CREATE_FILE_CONF, signal, 
 		   CreateFileImplConf::SignalLength, JBB);
-	return;
       }
       return;
     }

--- 1.31/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2007-01-16 14:26:52 -08:00
+++ 1.32/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2007-01-16 14:26:52 -08:00
@@ -111,7 +111,12 @@
 #define CFG_DB_CHECKPOINT_SPEED       164
 #define CFG_DB_CHECKPOINT_SPEED_SR    165
 
-#define CFG_DB_MEMREPORT_FREQUENCY    166
+#define CFG_DB_SCHED_EXEC_TIME        166
+#define CFG_DB_SCHED_SPIN_TIME        167
+#define CFG_DB_REALTIME_SCHEDULER     170
+#define CFG_DB_EXECUTE_LOCK_CPU       171
+#define CFG_DB_MAINT_LOCK_CPU         172
+#define CFG_DB_MEMREPORT_FREQUENCY    176
 
 #define CFG_DB_SGA                    198 /* super pool mem */
 #define CFG_DB_DATA_MEM_2             199 /* used in special build in 5.1 */

--- 1.13/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2007-01-16 14:26:52 -08:00
+++ 1.14/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2007-01-16 14:26:52 -08:00
@@ -71,6 +71,11 @@
     NdbfsDumpAllFiles = 401,
     NdbfsDumpOpenFiles = 402,
     NdbfsDumpIdleFiles = 403,
+    CmvmiSchedulerExecutionTimer = 502,
+    CmvmiRealtimeScheduler = 503,
+    CmvmiExecuteLockCPU = 504,
+    CmvmiMaintLockCPU = 505,
+    CmvmiSchedulerSpinTimer = 506,
     // 1222-1225 DICT
     LqhDumpAllDefinedTabs = 1332,
     LqhDumpNoLogPages = 1333,

--- 1.7/storage/ndb/include/portlib/NdbThread.h	2007-01-16 14:26:52 -08:00
+++ 1.8/storage/ndb/include/portlib/NdbThread.h	2007-01-16 14:26:52 -08:00
@@ -34,6 +34,46 @@
 typedef void* NDB_THREAD_ARG;
 typedef size_t NDB_THREAD_STACKSIZE;
 
+#ifdef HAVE_LINUX_AFFINITY
+  typedef pid_t NDB_TID_TYPE;
+#else
+#ifdef HAVE_SOLARIS_AFFINITY
+  typedef id_t NDB_TID_TYPE;
+#else
+  typedef int NDB_TID_TYPE;
+#endif
+#endif
+
+#ifdef HAVE_LINUX_SCHEDULING
+  typedef pid_t NDB_THAND_TYPE;
+#else
+#ifdef HAVE_PTHREAD_SELF
+  typedef pthread_t NDB_THAND_TYPE;
+#else
+  typedef int NDB_THAND_TYPE;
+#endif
+#endif
+
+/**
+ * Three functions that are used in conjunctions with SocketClient
+ * threads and SocketServer threads. In the NDB kernel they are
+ * used to set real-time properties and lock threads to CPU's. In
+ * the NDB API they are dummy subroutines.
+ * add_thread_id is used before starting run method in thread.
+ * remove_thread_id is called immediately after returning from
+ * run-method in thread.
+ * fill_thread_object is called before calling add_thread_id to
+ * prepare parameters.
+ */
+void*
+add_thread_id(void *param);
+
+void*
+remove_thread_id(void *param);
+
+void
+fill_thread_object(void *param, uint *len, bool server);
+
 struct NdbThread;
 
 /*
@@ -59,6 +99,18 @@
 		      const char* p_thread_name,
                       NDB_THREAD_PRIO thread_prio);
 
+struct NdbThread* NdbThread_CreateWithFunc(NDB_THREAD_FUNC *p_thread_func,
+                      NDB_THREAD_ARG *p_thread_arg,
+  		      const NDB_THREAD_STACKSIZE thread_stack_size,
+		      const char* p_thread_name,
+                      NDB_THREAD_PRIO thread_prio,
+                      NDB_THREAD_FUNC *start_func,
+                      NDB_THREAD_ARG start_obj,
+                      size_t start_obj_len,
+                      NDB_THREAD_FUNC *end_func,
+                      NDB_THREAD_ARG end_obj,
+                      size_t end_obj_len);
+
 /**
  * Destroy a thread
  *  Deallocates memory for thread
@@ -92,6 +144,26 @@
  */
 int NdbThread_SetConcurrencyLevel(int level);
 
+/**
+ * Get thread id
+ */
+NDB_TID_TYPE Ndb_getThreadId();
+
+/**
+ * Get thread handle
+ */
+NDB_THAND_TYPE Ndb_getThreadHandle();
+
+/**
+ * Set Scheduler for pid
+ */
+int Ndb_SetScheduler(NDB_THAND_TYPE threadHandle, bool rt_prio,
+                     bool high_prio);
+
+/**
+ * Lock Thread to CPU
+ */
+int Ndb_LockCPU(NDB_TID_TYPE threadId, Uint32 cpu_id);
 
 #ifdef	__cplusplus
 }

--- 1.5/storage/ndb/include/portlib/NdbTick.h	2007-01-16 14:26:52 -08:00
+++ 1.6/storage/ndb/include/portlib/NdbTick.h	2007-01-16 14:26:52 -08:00
@@ -37,7 +37,7 @@
  */
 int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
 
-  /*#define TIME_MEASUREMENT*/
+#define TIME_MEASUREMENT
 #ifdef TIME_MEASUREMENT
 
 struct MicroSecondTimer {

--- 1.5/storage/ndb/include/transporter/TransporterCallback.hpp	2007-01-16 14:26:52 -08:00
+++ 1.6/storage/ndb/include/transporter/TransporterCallback.hpp	2007-01-16 14:26:52 -08:00
@@ -33,7 +33,7 @@
 /** 
  * Call back functions 
  */ 
- 
+
 /** 
  * The execute function 
  */ 

--- 1.31/storage/ndb/src/common/debugger/EventLogger.cpp	2007-01-16 14:26:52 -08:00
+++ 1.32/storage/ndb/src/common/debugger/EventLogger.cpp	2007-01-16 14:26:52 -08:00
@@ -556,6 +556,12 @@
 		       "Mean loop Counter in doJob last 8192 times = %u",
 		       theData[1]);
 }
+void getTextThreadConfigLoop(QQQQ) {
+  BaseString::snprintf(m_text, m_text_len, 
+  "8192 loops,tot %u usec,exec %u extra:loops = %u,time %u,const %u",
+		       theData[1], theData[3], theData[4], theData[5],
+                       theData[2]);
+}
 void getTextSendBytesStatistic(QQQQ) {
   BaseString::snprintf(m_text, m_text_len, 
 		       "Mean send size to Node = %d last 4096 sends = %u bytes",
@@ -896,6 +902,7 @@
   ROW(OperationReportCounters, LogLevel::llStatistic,   8, Logger::LL_INFO ), 
   ROW(TableCreated,            LogLevel::llStatistic,   7, Logger::LL_INFO ),
   ROW(JobStatistic,            LogLevel::llStatistic,   9, Logger::LL_INFO ),
+  ROW(ThreadConfigLoop,        LogLevel::llStatistic,   9, Logger::LL_INFO ),
   ROW(SendBytesStatistic,      LogLevel::llStatistic,   9, Logger::LL_INFO ),
   ROW(ReceiveBytesStatistic,   LogLevel::llStatistic,   9, Logger::LL_INFO ),
   ROW(MemoryUsage,             LogLevel::llStatistic,   5, Logger::LL_INFO ),

--- 1.16/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp	2007-01-16 14:26:52 -08:00
+++ 1.17/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp	2007-01-16 14:26:52 -08:00
@@ -626,6 +626,14 @@
   ,{ GSN_LCP_PREPARE_REF,  "LCP_PREPARE_REF" }
   ,{ GSN_LCP_PREPARE_CONF, "LCP_PREPARE_CONF" }
 
+  ,{ GSN_DICT_ABORT_REQ,  "DICT_ABORT_REQ" }
+  ,{ GSN_DICT_ABORT_REF,  "DICT_ABORT_REF" }
+  ,{ GSN_DICT_ABORT_CONF, "DICT_ABORT_CONF" }
+
+  ,{ GSN_DICT_COMMIT_REQ,  "DICT_COMMIT_REQ" }
+  ,{ GSN_DICT_COMMIT_REF,  "DICT_COMMIT_REF" }
+  ,{ GSN_DICT_COMMIT_CONF, "DICT_COMMIT_CONF" }
+
   /* DICT LOCK */
   ,{ GSN_DICT_LOCK_REQ,          "DICT_LOCK_REQ" }
   ,{ GSN_DICT_LOCK_CONF,         "DICT_LOCK_CONF" }

--- 1.94/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2007-01-16 14:26:52 -08:00
+++ 1.95/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2007-01-16 14:26:52 -08:00
@@ -548,6 +548,42 @@
     STR_VALUE(MAX_INT_RNIL) },
 
   {
+    CFG_DB_EXECUTE_LOCK_CPU,
+    "LockExecuteThreadToCPU",
+    DB_TOKEN,
+    "CPU ID indicating which CPU will run the execution thread",
+    ConfigInfo::CI_USED,
+    true,
+    ConfigInfo::CI_INT,
+    "65535",
+    "0",
+    "65535" },
+
+  {
+    CFG_DB_MAINT_LOCK_CPU,
+    "LockMaintThreadsToCPU",
+    DB_TOKEN,
+    "CPU ID indicating which CPU will run the maintenance threads",
+    ConfigInfo::CI_USED,
+    true,
+    ConfigInfo::CI_INT,
+    "65535",
+    "0",
+    "65535" },
+
+  {
+    CFG_DB_REALTIME_SCHEDULER,
+    "RealtimeScheduler",
+    DB_TOKEN,
+    "If yes, then NDB Cluster threads will be scheduled as real-time threads",
+    ConfigInfo::CI_USED,
+    true,
+    ConfigInfo::CI_BOOL,
+    "false",
+    "false",
+    "true" },
+
+  {
     CFG_DB_MEMLOCK,
     "LockPagesInMainMemory",
     DB_TOKEN,
@@ -570,6 +606,30 @@
     "6000",
     "70",
     STR_VALUE(MAX_INT_RNIL) },
+
+  {
+    CFG_DB_SCHED_EXEC_TIME,
+    "SchedulerExecutionTimer",
+    DB_TOKEN,
+    "Number of microseconds to execute in scheduler before sending",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "50",
+    "0",
+    "11000" },
+
+  {
+    CFG_DB_SCHED_SPIN_TIME,
+    "SchedulerSpinTimer",
+    DB_TOKEN,
+    "Number of microseconds to execute in scheduler before sleeping",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    "11000" },
 
   {
     CFG_DB_STOP_ON_ERROR,

--- 1.33/storage/ndb/src/common/portlib/NdbThread.c	2007-01-16 14:26:52 -08:00
+++ 1.34/storage/ndb/src/common/portlib/NdbThread.c	2007-01-16 14:26:52 -08:00
@@ -19,6 +19,21 @@
 #include <my_pthread.h>
 #include <NdbMem.h>
 
+#ifdef HAVE_LINUX_AFFINITY
+#include <sys/types.h>
+#include <linux/unistd.h>
+#include <sched.h>
+
+_syscall0(pid_t,gettid)
+#endif
+
+#ifdef HAVE_SOLARIS_AFFINITY
+#include <sys/types.h>
+#include <sys/lwp.h>
+#include <sys/processor.h>
+#include <sys/procset.h>
+#endif
+
 #define MAX_THREAD_NAME 16
 
 /*#define USE_PTHREAD_EXTRAS*/
@@ -33,9 +48,13 @@
   char thread_name[MAX_THREAD_NAME];
   NDB_THREAD_FUNC * func;
   void * object;
+  NDB_THREAD_FUNC *start_func;
+  NDB_THREAD_FUNC *end_func;
+  bool same_start_end_object;
+  char start_object[128];
+  char end_object[128];
 };
 
-
 #ifdef NDB_SHM_TRANSPORTER
 void NdbThread_set_shm_sigmask(my_bool block)
 {
@@ -78,7 +97,16 @@
     {
       void *ret;
       struct NdbThread * ss = (struct NdbThread *)_ss;
+      if (ss->start_func)
+        (*ss->start_func)(ss->start_object);
       ret= (* ss->func)(ss->object);
+      if (ss->end_func)
+      {
+        if (ss->same_start_end_object)
+          (*ss->end_func)(ss->start_object);
+        else
+          (*ss->end_func)(ss->end_object);
+      }
       DBUG_POP();
       NdbThread_Exit(ret);
     }
@@ -94,6 +122,23 @@
 		      const char* p_thread_name,
                       NDB_THREAD_PRIO thread_prio)
 {
+  return NdbThread_CreateWithFunc(p_thread_func, p_thread_arg, _thread_stack_size,
+                                  p_thread_name, thread_prio,
+                                  NULL, NULL, 0, NULL, NULL, 0);
+}
+                      
+struct NdbThread* NdbThread_CreateWithFunc(NDB_THREAD_FUNC *p_thread_func,
+                      NDB_THREAD_ARG *p_thread_arg,
+  		      const NDB_THREAD_STACKSIZE _thread_stack_size,
+		      const char* p_thread_name,
+                      NDB_THREAD_PRIO thread_prio,
+                      NDB_THREAD_FUNC *start_func,
+                      NDB_THREAD_ARG start_obj,
+                      size_t start_obj_len,
+                      NDB_THREAD_FUNC *end_func,
+                      NDB_THREAD_ARG end_obj,
+                      size_t end_obj_len)
+{
   struct NdbThread* tmpThread;
   int result;
   pthread_attr_t thread_attr;
@@ -114,6 +159,15 @@
 
   strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name));
 
+  tmpThread->start_func = start_func;
+  memcpy(tmpThread->start_object, start_obj, start_obj_len);
+  tmpThread->end_func = end_func;
+  memcpy(tmpThread->end_object, end_obj, end_obj_len);
+  if (start_obj == end_obj)
+    tmpThread->same_start_end_object = TRUE;
+  else
+    tmpThread->same_start_end_object = FALSE;
+
   pthread_attr_init(&thread_attr);
 #ifdef PTHREAD_STACK_MIN
   if (thread_stack_size < PTHREAD_STACK_MIN)
@@ -190,3 +244,193 @@
   return 0;
 #endif
 }
+
+NDB_TID_TYPE
+Ndb_getThreadId()
+{
+#ifdef HAVE_LINUX_AFFINITY
+  pid_t tid = gettid();
+  if (tid == (pid_t)-1)
+  {
+    /*
+      This extra check is from suggestion by Kristian Nielsen
+      to handle cases when running binaries on LinuxThreads
+      compiled with NPTL threads
+    */
+    tid = getpid();
+  }
+  return tid;
+#else
+#ifdef HAVE_SOLARIS_AFFINITY
+  id_t tid;
+  tid = _lw_self();
+  return tid;
+#else
+  return 0;
+#endif
+#endif
+}
+
+NDB_THAND_TYPE
+Ndb_getThreadHandle()
+{
+#ifdef HAVE_LINUX_SCHEDULING
+  pid_t tid = gettid();
+  if (tid == (pid_t)-1)
+    tid = getpid();
+  return tid;
+#else
+#ifdef HAVE_PTHREAD_SELF
+  return pthread_self();
+#else
+  return 0;
+#endif
+#endif
+}
+
+static int
+get_max_prio(int policy)
+{
+  int max_prio;
+#ifdef HAVE_SCHED_GET_PRIORITY_MAX
+  max_prio = sched_get_priority_max(policy);
+#else
+  max_prio = 90;
+#endif
+  return max_prio;
+}
+
+static int
+get_min_prio(int policy)
+{
+  int min_prio;
+#ifdef HAVE_SCHED_GET_PRIORITY_MIN
+  min_prio = sched_get_priority_min(policy);
+#else
+  min_prio = 1;
+#endif
+  return min_prio;
+}
+
+static int
+get_prio(bool rt_prio, bool high_prio, int policy)
+{
+  int prio, min_prio, max_prio;
+  if (!rt_prio)
+    return 0;
+  max_prio = get_max_prio(policy);
+  min_prio = get_min_prio(policy);
+  if (high_prio)
+    prio = min_prio + 3;
+  else
+    prio = min_prio + 1;
+  if (prio < min_prio)
+    prio = min_prio;
+  return prio;
+}
+
+int
+Ndb_SetScheduler(NDB_THAND_TYPE threadHandle, bool rt_prio,
+                 bool high_prio)
+{
+  int policy, prio, error_no= 0;
+#ifdef HAVE_LINUX_SCHEDULING
+  int ret;
+  struct sched_param loc_sched_param;
+  if (rt_prio)
+  {
+    policy = SCHED_RR;
+    prio = get_prio(rt_prio, high_prio, policy);
+  }
+  else
+  {
+    policy = SCHED_OTHER;
+    prio = 0;
+  }
+  memset((char*)&loc_sched_param, sizeof(loc_sched_param), 0);
+  loc_sched_param.sched_priority = prio;
+  ret= sched_setscheduler(threadHandle, policy, &loc_sched_param);
+  if (ret)
+    error_no= errno;
+#else
+#ifdef HAVE_PTHREAD_SET_SCHEDPARAM
+  /*
+    This variant is POSIX compliant so should be useful on most
+    Operating Systems supporting real-time scheduling.
+  */
+  int ret;
+  struct sched_param loc_sched_param;
+  if (rt_prio)
+  {
+    policy = SCHED_RR;
+    prio = get_prio(rt_prio, high_prio, policy);
+  }
+  else
+  {
+    policy = SCHED_OTHER;
+    prio = 0;
+  }
+  memset((char*)&loc_sched_param, sizeof(loc_sched_param), 0);
+  loc_sched_param.sched_priority = prio;
+  ret= pthread_setschedparam(threadHandle, policy, &loc_sched_param);
+  if (ret)
+    error_no= errno;
+#endif
+#endif
+  return error_no;
+}
+
+int
+Ndb_LockCPU(NDB_TID_TYPE threadId, Uint32 cpu_id)
+{
+  int error_no= 0;
+#ifdef HAVE_LINUX_AFFINITY
+  /*
+    On recent Linux versions the ability to set processor
+    affinity is available through the sched_setaffinity call.
+    In Linux this is possible to do on thread level so we can
+    lock execution thread to one CPU and the rest of the threads
+    to another CPU.
+
+    By combining Real-time Scheduling and Locking to CPU we can
+    achieve more or less a realtime system for NDB Cluster.
+  */
+  int ret;
+  ulong bitmask = 0;
+  uint no_bits = sizeof(ulong)*8;
+  if (cpu_id >= no_bits)
+    return 0; /* cpu_id out of range for this to work */
+  bitmask = (1 << cpu_id);
+  ret= sched_setaffinity(threadId, sizeof(ulong),
+                         (const cpu_set_t *)&bitmask);
+  if (ret)
+    error_no= errno;
+#else
+#ifdef HAVE_SOLARIS_AFFINITY
+  /*
+    Solaris have a number of versions to lock threads to CPU's.
+    We'll use the processor_bind interface since we only work
+    with single threads and bind those to CPU's.
+    A bit unclear as whether the id returned by pthread_self
+    is the LWP id.
+  */
+  int ret;
+  ret= processor_bind(P_LWPID, threadId, cpu_id, NULL); 
+  if (ret)
+    error_no= errno;
+#else
+#ifdef WIN32
+  /*
+    Windows can currently as far I found out only lock processes
+    to CPU's, thus it cannot be used to support the desirable
+    feture here. So we ignore the call on Windows for the moment.
+  */
+  return error_no;
+#else
+  return error_no;
+#endif
+#endif
+#endif
+  return error_no;
+}
+

--- 1.12/storage/ndb/src/common/transporter/SCI_Transporter.cpp	2007-01-16 14:26:52 -08:00
+++ 1.13/storage/ndb/src/common/transporter/SCI_Transporter.cpp	2007-01-16 14:26:52 -08:00
@@ -65,13 +65,10 @@
  
    
   m_initLocal=false; 
-  m_swapCounter=0; 
   m_failCounter=0; 
   m_remoteNodes[0]=remoteSciNodeId0; 
   m_remoteNodes[1]=remoteSciNodeId1; 
   m_adapters = nAdapters;   
-  // The maximum number of times to try and create,  
-  // start and destroy a sequence 
   m_ActiveAdapterId=0; 
   m_StandbyAdapterId=1; 
   
@@ -102,8 +99,6 @@
   DBUG_VOID_RETURN;
 } 
  
- 
- 
 void SCI_Transporter::disconnectImpl() 
 { 
   DBUG_ENTER("SCI_Transporter::disconnectImpl");
@@ -129,7 +124,8 @@
       
       if(err != SCI_ERR_OK)  { 
 	report_error(TE_SCI_UNABLE_TO_CLOSE_CHANNEL); 
-        DBUG_PRINT("error", ("Cannot close channel to the driver. Error code 0x%x",  
+        DBUG_PRINT("error",
+        ("Cannot close channel to the driver. Error code 0x%x",  
 		    err)); 
       } 
     } 
@@ -164,19 +160,18 @@
   m_sendBuffer.m_buffer = new Uint32[m_sendBuffer.m_sendBufferSize / 4];
   m_sendBuffer.m_dataSize = 0;
  
-  DBUG_PRINT("info", ("Created SCI Send Buffer with buffer size %d and packet size %d",
+  DBUG_PRINT("info",
+  ("Created SCI Send Buffer with buffer size %d and packet size %d",
               m_sendBuffer.m_sendBufferSize, m_PacketSize * 4));
   if(!getLinkStatus(m_ActiveAdapterId) ||  
      (m_adapters > 1 &&
      !getLinkStatus(m_StandbyAdapterId))) { 
-    DBUG_PRINT("error", ("The link is not fully operational. Check the cables and the switches")); 
-    //reportDisconnect(remoteNodeId, 0); 
-    //doDisconnect(); 
+    DBUG_PRINT("error",
+    ("The link is not fully operational. Check the cables and the switches")); 
     //NDB should terminate 
     report_error(TE_SCI_LINK_ERROR); 
     DBUG_RETURN(false); 
   } 
-  
   DBUG_RETURN(true); 
 } // initTransporter()  
 
@@ -235,7 +230,8 @@
       DBUG_PRINT("info", ("SCInode iD %d  adapter %d\n",  
 	         sciAdapters[i].localSciNodeId, i)); 
       if(err != SCI_ERR_OK) { 
-        DBUG_PRINT("error", ("Cannot open an SCI virtual device. Error code 0x%x", 
+        DBUG_PRINT("error",
+        ("Cannot open an SCI virtual device. Error code 0x%x", 
 		   err)); 
 	DBUG_RETURN(err); 
       } 
@@ -269,7 +265,8 @@
 		      &err); 
      
     if(err != SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
+      DBUG_PRINT("error",
+    ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
                   err)); 
       DBUG_RETURN(err); 
     } 
@@ -303,15 +300,13 @@
 			   &err); 
      
     if(err != SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Local Segment is not available for remote connections. Error code 0x%x\n",
+      DBUG_PRINT("error",
+   ("Local Segment is not available for remote connections. Error code 0x%x\n",
                  err)); 
       DBUG_RETURN(err); 
     } 
   } 
-  
-  
   setupLocalSegment(); 
-  
   DBUG_RETURN(err); 
    
 } // initLocalSegment() 
@@ -343,12 +338,6 @@
     if(sizeToSend==4097) 
       i4097++; 
 #endif
-    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Start sequence failed")); 
-      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-      return false; 
-    } 
-    
       
   tryagain:
     retry++;
@@ -374,119 +363,36 @@
 		SCI_FLAG_ERROR_CHECK, 
 		&err);   
       
-      
       if (err != SCI_ERR_OK) { 
-      if(err == SCI_ERR_OUT_OF_RANGE) { 
-        DBUG_PRINT("error", ("Data transfer : out of range error")); 
-	goto tryagain; 
-      } 
-      if(err == SCI_ERR_SIZE_ALIGNMENT) { 
-        DBUG_PRINT("error", ("Data transfer : alignment error")); 
-        DBUG_PRINT("info", ("sendPtr 0x%x, sizeToSend = %d", sendPtr, sizeToSend));
-	goto tryagain; 
-      } 
-      if(err == SCI_ERR_OFFSET_ALIGNMENT) { 
-        DBUG_PRINT("error", ("Data transfer : offset alignment")); 
-	goto tryagain; 
-      }   
-      if(err == SCI_ERR_TRANSFER_FAILED) { 
-	//(m_TargetSegm[m_StandbyAdapterId].writer)->heavyLock(); 
-	if(getLinkStatus(m_ActiveAdapterId)) { 
-	  goto tryagain; 
-	}
-        if (m_adapters == 1) {
-          DBUG_PRINT("error", ("SCI Transfer failed"));
+        if (err == SCI_ERR_OUT_OF_RANGE ||
+            err == SCI_ERR_SIZE_ALIGNMENT ||
+            err == SCI_ERR_OFFSET_ALIGNMENT) { 
+          DBUG_PRINT("error", ("Data transfer error = %d", err));
           report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
 	  return false; 
-        }
-	m_failCounter++; 
-	Uint32 temp=m_ActiveAdapterId;	    	     
-	switch(m_swapCounter) { 
-	case 0:  
-	  /**swap from active (0) to standby (1)*/ 
-	  if(getLinkStatus(m_StandbyAdapterId)) { 
-            DBUG_PRINT("error", ("Swapping from adapter 0 to 1")); 
+        } 
+        if(err == SCI_ERR_TRANSFER_FAILED) { 
+	  if(getLinkStatus(m_ActiveAdapterId))
+	    goto tryagain; 
+          if (m_adapters == 1) {
+            DBUG_PRINT("error", ("SCI Transfer failed"));
+            report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
+	    return false; 
+          }
+	  m_failCounter++; 
+	  Uint32 temp=m_ActiveAdapterId;	    	     
+	  if (getLinkStatus(m_StandbyAdapterId)) { 
 	    failoverShmWriter();		 
 	    SCIStoreBarrier(m_TargetSegm[m_StandbyAdapterId].sequence,0); 
 	    m_ActiveAdapterId=m_StandbyAdapterId; 
 	    m_StandbyAdapterId=temp; 
-	    SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence),
-			      FLAGS,  
-			      &err); 
-	    if(err!=SCI_ERR_OK) { 
-	      report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE); 
-              DBUG_PRINT("error", ("Unable to remove sequence"));
-	      return false; 
-	    } 
-	    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Start sequence failed")); 
-	      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-	      return false; 
-	    } 
-	    m_swapCounter++; 
-            DBUG_PRINT("info", ("failover complete")); 
-	    goto tryagain; 
-	  }  else {
-	    report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
-            DBUG_PRINT("error", ("SCI Transfer failed")); 
-	    return false;
-	  }
-	  return false; 
-	  break; 
-	case 1: 
-	  /** swap back from 1 to 0 
-	      must check that the link is up */ 
-	  
-	  if(getLinkStatus(m_StandbyAdapterId)) { 
-	    failoverShmWriter(); 
-	    m_ActiveAdapterId=m_StandbyAdapterId; 
-	    m_StandbyAdapterId=temp; 
-            DBUG_PRINT("info", ("Swapping from 1 to 0"));	 
-	    if(createSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to create sequence"));
-	      report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE); 
-	      return false; 
-	    } 
-	    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("startSequence failed... disconnecting")); 
-	      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-	      return false; 
-	    } 
-	    
-	    SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence) 
-			      , FLAGS,  
-			      &err); 
-	    if(err!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to remove sequence"));
-	      report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE); 
-	      return false;
-	    } 
-	    
-	    if(createSequence(m_StandbyAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to create sequence on standby"));
-	      report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE); 
-	      return false; 
-	    } 
-	    
-	    m_swapCounter=0; 
-	    
-            DBUG_PRINT("info", ("failover complete..")); 
-	    goto tryagain; 
-	    
+            DBUG_PRINT("error", ("Swapping from adapter %u to %u",
+                       m_StandbyAdapterId, m_ActiveAdapterId));
 	  } else {
-            DBUG_PRINT("error", ("Unrecoverable data transfer error")); 
 	    report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
-	    return false;
+            DBUG_PRINT("error", ("SCI Transfer failed")); 
 	  }
-	  
-	  break; 
-	default: 
-          DBUG_PRINT("error", ("Unrecoverable data transfer error")); 
-	  report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR); 
-	  return false; 
-	  break; 
-	}  
-      }
+        }
       } else { 
 	SHM_Writer * writer = (m_TargetSegm[m_ActiveAdapterId].writer);
 	writer->updateWritePtr(sizeToSend); 
@@ -497,7 +403,6 @@
 	m_sendBuffer.m_dataSize = 0;
 	m_sendBuffer.m_forceSendLimit = sendLimit;
       } 
-      
     } else { 
       /** 
        * If we end up here, the SCI segment is full.  
@@ -552,15 +457,12 @@
    DBUG_VOID_RETURN;
 } //setupLocalSegment 
  
- 
- 
 void SCI_Transporter::setupRemoteSegment()   
 { 
    DBUG_ENTER("SCI_Transporter::setupRemoteSegment");
    Uint32 sharedSize = 0; 
    sharedSize =4096;   //start of the buffer is page aligned 
  
- 
    Uint32 sizeOfBuffer = m_BufferSize; 
    const Uint32 slack = MAX_MESSAGE_SIZE;
    sizeOfBuffer -= sharedSize; 
@@ -666,7 +568,6 @@
         DBUG_PRINT("error", ("Error connecting segment, err 0x%x", err));
         DBUG_RETURN(false);
       }
-
     }
     // Map the remote memory segment into program space  
     for(Uint32 i=0; i < m_adapters ; i++) {
@@ -679,13 +580,14 @@
                             FLAGS,
                             &err);
 
-
-        if(err!= SCI_ERR_OK) {
-          DBUG_PRINT("error", ("Cannot map a segment to the remote node %d. Error code 0x%x",m_RemoteSciNodeId, err));
-          //NDB SHOULD TERMINATE AND COMPUTER REBOOTED! 
-          report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
-          DBUG_RETURN(false);
-        }
+      if(err!= SCI_ERR_OK) {
+        DBUG_PRINT("error",
+          ("Cannot map a segment to the remote node %d. Error code 0x%x",
+          m_RemoteSciNodeId, err));
+        //NDB SHOULD TERMINATE AND COMPUTER REBOOTED! 
+        report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
+        DBUG_RETURN(false);
+      }
     }
     m_mapped=true;
     setupRemoteSegment();
@@ -713,7 +615,6 @@
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_RETURN(false);
   }
-
   if (!init_local()) {
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_RETURN(false);
@@ -788,29 +689,9 @@
 		       &(m_TargetSegm[adapterid].sequence),  
 		       SCI_FLAG_FAST_BARRIER,  
 		       &err);  
-  
-  
   return err; 
 } // createSequence()  
  
- 
-sci_error_t SCI_Transporter::startSequence(Uint32 adapterid) { 
-  
-  sci_error_t err; 
-  /** Perform preliminary error check on an SCI adapter before starting a 
-   * sequence of read and write operations on the mapped segment. 
-   */ 
-  m_SequenceStatus = SCIStartSequence( 
-				       (m_TargetSegm[adapterid].sequence),  
-				       FLAGS, &err); 
-   
-   
-  // If there still is an error then data cannot be safely send 
-  return err; 
-} // startSequence() 
- 
-   
- 
 bool SCI_Transporter::disconnectLocal()  
 {
   DBUG_ENTER("SCI_Transporter::disconnectLocal"); 
@@ -878,9 +759,6 @@
   DBUG_VOID_RETURN;
 } // ~SCI_Transporter() 
  
- 
- 
- 
 void SCI_Transporter::closeSCI() { 
   // Termination of SCI 
   sci_error_t err; 
@@ -897,8 +775,9 @@
   SCIClose(activeSCIDescriptor, FLAGS, &err);  
    
   if(err != SCI_ERR_OK) {
-    DBUG_PRINT("error", ("Cannot close SCI channel to the driver. Error code 0x%x",  
-	        err)); 
+    DBUG_PRINT("error",
+      ("Cannot close SCI channel to the driver. Error code 0x%x",  
+      err)); 
   }
   SCITerminate(); 
   DBUG_VOID_RETURN;
@@ -973,7 +852,6 @@
     return false; 
 } 
  
- 
 void  
 SCI_Transporter::setConnected() { 
   *m_remoteStatusFlag = SCICONNECTED; 
@@ -983,7 +861,6 @@
   *m_localStatusFlag = SCICONNECTED; 
 } 
  
- 
 void  
 SCI_Transporter::setDisconnect() { 
   if(getLinkStatus(m_ActiveAdapterId)) 
@@ -994,7 +871,6 @@
   }
 } 
  
- 
 bool 
 SCI_Transporter::checkConnected() { 
   if (*m_localStatusFlag == SCIDISCONNECT) { 
@@ -1015,8 +891,9 @@
     SCIInitialize(0, &error); 
     if(error != SCI_ERR_OK)  { 
       DBUG_PRINT("error", ("Cannot initialize SISCI library."));
-      DBUG_PRINT("error", ("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
-                 error)); 
+      DBUG_PRINT("error",
+      ("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
+      error)); 
       DBUG_RETURN(false);
     } 
     init = true; 
@@ -1029,3 +906,4 @@
 {
   return (m_TargetSegm[m_ActiveAdapterId].writer)->get_free_buffer();
 }
+

--- 1.7/storage/ndb/src/common/transporter/SCI_Transporter.hpp	2007-01-16 14:26:52 -08:00
+++ 1.8/storage/ndb/src/common/transporter/SCI_Transporter.hpp	2007-01-16 14:26:52 -08:00
@@ -54,12 +54,12 @@
  *  local segment, the SCI transporter connects to a segment created by another 
  *  transporter at a remote node, and the maps the remote segment into its  
  *  virtual address space. However, since NDB Cluster relies on redundancy 
- *  at the network level, by using dual SCI adapters communica 
- * 
+ *  at the network level, by using dual SCI adapters communication can be
+ *  maintained even if one of the adapter cards fails (or anything on the
+ *  network this adapter card exists in e.g. an SCI switch failure).
  * 
  */ 
 
-
 /**  
  * class SCITransporter 
  * @brief - main class for the SCI transporter. 
@@ -84,16 +84,6 @@
   sci_error_t createSequence(Uint32 adapterid);      
    
    
-  /** 
-   * starts a sequence for error checking. 
-   * The actual checking that a sequence is correct is done implicitly 
-   * in SCIMemCpy (in doSend).  
-   * @param adapterid the adapter on which to start the sequence. 
-   * @return SCI_ERR_OK if ok, otherwize something else. 
-   */ 
-  sci_error_t startSequence(Uint32 adapterid);          
- 
- 
   /** Initiate Local Segment: create a memory segment, 
    * prepare a memory segment, map the local segment  
    * into  memory space and make segment available. 
@@ -159,7 +149,6 @@
   bool m_mapped; 
   bool m_initLocal; 
   bool m_sciinit; 
-  Uint32 m_swapCounter; 
   Uint32 m_failCounter; 
   /** 
    * For statistics on transfered packets  
@@ -194,7 +183,6 @@
    * Statistics 
    */ 
   Uint32 m_reportFreq; 
- 
  
   Uint32 m_adapters;   
   Uint32 m_numberOfRemoteNodes; 

--- 1.68/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-01-16 14:26:52 -08:00
+++ 1.69/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-01-16 14:26:52 -08:00
@@ -1147,12 +1147,22 @@
 bool
 TransporterRegistry::start_clients()
 {
+  char thread_object[128];
+  uint len;
+
   m_run_start_clients_thread= true;
-  m_start_clients_thread= NdbThread_Create(run_start_clients_C,
+  fill_thread_object((void*)thread_object, &len, FALSE);
+  m_start_clients_thread= NdbThread_CreateWithFunc(run_start_clients_C,
 					   (void**)this,
 					   32768,
 					   "ndb_start_clients",
-					   NDB_THREAD_PRIO_LOW);
+					   NDB_THREAD_PRIO_LOW,
+                                           add_thread_id,
+                                           thread_object,
+                                           len,
+                                           remove_thread_id,
+                                           thread_object,
+                                           len);
   if (m_start_clients_thread == 0) {
     m_run_start_clients_thread= false;
     return false;

--- 1.24/storage/ndb/src/common/util/SocketServer.cpp	2007-01-16 14:26:52 -08:00
+++ 1.25/storage/ndb/src/common/util/SocketServer.cpp	2007-01-16 14:26:52 -08:00
@@ -212,14 +212,25 @@
 }
 
 void
-SocketServer::startServer(){
+SocketServer::startServer()
+{
+  char thread_object[128];
+  uint len;
+
   m_threadLock.lock();
   if(m_thread == 0 && m_stopThread == false){
-    m_thread = NdbThread_Create(socketServerThread_C,
+    fill_thread_object((void*)thread_object, &len, TRUE);
+    m_thread = NdbThread_CreateWithFunc(socketServerThread_C,
 				(void**)this,
 				32768,
 				"NdbSockServ",
-				NDB_THREAD_PRIO_LOW);
+				NDB_THREAD_PRIO_LOW,
+                                add_thread_id,
+                                thread_object,
+                                len,
+                                remove_thread_id,
+                                thread_object,
+                                len);
   }
   m_threadLock.unlock();
 }

--- 1.38/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2007-01-16 14:26:52 -08:00
+++ 1.39/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2007-01-16 14:26:52 -08:00
@@ -392,6 +392,7 @@
     signal->theData[2] = NodeInfo::API;
     execOPEN_COMREQ(signal);
     globalData.theStartLevel = NodeState::SL_STARTED;
+               
     sendSTTORRY(signal);
   }
 }
@@ -1150,7 +1151,31 @@
     }
     return;
   }
-  
+  if (arg == DumpStateOrd::CmvmiSchedulerExecutionTimer)
+  {
+    Uint32 exec_time = signal->theData[1];
+    globalEmulatorData.theConfiguration->schedulerExecutionTimer(exec_time);
+  }
+  if (arg == DumpStateOrd::CmvmiSchedulerSpinTimer)
+  {
+    Uint32 spin_time = signal->theData[1];
+    globalEmulatorData.theConfiguration->schedulerSpinTimer(spin_time);
+  } 
+  if (arg == DumpStateOrd::CmvmiRealtimeScheduler)
+  {
+    bool realtime_on = signal->theData[1];
+    globalEmulatorData.theConfiguration->realtimeScheduler(realtime_on);
+  }
+  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)
   {
     if(signal->getLength() == 1)

--- 1.112/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-01-16 14:26:52 -08:00
+++ 1.113/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-01-16 14:26:52 -08:00
@@ -14004,7 +14004,8 @@
 
 //******************************************
 void
-Dbdict::execCREATE_FILE_REQ(Signal* signal){
+Dbdict::execCREATE_FILE_REQ(Signal* signal)
+{
   jamEntry();
   
   if(!assembleFragments(signal)){
@@ -14040,13 +14041,14 @@
 
     Ptr<SchemaTransaction> trans_ptr;
     if (! c_Trans.seize(trans_ptr)){
+      jam();
       ref->errorCode = CreateFileRef::Busy;
       ref->status    = 0;
       ref->errorKey  = 0;
       ref->errorLine = __LINE__;
       break;
     }
-    
+    jam(); 
     const Uint32 trans_key = ++c_opRecordSequence;
     trans_ptr.p->key = trans_key;
     trans_ptr.p->m_senderRef = senderRef;
@@ -14075,6 +14077,7 @@
     {
       Uint32 objId = getFreeObjId(0);
       if (objId == RNIL) {
+        jam();
         ref->errorCode = CreateFileRef::NoMoreObjectRecords;
         ref->status    = 0;
         ref->errorKey  = 0;
@@ -14099,7 +14102,6 @@
 	       CreateObjReq::SignalLength, JBB);
 
     c_blockState = BS_CREATE_TAB;
-
     return;
   } while(0);
   
@@ -14110,7 +14112,8 @@
 }
 
 void
-Dbdict::execCREATE_FILEGROUP_REQ(Signal* signal){
+Dbdict::execCREATE_FILEGROUP_REQ(Signal* signal)
+{
   jamEntry();
   
   if(!assembleFragments(signal)){
@@ -14145,13 +14148,14 @@
 
     Ptr<SchemaTransaction> trans_ptr;
     if (! c_Trans.seize(trans_ptr)){
+      jam();
       ref->errorCode = CreateFilegroupRef::Busy;
       ref->status    = 0;
       ref->errorKey  = 0;
       ref->errorLine = __LINE__;
       break;
     }
-    
+    jam(); 
     const Uint32 trans_key = ++c_opRecordSequence;
     trans_ptr.p->key = trans_key;
     trans_ptr.p->m_senderRef = senderRef;
@@ -14177,6 +14181,7 @@
     {
       Uint32 objId = getFreeObjId(0);
       if (objId == RNIL) {
+        jam();
         ref->errorCode = CreateFilegroupRef::NoMoreObjectRecords;
         ref->status    = 0;
         ref->errorKey  = 0;
@@ -14201,7 +14206,6 @@
 	       CreateObjReq::SignalLength, JBB);
 
     c_blockState = BS_CREATE_TAB;
-
     return;
   } while(0);
   
@@ -14248,6 +14252,7 @@
     Ptr<File> file_ptr;
     if (!c_file_hash.find(file_ptr, objId))
     {
+      jam();
       ref->errorCode = DropFileRef::NoSuchFile;
       ref->errorLine = __LINE__;
       break;
@@ -14255,6 +14260,7 @@
     
     if (file_ptr.p->m_version != version)
     {
+      jam();
       ref->errorCode = DropFileRef::InvalidSchemaObjectVersion;
       ref->errorLine = __LINE__;
       break;
@@ -14263,11 +14269,12 @@
     Ptr<SchemaTransaction> trans_ptr;
     if (! c_Trans.seize(trans_ptr))
     {
+      jam();
       ref->errorCode = CreateFileRef::Busy;
       ref->errorLine = __LINE__;
       break;
     }
-    
+    jam();
     const Uint32 trans_key = ++c_opRecordSequence;
     trans_ptr.p->key = trans_key;
     trans_ptr.p->m_senderRef = senderRef;
@@ -14302,7 +14309,6 @@
 	       DropObjReq::SignalLength, JBB);
 
     c_blockState = BS_CREATE_TAB;
-
     return;
   } while(0);
   
@@ -14349,6 +14355,7 @@
     Ptr<Filegroup> filegroup_ptr;
     if (!c_filegroup_hash.find(filegroup_ptr, objId))
     {
+      jam();
       ref->errorCode = DropFilegroupRef::NoSuchFilegroup;
       ref->errorLine = __LINE__;
       break;
@@ -14356,6 +14363,7 @@
 
     if (filegroup_ptr.p->m_version != version)
     {
+      jam();
       ref->errorCode = DropFilegroupRef::InvalidSchemaObjectVersion;
       ref->errorLine = __LINE__;
       break;
@@ -14364,11 +14372,13 @@
     Ptr<SchemaTransaction> trans_ptr;
     if (! c_Trans.seize(trans_ptr))
     {
+      jam();
       ref->errorCode = CreateFilegroupRef::Busy;
       ref->errorLine = __LINE__;
       break;
     }
-    
+   
+    jam();
     const Uint32 trans_key = ++c_opRecordSequence;
     trans_ptr.p->key = trans_key;
     trans_ptr.p->m_senderRef = senderRef;
@@ -14403,7 +14413,6 @@
 	       DropObjReq::SignalLength, JBB);
 
     c_blockState = BS_CREATE_TAB;
-
     return;
   } while(0);
   
@@ -14414,15 +14423,15 @@
 }
 
 void
-Dbdict::execCREATE_OBJ_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execCREATE_OBJ_REF(Signal* signal)
+{
   CreateObjRef * const ref = (CreateObjRef*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, ref->senderData));
-  
   if(ref->errorCode != CreateObjRef::NF_FakeErrorREF){
+    jam();
     trans_ptr.p->setErrorCode(ref->errorCode);
   }
   Uint32 node = refToNode(ref->senderRef);
@@ -14430,12 +14439,12 @@
 }
 
 void
-Dbdict::execCREATE_OBJ_CONF(Signal* signal){
-  jamEntry();
-
-  CreateObjConf * const conf = (CreateObjConf*)signal->getDataPtr();
-  
+Dbdict::execCREATE_OBJ_CONF(Signal* signal)
+{
   Ptr<SchemaTransaction> trans_ptr;
+  CreateObjConf * const conf = (CreateObjConf*)signal->getDataPtr();
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, conf->senderData));
   schemaOp_reply(signal, trans_ptr.p, refToNode(conf->senderRef));
 }
@@ -14445,6 +14454,7 @@
 		       SchemaTransaction * trans_ptr_p, 
 		       Uint32 nodeId)
 {
+  jam();
   {
     SafeCounter tmp(c_counterMgr, trans_ptr_p->m_counter);
     if(!tmp.clearWaitingFor(nodeId)){
@@ -14455,10 +14465,8 @@
   
   switch(trans_ptr_p->m_op.m_state){
   case DictObjOp::Preparing:{
-    
     if(trans_ptr_p->m_errorCode != 0)
     {
-      jam();
       /**
        * Failed to prepare on atleast one node -> abort on all
        */
@@ -14468,10 +14476,16 @@
 	safe_cast(&Dbdict::trans_abort_start_done);
       
       if(f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_abort_start)
+      {
+        jam();
 	(this->*f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_abort_start)
 	  (signal, trans_ptr_p);
+      }
       else
+      {
+        jam();
 	execute(signal, trans_ptr_p->m_callback, 0);
+      }
       return;
     }
     
@@ -14481,14 +14495,19 @@
       safe_cast(&Dbdict::trans_commit_start_done);
     
     if(f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_commit_start)
+    {
+      jam();
       (this->*f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_commit_start)
 	(signal, trans_ptr_p);
+    }
     else
+    {
+      jam();
       execute(signal, trans_ptr_p->m_callback, 0);
+    }
     return;
   }
   case DictObjOp::Committing: {
-    jam();
     ndbrequire(trans_ptr_p->m_errorCode == 0);
 
     trans_ptr_p->m_op.m_state = DictObjOp::Committed;
@@ -14497,31 +14516,42 @@
       safe_cast(&Dbdict::trans_commit_complete_done);
     
     if(f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_commit_complete)
+    {
+      jam();
       (this->*f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_commit_complete)
 	(signal, trans_ptr_p);
+    }
     else
-      execute(signal, trans_ptr_p->m_callback, 0);      
+    {
+      jam();
+      execute(signal, trans_ptr_p->m_callback, 0);
+    }
     return;
   }
   case DictObjOp::Aborting:{
-    jam();
-
     trans_ptr_p->m_op.m_state = DictObjOp::Committed;
     trans_ptr_p->m_callback.m_callbackData = trans_ptr_p->key;
     trans_ptr_p->m_callback.m_callbackFunction= 
       safe_cast(&Dbdict::trans_abort_complete_done);
 
     if(f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_abort_complete)
+    {
+      jam();
       (this->*f_dict_op[trans_ptr_p->m_op.m_vt_index].m_trans_abort_complete)
 	(signal, trans_ptr_p);
+    }
     else
-      execute(signal, trans_ptr_p->m_callback, 0);      
+    {
+      jam();
+      execute(signal, trans_ptr_p->m_callback, 0);
+    }
     return;
   }
   case DictObjOp::Defined:
   case DictObjOp::Prepared:
   case DictObjOp::Committed:
   case DictObjOp::Aborted:
+    jam();
     break;
   }
   ndbrequire(false);
@@ -14530,14 +14560,13 @@
 void
 Dbdict::trans_commit_start_done(Signal* signal, 
 				Uint32 callbackData,
-				Uint32 retValue){
-  jamEntry();
-  
-  ndbrequire(retValue == 0);
-  
+				Uint32 retValue)
+{
   Ptr<SchemaTransaction> trans_ptr;
+
+  jam();
+  ndbrequire(retValue == 0);
   ndbrequire(c_Trans.find(trans_ptr, callbackData));
-  
   NodeReceiverGroup rg(DBDICT, trans_ptr.p->m_nodes);
   SafeCounter tmp(c_counterMgr, trans_ptr.p->m_counter);
   tmp.init<DictCommitRef>(rg, GSN_DICT_COMMIT_REF, trans_ptr.p->key);
@@ -14548,27 +14577,26 @@
   req->op_key = trans_ptr.p->m_op.m_key;
   sendSignal(rg, GSN_DICT_COMMIT_REQ, signal, DictCommitReq::SignalLength, 
 	     JBB);
-  
   trans_ptr.p->m_op.m_state = DictObjOp::Committing;
 }
 
 void
 Dbdict::trans_commit_complete_done(Signal* signal, 
 				   Uint32 callbackData,
-				   Uint32 retValue){
-  jamEntry();
-  
-  ndbrequire(retValue == 0);
-  
+				   Uint32 retValue)
+{
   Ptr<SchemaTransaction> trans_ptr;
+
+  jam();
+  ndbrequire(retValue == 0);
   ndbrequire(c_Trans.find(trans_ptr, callbackData));
 
   switch(f_dict_op[trans_ptr.p->m_op.m_vt_index].m_gsn_user_req){
   case GSN_CREATE_FILEGROUP_REQ:{
     FilegroupPtr fg_ptr;
+    jam();
     ndbrequire(c_filegroup_hash.find(fg_ptr, trans_ptr.p->m_op.m_obj_id));
     
-    //
     CreateFilegroupConf * conf = (CreateFilegroupConf*)signal->getDataPtr();
     conf->senderRef = reference();
     conf->senderData = trans_ptr.p->m_senderData;
@@ -14578,11 +14606,11 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_CREATE_FILEGROUP_CONF, signal, 
 	       CreateFilegroupConf::SignalLength, JBB);
-
     break;
   }
   case GSN_CREATE_FILE_REQ:{
     FilePtr f_ptr;
+    jam();
     ndbrequire(c_file_hash.find(f_ptr, trans_ptr.p->m_op.m_obj_id));
     CreateFileConf * conf = (CreateFileConf*)signal->getDataPtr();
     conf->senderRef = reference();
@@ -14593,11 +14621,11 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_CREATE_FILE_CONF, signal, 
 	       CreateFileConf::SignalLength, JBB);
-    
     break;
   }
   case GSN_DROP_FILE_REQ:{
     DropFileConf * conf = (DropFileConf*)signal->getDataPtr();
+    jam();
     conf->senderRef = reference();
     conf->senderData = trans_ptr.p->m_senderData;
     conf->fileId = trans_ptr.p->m_op.m_obj_id;
@@ -14609,6 +14637,7 @@
   }
   case GSN_DROP_FILEGROUP_REQ:{
     DropFilegroupConf * conf = (DropFilegroupConf*)signal->getDataPtr();
+    jam();
     conf->senderRef = reference();
     conf->senderData = trans_ptr.p->m_senderData;
     conf->filegroupId = trans_ptr.p->m_op.m_obj_id;
@@ -14631,12 +14660,12 @@
 void
 Dbdict::trans_abort_start_done(Signal* signal, 
 			       Uint32 callbackData,
-			       Uint32 retValue){
-  jamEntry();
-  
-  ndbrequire(retValue == 0);
-
+			       Uint32 retValue)
+{
   Ptr<SchemaTransaction> trans_ptr;
+
+  jam();
+  ndbrequire(retValue == 0);
   ndbrequire(c_Trans.find(trans_ptr, callbackData));
   
   NodeReceiverGroup rg(DBDICT, trans_ptr.p->m_nodes);
@@ -14654,12 +14683,12 @@
 void
 Dbdict::trans_abort_complete_done(Signal* signal, 
 				  Uint32 callbackData,
-				  Uint32 retValue){
-  jamEntry();
-  
-  ndbrequire(retValue == 0);
-  
+				  Uint32 retValue)
+{
   Ptr<SchemaTransaction> trans_ptr;
+
+  jam();
+  ndbrequire(retValue == 0);
   ndbrequire(c_Trans.find(trans_ptr, callbackData));
 
   switch(f_dict_op[trans_ptr.p->m_op.m_vt_index].m_gsn_user_req){
@@ -14667,6 +14696,7 @@
   {
     //
     CreateFilegroupRef * ref = (CreateFilegroupRef*)signal->getDataPtr();
+    jam();
     ref->senderRef = reference();
     ref->senderData = trans_ptr.p->m_senderData;
     ref->masterNodeId = c_masterNodeId;
@@ -14678,12 +14708,12 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_CREATE_FILEGROUP_REF, signal, 
 	       CreateFilegroupRef::SignalLength, JBB);
-
     break;
   }
   case GSN_CREATE_FILE_REQ:
   {
     CreateFileRef * ref = (CreateFileRef*)signal->getDataPtr();
+    jam();
     ref->senderRef = reference();
     ref->senderData = trans_ptr.p->m_senderData;
     ref->masterNodeId = c_masterNodeId;
@@ -14695,12 +14725,12 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_CREATE_FILE_REF, signal, 
 	       CreateFileRef::SignalLength, JBB);
-    
     break;
   }
   case GSN_DROP_FILE_REQ:
   {
     DropFileRef * ref = (DropFileRef*)signal->getDataPtr();
+    jam();
     ref->senderRef = reference();
     ref->senderData = trans_ptr.p->m_senderData;
     ref->masterNodeId = c_masterNodeId;
@@ -14711,13 +14741,13 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_DROP_FILE_REF, signal, 
 	       DropFileRef::SignalLength, JBB);
-    
     break;
   }
   case GSN_DROP_FILEGROUP_REQ:
   {
     //
     DropFilegroupRef * ref = (DropFilegroupRef*)signal->getDataPtr();
+    jam();
     ref->senderRef = reference();
     ref->senderData = trans_ptr.p->m_senderData;
     ref->masterNodeId = c_masterNodeId;
@@ -14728,7 +14758,6 @@
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_DROP_FILEGROUP_REF, signal, 
 	       DropFilegroupRef::SignalLength, JBB);
-
     break;
   }
   default:
@@ -14742,7 +14771,8 @@
 }
 
 void
-Dbdict::execCREATE_OBJ_REQ(Signal* signal){
+Dbdict::execCREATE_OBJ_REQ(Signal* signal)
+{
   jamEntry();
 
   if(!assembleFragments(signal)){
@@ -14787,6 +14817,7 @@
   switch(objType){
   case DictTabInfo::Tablespace:
   case DictTabInfo::LogfileGroup:
+    jam();
     createObjPtr.p->m_vt_index = 0;
     break;
   case DictTabInfo::Datafile:
@@ -14795,7 +14826,11 @@
      * Use restart code to impl. ForceCreateFile
      */
     if (requestInfo & CreateFileReq::ForceCreateFile)
-      createObjPtr.p->m_restart= 2;      
+    {
+      jam();
+      createObjPtr.p->m_restart= 2;
+    }
+    jam();
     createObjPtr.p->m_vt_index = 1;
     break;
   default:
@@ -14811,10 +14846,10 @@
 Dbdict::execDICT_COMMIT_REQ(Signal* signal)
 {
   DictCommitReq* req = (DictCommitReq*)signal->getDataPtr();
-
   Ptr<SchemaOp> op;
-  ndbrequire(c_schemaOp.find(op, req->op_key));
 
+  jamEntry();
+  ndbrequire(c_schemaOp.find(op, req->op_key));
   (this->*f_dict_op[op.p->m_vt_index].m_commit)(signal, op.p);
 }
 
@@ -14822,23 +14857,23 @@
 Dbdict::execDICT_ABORT_REQ(Signal* signal)
 {
   DictAbortReq* req = (DictAbortReq*)signal->getDataPtr();
-
   Ptr<SchemaOp> op;
-  ndbrequire(c_schemaOp.find(op, req->op_key));
 
+  jamEntry();
+  ndbrequire(c_schemaOp.find(op, req->op_key));
   (this->*f_dict_op[op.p->m_vt_index].m_abort)(signal, op.p);
 }
 
 void
-Dbdict::execDICT_COMMIT_REF(Signal* signal){
-  jamEntry();
-  
+Dbdict::execDICT_COMMIT_REF(Signal* signal)
+{
   DictCommitRef * const ref = (DictCommitRef*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, ref->senderData));
-  
   if(ref->errorCode != DictCommitRef::NF_FakeErrorREF){
+    jam();
     trans_ptr.p->setErrorCode(ref->errorCode);
   }
   Uint32 node = refToNode(ref->senderRef);
@@ -14846,26 +14881,26 @@
 }
 
 void
-Dbdict::execDICT_COMMIT_CONF(Signal* signal){
-  jamEntry();
-  
-  DictCommitConf * const conf = (DictCommitConf*)signal->getDataPtr();
-  
+Dbdict::execDICT_COMMIT_CONF(Signal* signal)
+{
   Ptr<SchemaTransaction> trans_ptr;
+  DictCommitConf * const conf = (DictCommitConf*)signal->getDataPtr();
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, conf->senderData));
   schemaOp_reply(signal, trans_ptr.p, refToNode(conf->senderRef));
 }
 
 void
-Dbdict::execDICT_ABORT_REF(Signal* signal){
-  jamEntry();
-  
+Dbdict::execDICT_ABORT_REF(Signal* signal)
+{
   DictAbortRef * const ref = (DictAbortRef*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, ref->senderData));
-  
   if(ref->errorCode != DictAbortRef::NF_FakeErrorREF){
+    jam();
     trans_ptr.p->setErrorCode(ref->errorCode);
   }
   Uint32 node = refToNode(ref->senderRef);
@@ -14873,31 +14908,28 @@
 }
 
 void
-Dbdict::execDICT_ABORT_CONF(Signal* signal){
-  jamEntry();
-  
+Dbdict::execDICT_ABORT_CONF(Signal* signal)
+{
   DictAbortConf * const conf = (DictAbortConf*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, conf->senderData));
   schemaOp_reply(signal, trans_ptr.p, refToNode(conf->senderRef));
 }
 
-
-
 void
 Dbdict::createObj_prepare_start_done(Signal* signal,
 				     Uint32 callbackData, 
-				     Uint32 returnCode){
+				     Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;  
+  SegmentedSectionPtr objInfoPtr;
   
   ndbrequire(returnCode == 0);
-
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
-
-  SegmentedSectionPtr objInfoPtr;
+  jam();
   getSection(objInfoPtr, createObjPtr.p->m_obj_info_ptr_i);
-  
   if(createObjPtr.p->m_errorCode != 0){
     jam();
     createObjPtr.p->m_obj_info_ptr_i= RNIL;
@@ -14925,19 +14957,19 @@
 void
 Dbdict::createObj_writeSchemaConf1(Signal* signal, 
 				   Uint32 callbackData,
-				   Uint32 returnCode){
-  jam();
+				   Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;  
+  Callback callback;
+  SegmentedSectionPtr objInfoPtr;
 
+  jam();
   ndbrequire(returnCode == 0);
-
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
   
-  Callback callback;
   callback.m_callbackData = createObjPtr.p->key;
   callback.m_callbackFunction = safe_cast(&Dbdict::createObj_writeObjConf);
   
-  SegmentedSectionPtr objInfoPtr;
   getSection(objInfoPtr, createObjPtr.p->m_obj_info_ptr_i);
   writeTableFile(signal, createObjPtr.p->m_obj_id, objInfoPtr, &callback);
   
@@ -14949,14 +14981,13 @@
 void
 Dbdict::createObj_writeObjConf(Signal* signal, 
 			       Uint32 callbackData,
-			       Uint32 returnCode){
-  jam();
+			       Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;
 
+  jam();
   ndbrequire(returnCode == 0);
-  
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
-
   createObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::createObj_prepare_complete_done);
   (this->*f_dict_op[createObjPtr.p->m_vt_index].m_prepare_complete)
@@ -14966,12 +14997,12 @@
 void
 Dbdict::createObj_prepare_complete_done(Signal* signal, 
 					Uint32 callbackData,
-					Uint32 returnCode){
+					Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;
+
   jam();
-  
   ndbrequire(returnCode == 0);
-  
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
   
   //@todo check for master failed
@@ -15000,28 +15031,33 @@
 }
 
 void
-Dbdict::createObj_commit(Signal * signal, SchemaOp * op){
-  jam();
-  
+Dbdict::createObj_commit(Signal * signal, SchemaOp * op)
+{
   OpCreateObj * createObj = (OpCreateObj*)op;
+
   createObj->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::createObj_commit_start_done);
   if (f_dict_op[createObj->m_vt_index].m_commit_start)
+  {
+    jam();
     (this->*f_dict_op[createObj->m_vt_index].m_commit_start)(signal, createObj);
+  }
   else
+  {
+    jam();
     execute(signal, createObj->m_callback, 0);
+  }
 }
 
 void
 Dbdict::createObj_commit_start_done(Signal* signal, 
 				    Uint32 callbackData,
-				    Uint32 returnCode){
+				    Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;  
   
   jam();
-  
   ndbrequire(returnCode == 0);
-  
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
   
   Uint32 objId = createObjPtr.p->m_obj_id;
@@ -15041,29 +15077,35 @@
 void
 Dbdict::createObj_writeSchemaConf2(Signal* signal, 
 				   Uint32 callbackData,
-				   Uint32 returnCode){
-  jam();
-  
-  CreateObjRecordPtr createObjPtr;  
-  ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
+				   Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;
 
+  ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
   createObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::createObj_commit_complete_done);
   if (f_dict_op[createObjPtr.p->m_vt_index].m_commit_complete)
+  {
+    jam();
     (this->*f_dict_op[createObjPtr.p->m_vt_index].m_commit_complete)
       (signal, createObjPtr.p);
+  }
   else
+  {
+    jam();
     execute(signal, createObjPtr.p->m_callback, 0);
+  }
   
 }
 
 void
 Dbdict::createObj_commit_complete_done(Signal* signal, 
 				       Uint32 callbackData,
-				       Uint32 returnCode){
+				       Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;
+
   jam();
-  
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
   
   //@todo check error
@@ -15081,27 +15123,31 @@
 void
 Dbdict::createObj_abort(Signal* signal, SchemaOp* op)
 {
-  jam();
-  
   OpCreateObj * createObj = (OpCreateObj*)op;
   
   createObj->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::createObj_abort_start_done);
   if (f_dict_op[createObj->m_vt_index].m_abort_start)
+  {
+    jam();
     (this->*f_dict_op[createObj->m_vt_index].m_abort_start)(signal, createObj);
+  }
   else
+  {
+    jam();
     execute(signal, createObj->m_callback, 0);
+  }
 }
 
 void
 Dbdict::createObj_abort_start_done(Signal* signal, 
 				   Uint32 callbackData,
-				   Uint32 returnCode){
+				   Uint32 returnCode)
+{
+  CreateObjRecordPtr createObjPtr;
+
   jam();
-  
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
-  
   XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
   SchemaFile::TableEntry objEntry = * getTableEntry(xsf, 
 						    createObjPtr.p->m_obj_id);
@@ -15120,19 +15166,23 @@
 					Uint32 callbackData,
 					Uint32 returnCode)
 {
-  jam();
+  CreateObjRecordPtr createObjPtr;
 
-  CreateObjRecordPtr createObjPtr;  
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
-
   createObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::createObj_abort_complete_done);
   
   if (f_dict_op[createObjPtr.p->m_vt_index].m_abort_complete)
+  {
+    jam();
     (this->*f_dict_op[createObjPtr.p->m_vt_index].m_abort_complete)
       (signal, createObjPtr.p);
+  }
   else
+  {
+    jam();
     execute(signal, createObjPtr.p->m_callback, 0);
+  }
 }
 
 void
@@ -15140,9 +15190,9 @@
 				      Uint32 callbackData,
 				      Uint32 returnCode)
 {
-  jam();
+  CreateObjRecordPtr createObjPtr;
 
-  CreateObjRecordPtr createObjPtr;  
+  jam();
   ndbrequire(c_opCreateObj.find(createObjPtr, callbackData));
 
   DictAbortConf * const conf = (DictAbortConf*)signal->getDataPtr();
@@ -15155,7 +15205,8 @@
 }
 
 void
-Dbdict::execDROP_OBJ_REQ(Signal* signal){
+Dbdict::execDROP_OBJ_REQ(Signal* signal)
+{
   jamEntry();
 
   if(!assembleFragments(signal)){
@@ -15194,8 +15245,9 @@
   case DictTabInfo::Tablespace:
   case DictTabInfo::LogfileGroup:
   {
-    dropObjPtr.p->m_vt_index = 3;
     Ptr<Filegroup> fg_ptr;
+    jam();
+    dropObjPtr.p->m_vt_index = 3;
     ndbrequire(c_filegroup_hash.find(fg_ptr, objId));
     dropObjPtr.p->m_obj_ptr_i = fg_ptr.i;
     break;
@@ -15203,15 +15255,19 @@
   }
   case DictTabInfo::Datafile:
   {
-    dropObjPtr.p->m_vt_index = 2;
     Ptr<File> file_ptr;
+    jam();
+    dropObjPtr.p->m_vt_index = 2;
     ndbrequire(c_file_hash.find(file_ptr, objId));
     dropObjPtr.p->m_obj_ptr_i = file_ptr.i;
     break;
   }
   case DictTabInfo::Undofile:
+  {
+    jam();
     dropObjPtr.p->m_vt_index = 4;
     return;
+  }
   default:
     ndbrequire(false);
   }
@@ -15226,12 +15282,12 @@
 				   Uint32 callbackData,
 				   Uint32 returnCode)
 {
-  ndbrequire(returnCode == 0);
+  DropObjRecordPtr dropObjPtr;
+  Callback cb;
 
-  DropObjRecordPtr dropObjPtr;  
+  ndbrequire(returnCode == 0);
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
 
-  Callback cb;
   cb.m_callbackData = callbackData;
   cb.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_prepare_writeSchemaConf);
@@ -15242,7 +15298,7 @@
     dropObj_prepare_complete_done(signal, callbackData, 0);
     return;
   }
-  
+  jam();  
   Uint32 objId = dropObjPtr.p->m_obj_id;
   XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
   SchemaFile::TableEntry objEntry = *getTableEntry(xsf, objId);
@@ -15255,19 +15311,23 @@
 					Uint32 callbackData,
 					Uint32 returnCode)
 {
-  ndbrequire(returnCode == 0);
+  DropObjRecordPtr dropObjPtr;
 
-  DropObjRecordPtr dropObjPtr;  
+  ndbrequire(returnCode == 0);
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
-  
   dropObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_prepare_complete_done);
-  
   if(f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_complete)
+  {
+    jam();
     (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_prepare_complete)
       (signal, dropObjPtr.p);
+  }
   else
+  {
+    jam();
     execute(signal, dropObjPtr.p->m_callback, 0);
+  }
 }
 
 void
@@ -15275,10 +15335,11 @@
 				      Uint32 callbackData,
 				      Uint32 returnCode)
 {
+  DropObjRecordPtr dropObjPtr;
+
   ndbrequire(returnCode == 0);
-  
-  DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+  jam();
   
   //@todo check for master failed
   
@@ -15304,16 +15365,22 @@
 }
 
 void
-Dbdict::dropObj_commit(Signal * signal, SchemaOp * op){
-  jam();
-  
+Dbdict::dropObj_commit(Signal * signal, SchemaOp * op)
+{
   OpDropObj * dropObj = (OpDropObj*)op;
+
   dropObj->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_commit_start_done);
   if (f_dict_op[dropObj->m_vt_index].m_commit_start)
+  {
+    jam();
     (this->*f_dict_op[dropObj->m_vt_index].m_commit_start)(signal, dropObj);
+  }
   else
+  {
+    jam();
     execute(signal, dropObj->m_callback, 0);
+  }
 }
 
 void
@@ -15321,10 +15388,10 @@
 				  Uint32 callbackData,
 				  Uint32 returnCode)
 {
+  DropObjRecordPtr dropObjPtr;
+
   jam();
   ndbrequire(returnCode == 0);
-
-  DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
   
   Uint32 objId = dropObjPtr.p->m_obj_id;
@@ -15345,20 +15412,25 @@
 				       Uint32 callbackData,
 				       Uint32 returnCode)
 {
+  DropObjRecordPtr dropObjPtr;
+
   jam();
   ndbrequire(returnCode == 0);
-  
-  DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
-  
   dropObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_commit_complete_done);
   
   if(f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
+  {
+    jam();
     (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_commit_complete)
       (signal, dropObjPtr.p);
+  }
   else
+  {
+    jam();
     execute(signal, dropObjPtr.p->m_callback, 0);
+  }
 }
 
 void
@@ -15366,7 +15438,9 @@
 				     Uint32 callbackData,
 				     Uint32 returnCode)
 {
-  DropObjRecordPtr dropObjPtr;  
+  DropObjRecordPtr dropObjPtr;
+
+  jam();
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
   
   //@todo check error
@@ -15377,22 +15451,26 @@
   conf->senderData = dropObjPtr.p->m_senderData;
   sendSignal(dropObjPtr.p->m_senderRef, GSN_DICT_COMMIT_CONF,
 	     signal, DictCommitConf::SignalLength, JBB);
-  
   c_opDropObj.release(dropObjPtr);
 }
 
 void
-Dbdict::dropObj_abort(Signal * signal, SchemaOp * op){
-  jam();
-  
+Dbdict::dropObj_abort(Signal * signal, SchemaOp * op)
+{
   OpDropObj * dropObj = (OpDropObj*)op;
+
   dropObj->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_abort_start_done);
-
   if (f_dict_op[dropObj->m_vt_index].m_abort_start)
+  {
+    jam();
     (this->*f_dict_op[dropObj->m_vt_index].m_abort_start)(signal, dropObj);
+  }
   else
+  {
+    jam();
     execute(signal, dropObj->m_callback, 0);
+  }
 }
 
 void
@@ -15400,10 +15478,10 @@
 				 Uint32 callbackData,
 				 Uint32 returnCode)
 {
+  DropObjRecordPtr dropObjPtr;
+
   jam();
   ndbrequire(returnCode == 0);
-
-  DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
   
   XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
@@ -15424,6 +15502,7 @@
   }
   else
   {
+    jam();
     execute(signal, callback, 0);
   }
 }
@@ -15433,20 +15512,24 @@
 				      Uint32 callbackData,
 				      Uint32 returnCode)
 {
-  jam();
+  DropObjRecordPtr dropObjPtr;
+
   ndbrequire(returnCode == 0);
-  
-  DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
-  
   dropObjPtr.p->m_callback.m_callbackFunction = 
     safe_cast(&Dbdict::dropObj_abort_complete_done);
   
   if(f_dict_op[dropObjPtr.p->m_vt_index].m_abort_complete)
+  {
+    jam();
     (this->*f_dict_op[dropObjPtr.p->m_vt_index].m_abort_complete)
       (signal, dropObjPtr.p);
+  }
   else
+  {
+    jam();
     execute(signal, dropObjPtr.p->m_callback, 0);
+  }
 }
 
 void
@@ -15454,24 +15537,26 @@
 				    Uint32 callbackData,
 				    Uint32 returnCode)
 {
-  DropObjRecordPtr dropObjPtr;  
-  ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
-
+  DropObjRecordPtr dropObjPtr;
   DictAbortConf * const conf = (DictAbortConf*)signal->getDataPtr();
+
+  ndbrequire(c_opDropObj.find(dropObjPtr, callbackData));
+  jam();
   conf->senderRef = reference();
   conf->senderData = dropObjPtr.p->m_senderData;
   sendSignal(dropObjPtr.p->m_senderRef, GSN_DICT_ABORT_CONF,
 	     signal, DictAbortConf::SignalLength, JBB);
-  
   c_opDropObj.release(dropObjPtr);
 }
 
 void 
-Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op){
+Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op)
+{
   /**
    * Put data into table record
    */
   SegmentedSectionPtr objInfoPtr;
+  jam();
   getSection(objInfoPtr, ((OpCreateObj*)op)->m_obj_info_ptr_i);
   SimplePropertiesSectionReader it(objInfoPtr, getSectionSegmentPool());
 
@@ -15488,6 +15573,7 @@
     
     if(status != SimpleProperties::Eof)
     {
+      jam();
       op->m_errorCode = CreateTableRef::InvalidFormat;
       break;
     }
@@ -15496,6 +15582,7 @@
     {
       if(!fg.TS_ExtentSize)
       {
+        jam();
 	op->m_errorCode = CreateFilegroupRef::InvalidExtentSize;
 	break;
       }
@@ -15504,6 +15591,7 @@
     {
       if(!fg.LF_UndoBufferSize)
       {
+        jam();
 	op->m_errorCode = CreateFilegroupRef::InvalidUndoBufferSize;
 	break;
       }
@@ -15512,16 +15600,19 @@
     Uint32 len = strlen(fg.FilegroupName) + 1;
     Uint32 hash = Rope::hash(fg.FilegroupName, len);
     if(get_object(fg.FilegroupName, len, hash) != 0){
+      jam();
       op->m_errorCode = CreateTableRef::TableAlreadyExist;
       break;
     }
     
     if(!c_obj_pool.seize(obj_ptr)){
+      jam();
       op->m_errorCode = CreateTableRef::NoMoreTableRecords;
       break;
     }
     
     if(!c_filegroup_pool.seize(fg_ptr)){
+      jam();
       op->m_errorCode = CreateTableRef::NoMoreTableRecords;
       break;
     }
@@ -15531,6 +15622,7 @@
     {
       Rope name(c_rope_pool, obj_ptr.p->m_name);
       if(!name.assign(fg.FilegroupName, len, hash)){
+        jam();
 	op->m_errorCode = CreateTableRef::OutOfStringBuffer;
 	break;
       }
@@ -15544,6 +15636,7 @@
 
     switch(fg.FilegroupType){
     case DictTabInfo::Tablespace:
+    {
       //fg.TS_DataGrow = group.m_grow_spec;
       fg_ptr.p->m_tablespace.m_extent_size = fg.TS_ExtentSize;
       fg_ptr.p->m_tablespace.m_default_logfile_group_id = fg.TS_LogfileGroupId;
@@ -15551,22 +15644,28 @@
       Ptr<Filegroup> lg_ptr;
       if (!c_filegroup_hash.find(lg_ptr, fg.TS_LogfileGroupId))
       {
+        jam();
 	op->m_errorCode = CreateFilegroupRef::NoSuchLogfileGroup;
 	goto error;
       }
 
       if (lg_ptr.p->m_version != fg.TS_LogfileGroupVersion)
       {
+        jam();
 	op->m_errorCode = CreateFilegroupRef::InvalidFilegroupVersion;
 	goto error;
       }
       increase_ref_count(lg_ptr.p->m_obj_ptr_i);
       break;
+    }
     case DictTabInfo::LogfileGroup:
+    {
+      jam();
       fg_ptr.p->m_logfilegroup.m_undo_buffer_size = fg.LF_UndoBufferSize;
       fg_ptr.p->m_logfilegroup.m_files.init();
       //fg.LF_UndoGrow = ;
       break;
+    }
     default:
       ndbrequire(false);
     }
@@ -15601,13 +15700,14 @@
 }
 
 void
-Dbdict::create_fg_prepare_complete(Signal* signal, SchemaOp* op){
+Dbdict::create_fg_prepare_complete(Signal* signal, SchemaOp* op)
+{
   /**
    * CONTACT TSMAN LGMAN PGMAN 
    */
   CreateFilegroupImplReq* req = 
     (CreateFilegroupImplReq*)signal->getDataPtrSend();
-
+  jam();
   req->senderData = op->key;
   req->senderRef = reference();
   req->filegroup_id = op->m_obj_id;
@@ -15620,53 +15720,57 @@
   Uint32 len= 0;
   switch(op->m_obj_type){
   case DictTabInfo::Tablespace:
+  {
+    jam();
     ref = TSMAN_REF;
     len = CreateFilegroupImplReq::TablespaceLength;
     req->tablespace.extent_size = fg_ptr.p->m_tablespace.m_extent_size;
     req->tablespace.logfile_group_id = 
       fg_ptr.p->m_tablespace.m_default_logfile_group_id;
     break;
+  }
   case DictTabInfo::LogfileGroup:
+  {
+    jam();
     ref = LGMAN_REF;
     len = CreateFilegroupImplReq::LogfileGroupLength;
     req->logfile_group.buffer_size = 
       fg_ptr.p->m_logfilegroup.m_undo_buffer_size;
     break;
+  }
   default:
     ndbrequire(false);
   }
-  
   sendSignal(ref, GSN_CREATE_FILEGROUP_REQ, signal, len, JBB);
 }
 
 void
-Dbdict::execCREATE_FILEGROUP_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execCREATE_FILEGROUP_REF(Signal* signal)
+{
   CreateFilegroupImplRef * ref = (CreateFilegroupImplRef*)signal->getDataPtr();
-  
   CreateObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opCreateObj.find(op_ptr, ref->senderData));
   op_ptr.p->m_errorCode = ref->errorCode;
-
   execute(signal, op_ptr.p->m_callback, 0);  
 }  
 
 void
-Dbdict::execCREATE_FILEGROUP_CONF(Signal* signal){  
-  jamEntry();
-
+Dbdict::execCREATE_FILEGROUP_CONF(Signal* signal)
+{
   CreateFilegroupImplConf * rep = 
     (CreateFilegroupImplConf*)signal->getDataPtr();
-  
   CreateObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opCreateObj.find(op_ptr, rep->senderData));
-  
   execute(signal, op_ptr.p->m_callback, 0);  
 }
 
 void
-Dbdict::create_fg_abort_start(Signal* signal, SchemaOp* op){
+Dbdict::create_fg_abort_start(Signal* signal, SchemaOp* op)
+{
   CreateFilegroupImplReq* req = 
     (CreateFilegroupImplReq*)signal->getDataPtrSend();
 
@@ -15676,13 +15780,13 @@
     send_drop_fg(signal, op, DropFilegroupImplReq::Commit);
     return;
   }
-  
+  jam();  
   execute(signal, op->m_callback, 0);  
 }
 
 void
-Dbdict::create_fg_abort_complete(Signal* signal, SchemaOp* op){
-  
+Dbdict::create_fg_abort_complete(Signal* signal, SchemaOp* op)
+{
   if (op->m_obj_ptr_i != RNIL)
   {
     jam();
@@ -15692,12 +15796,13 @@
     release_object(fg_ptr.p->m_obj_ptr_i);
     c_filegroup_hash.release(fg_ptr);
   }
-  
+  jam();  
   execute(signal, op->m_callback, 0);
 }
 
 void 
-Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
+Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op)
+{
   /**
    * Put data into table record
    */
@@ -15717,6 +15822,7 @@
   
   do {
     if(status != SimpleProperties::Eof){
+      jam();
       op->m_errorCode = CreateFileRef::InvalidFormat;
       break;
     }
@@ -15724,34 +15830,53 @@
     // Get Filegroup
     FilegroupPtr fg_ptr;
     if(!c_filegroup_hash.find(fg_ptr, f.FilegroupId)){
+      jam();
       op->m_errorCode = CreateFileRef::NoSuchFilegroup;
       break;
     }
     
     if(fg_ptr.p->m_version != f.FilegroupVersion){
+      jam();
       op->m_errorCode = CreateFileRef::InvalidFilegroupVersion;
       break;
     }
 
     switch(f.FileType){
     case DictTabInfo::Datafile:
+    {
       if(fg_ptr.p->m_type != DictTabInfo::Tablespace)
+      {
+        jam();
 	op->m_errorCode = CreateFileRef::InvalidFileType;
+      }
+      jam();
       break;
+    }
     case DictTabInfo::Undofile:
+    {
       if(fg_ptr.p->m_type != DictTabInfo::LogfileGroup)
+      {
+        jam();
 	op->m_errorCode = CreateFileRef::InvalidFileType;
+      }
+      jam();
       break;
+    }
     default:
+      jam();
       op->m_errorCode = CreateFileRef::InvalidFileType;
     }
     
     if(op->m_errorCode)
+    {
+      jam();
       break;
+    }
 
     Uint32 len = strlen(f.FileName) + 1;
     Uint32 hash = Rope::hash(f.FileName, len);
     if(get_object(f.FileName, len, hash) != 0){
+      jam();
       op->m_errorCode = CreateFileRef::FilenameAlreadyExists;
       break;
     }
@@ -15762,6 +15887,7 @@
 	m_ctx.m_config.getOwnConfigIterator();
       if(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl) && dl)
       {
+        jam();
 	op->m_errorCode = CreateFileRef::NotSupportedWhenDiskless;
 	break;
       }
@@ -15769,11 +15895,13 @@
     
     // Loop through all filenames...
     if(!c_obj_pool.seize(obj_ptr)){
+      jam();
       op->m_errorCode = CreateTableRef::NoMoreTableRecords;
       break;
     }
     
     if (! c_file_pool.seize(filePtr)){
+      jam();
       op->m_errorCode = CreateFileRef::OutOfFileRecords;
       break;
     }
@@ -15783,6 +15911,7 @@
     {
       Rope name(c_rope_pool, obj_ptr.p->m_name);
       if(!name.assign(f.FileName, len, hash)){
+        jam();
 	op->m_errorCode = CreateTableRef::OutOfStringBuffer;
 	break;
       }
@@ -15790,10 +15919,14 @@
 
     switch(fg_ptr.p->m_type){
     case DictTabInfo::Tablespace:
+    {
+      jam();
       increase_ref_count(fg_ptr.p->m_obj_ptr_i);
       break;
+    }
     case DictTabInfo::LogfileGroup:
     {
+      jam();
       Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
       list.add(filePtr);
       break;
@@ -15837,37 +15970,46 @@
       c_obj_pool.release(obj_ptr);
     }
   }
-  
   execute(signal, op->m_callback, 0);
 }
 
 
 void
-Dbdict::create_file_prepare_complete(Signal* signal, SchemaOp* op){
+Dbdict::create_file_prepare_complete(Signal* signal, SchemaOp* op)
+{
   /**
    * CONTACT TSMAN LGMAN PGMAN 
    */
   CreateFileImplReq* req = (CreateFileImplReq*)signal->getDataPtrSend();
-
   FilePtr f_ptr;
-  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
-
   FilegroupPtr fg_ptr;
+
+  jam();
+  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
   ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op->key;
   req->senderRef = reference();
   switch(((OpCreateObj*)op)->m_restart){
   case 0:
+  {
+    jam();
     req->requestInfo = CreateFileImplReq::Create;
     break;
+  }
   case 1:
+  {
+    jam();
     req->requestInfo = CreateFileImplReq::Open;
     break;
+  }
   case 2:
+  {
+    jam();
     req->requestInfo = CreateFileImplReq::CreateForce;
     break;
   }
+  }
 	 
   req->file_id = f_ptr.p->key;
   req->filegroup_id = f_ptr.p->m_filegroup_id;
@@ -15879,14 +16021,20 @@
   Uint32 len= 0;
   switch(op->m_obj_type){
   case DictTabInfo::Datafile:
+  {
+    jam();
     ref = TSMAN_REF;
     len = CreateFileImplReq::DatafileLength;
     req->tablespace.extent_size = fg_ptr.p->m_tablespace.m_extent_size;
     break;
+  }
   case DictTabInfo::Undofile:
+  {
+    jam();
     ref = LGMAN_REF;
     len = CreateFileImplReq::UndofileLength;
     break;
+  }
   default:
     ndbrequire(false);
   }
@@ -15901,42 +16049,41 @@
 }
 
 void
-Dbdict::execCREATE_FILE_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execCREATE_FILE_REF(Signal* signal)
+{
   CreateFileImplRef * ref = (CreateFileImplRef*)signal->getDataPtr();
-  
   CreateObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opCreateObj.find(op_ptr, ref->senderData));
   op_ptr.p->m_errorCode = ref->errorCode;
-
   execute(signal, op_ptr.p->m_callback, 0);  
 }  
 
 void
-Dbdict::execCREATE_FILE_CONF(Signal* signal){  
-  jamEntry();
-
+Dbdict::execCREATE_FILE_CONF(Signal* signal)
+{
   CreateFileImplConf * rep = 
     (CreateFileImplConf*)signal->getDataPtr();
-  
   CreateObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opCreateObj.find(op_ptr, rep->senderData));
-  
   execute(signal, op_ptr.p->m_callback, 0);  
 }
 
 void
-Dbdict::create_file_commit_start(Signal* signal, SchemaOp* op){
+Dbdict::create_file_commit_start(Signal* signal, SchemaOp* op)
+{
   /**
    * CONTACT TSMAN LGMAN PGMAN 
    */
   CreateFileImplReq* req = (CreateFileImplReq*)signal->getDataPtrSend();
-
   FilePtr f_ptr;
-  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
-
   FilegroupPtr fg_ptr;
+
+  jam();
+  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
   ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
 
   req->senderData = op->key;
@@ -15950,15 +16097,20 @@
   Uint32 ref= 0;
   switch(op->m_obj_type){
   case DictTabInfo::Datafile:
+  {
+    jam();
     ref = TSMAN_REF;
     break;
+  }
   case DictTabInfo::Undofile:
+  {
+    jam();
     ref = LGMAN_REF;
     break;
+  }
   default:
     ndbrequire(false);
   }
-  
   sendSignal(ref, GSN_CREATE_FILE_REQ, signal, 
 	     CreateFileImplReq::CommitLength, JBB);
 }
@@ -15971,9 +16123,11 @@
   if (op->m_obj_ptr_i != RNIL)
   {
     FilePtr f_ptr;
+    FilegroupPtr fg_ptr;
+
+    jam();
     c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
     
-    FilegroupPtr fg_ptr;
     ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
     
     req->senderData = op->key;
@@ -15987,20 +16141,24 @@
     Uint32 ref= 0;
     switch(op->m_obj_type){
     case DictTabInfo::Datafile:
+    {
+      jam();
       ref = TSMAN_REF;
       break;
+    }
     case DictTabInfo::Undofile:
+    {
+      jam();
       ref = LGMAN_REF;
       break;
+    }
     default:
       ndbrequire(false);
     }
-    
     sendSignal(ref, GSN_CREATE_FILE_REQ, signal, 
 	       CreateFileImplReq::AbortLength, JBB);
     return;
   }
-
   execute(signal, op->m_callback, 0);
 }
 
@@ -16010,17 +16168,21 @@
   if (op->m_obj_ptr_i != RNIL)
   {
     FilePtr f_ptr;
-    c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
-    
     FilegroupPtr fg_ptr;
+
+    jam();
+    c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
     ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
-    
     switch(fg_ptr.p->m_type){
     case DictTabInfo::Tablespace:
+    {
+      jam();
       decrease_ref_count(fg_ptr.p->m_obj_ptr_i);
       break;
+    }
     case DictTabInfo::LogfileGroup:
     {
+      jam();
       Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
       list.remove(f_ptr);
       break;
@@ -16032,19 +16194,20 @@
     release_object(f_ptr.p->m_obj_ptr_i);
     c_file_hash.release(f_ptr);
   }
-  
   execute(signal, op->m_callback, 0);
 }
 
 void
 Dbdict::drop_file_prepare_start(Signal* signal, SchemaOp* op)
 {
+  jam();
   send_drop_file(signal, op, DropFileImplReq::Prepare);
 }
 
 void
 Dbdict::drop_undofile_prepare_start(Signal* signal, SchemaOp* op)
 {
+  jam();
   op->m_errorCode = DropFileRef::DropUndoFileNotSupported;
   execute(signal, op->m_callback, 0);  
 }
@@ -16052,6 +16215,7 @@
 void
 Dbdict::drop_file_commit_start(Signal* signal, SchemaOp* op)
 {
+  jam();
   send_drop_file(signal, op, DropFileImplReq::Commit);
 }
 
@@ -16059,21 +16223,21 @@
 Dbdict::drop_file_commit_complete(Signal* signal, SchemaOp* op)
 {
   FilePtr f_ptr;
-  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
-  
   FilegroupPtr fg_ptr;
-  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
 
+  jam();
+  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
+  ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
   decrease_ref_count(fg_ptr.p->m_obj_ptr_i);
   release_object(f_ptr.p->m_obj_ptr_i);
   c_file_hash.release(f_ptr);
-
   execute(signal, op->m_callback, 0);
 }
 
 void
 Dbdict::drop_file_abort_start(Signal* signal, SchemaOp* op)
 {
+  jam();
   send_drop_file(signal, op, DropFileImplReq::Abort);
 }
 
@@ -16082,11 +16246,11 @@
 		       DropFileImplReq::RequestInfo type)
 {
   DropFileImplReq* req = (DropFileImplReq*)signal->getDataPtrSend();
-  
   FilePtr f_ptr;
-  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
-  
   FilegroupPtr fg_ptr;
+
+  jam();
+  c_file_pool.getPtr(f_ptr, op->m_obj_ptr_i);
   ndbrequire(c_filegroup_hash.find(fg_ptr, f_ptr.p->m_filegroup_id));
   
   req->senderData = op->key;
@@ -16100,29 +16264,34 @@
   Uint32 ref= 0;
   switch(op->m_obj_type){
   case DictTabInfo::Datafile:
+  {
+    jam();
     ref = TSMAN_REF;
     break;
+  }
   case DictTabInfo::Undofile:
+  {
+    jam();
     ref = LGMAN_REF;
     break;
+  }
   default:
     ndbrequire(false);
   }
-  
   sendSignal(ref, GSN_DROP_FILE_REQ, signal, 
 	     DropFileImplReq::SignalLength, JBB);
 }
 
 void
-Dbdict::execDROP_OBJ_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execDROP_OBJ_REF(Signal* signal)
+{
   DropObjRef * const ref = (DropObjRef*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, ref->senderData));
-  
   if(ref->errorCode != DropObjRef::NF_FakeErrorREF){
+    jam();
     trans_ptr.p->setErrorCode(ref->errorCode);
   }
   Uint32 node = refToNode(ref->senderRef);
@@ -16130,65 +16299,61 @@
 }
 
 void
-Dbdict::execDROP_OBJ_CONF(Signal* signal){
-  jamEntry();
-
+Dbdict::execDROP_OBJ_CONF(Signal* signal)
+{
   DropObjConf * const conf = (DropObjConf*)signal->getDataPtr();
-  
   Ptr<SchemaTransaction> trans_ptr;
+
+  jamEntry();
   ndbrequire(c_Trans.find(trans_ptr, conf->senderData));
   schemaOp_reply(signal, trans_ptr.p, refToNode(conf->senderRef));
 }
 
 void
-Dbdict::execDROP_FILE_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execDROP_FILE_REF(Signal* signal)
+{
   DropFileImplRef * ref = (DropFileImplRef*)signal->getDataPtr();
-  
   DropObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opDropObj.find(op_ptr, ref->senderData));
   op_ptr.p->m_errorCode = ref->errorCode;
-
   execute(signal, op_ptr.p->m_callback, 0);  
 }  
 
 void
-Dbdict::execDROP_FILE_CONF(Signal* signal){  
-  jamEntry();
-
+Dbdict::execDROP_FILE_CONF(Signal* signal)
+{
   DropFileImplConf * rep = 
     (DropFileImplConf*)signal->getDataPtr();
-  
   DropObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opDropObj.find(op_ptr, rep->senderData));
-  
   execute(signal, op_ptr.p->m_callback, 0);  
 }
 
 void
-Dbdict::execDROP_FILEGROUP_REF(Signal* signal){
-  jamEntry();
-
+Dbdict::execDROP_FILEGROUP_REF(Signal* signal)
+{
   DropFilegroupImplRef * ref = (DropFilegroupImplRef*)signal->getDataPtr();
-  
   DropObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opDropObj.find(op_ptr, ref->senderData));
   op_ptr.p->m_errorCode = ref->errorCode;
-
   execute(signal, op_ptr.p->m_callback, 0);  
 }  
 
 void
-Dbdict::execDROP_FILEGROUP_CONF(Signal* signal){  
-  jamEntry();
-
+Dbdict::execDROP_FILEGROUP_CONF(Signal* signal)
+{
   DropFilegroupImplConf * rep = 
     (DropFilegroupImplConf*)signal->getDataPtr();
-  
   DropObjRecordPtr op_ptr;
+
+  jamEntry();
   ndbrequire(c_opDropObj.find(op_ptr, rep->senderData));
-  
   execute(signal, op_ptr.p->m_callback, 0);  
 }
 
@@ -16201,11 +16366,13 @@
   DictObject * obj = c_obj_pool.getPtr(fg_ptr.p->m_obj_ptr_i);
   if (obj->m_ref_count)
   {
+    jam();
     op->m_errorCode = DropFilegroupRef::FilegroupInUse;
     execute(signal, op->m_callback, 0);  
   }
   else
   {
+    jam();
     send_drop_fg(signal, op, DropFilegroupImplReq::Prepare);
   }
 }
@@ -16217,7 +16384,7 @@
   c_filegroup_pool.getPtr(fg_ptr, op->m_obj_ptr_i);
   if (op->m_obj_type == DictTabInfo::LogfileGroup)
   {
-    
+    jam(); 
     /**
      * Mark all undofiles as dropped
      */
@@ -16226,6 +16393,7 @@
     XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
     for(list.first(filePtr); !filePtr.isNull(); list.next(filePtr))
     {
+      jam();
       Uint32 objId = filePtr.p->key;
       SchemaFile::TableEntry * tableEntry = getTableEntry(xsf, objId);
       tableEntry->m_tableState = SchemaFile::DROP_TABLE_COMMITTED;
@@ -16238,13 +16406,14 @@
   else if(op->m_obj_type == DictTabInfo::Tablespace)
   {
     FilegroupPtr lg_ptr;
+    jam();
     ndbrequire(c_filegroup_hash.
 	       find(lg_ptr, 
 		    fg_ptr.p->m_tablespace.m_default_logfile_group_id));
     
     decrease_ref_count(lg_ptr.p->m_obj_ptr_i);
   }
-  
+  jam(); 
   send_drop_fg(signal, op, DropFilegroupImplReq::Commit);
 }
 
@@ -16253,16 +16422,17 @@
 {
   FilegroupPtr fg_ptr;
   c_filegroup_pool.getPtr(fg_ptr, op->m_obj_ptr_i);
-  
+
+  jam();
   release_object(fg_ptr.p->m_obj_ptr_i);
   c_filegroup_hash.release(fg_ptr);
-
   execute(signal, op->m_callback, 0);
 }
 
 void
 Dbdict::drop_fg_abort_start(Signal* signal, SchemaOp* op)
 {
+  jam();
   send_drop_fg(signal, op, DropFilegroupImplReq::Abort);
 }
 
@@ -16285,16 +16455,20 @@
   Uint32 ref= 0;
   switch(op->m_obj_type){
   case DictTabInfo::Tablespace:
+  {
+    jam();
     ref = TSMAN_REF;
     break;
+  }
   case DictTabInfo::LogfileGroup:
+  {
+    jam();
     ref = LGMAN_REF;
     break;
+  }
   default:
     ndbrequire(false);
   }
-  
   sendSignal(ref, GSN_DROP_FILEGROUP_REQ, signal, 
 	     DropFilegroupImplReq::SignalLength, JBB);
 }
-

--- 1.38/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp	2007-01-16 14:26:52 -08:00
+++ 1.39/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp	2007-01-16 14:26:52 -08:00
@@ -30,6 +30,7 @@
 #include <signaldata/FsRef.hpp>
 #include <signaldata/FsOpenReq.hpp>
 #include <signaldata/FsReadWriteReq.hpp>
+#include <Configuration.hpp>
 
 // use this to test broken pread code
 //#define HAVE_BROKEN_PREAD 
@@ -109,6 +110,7 @@
   const NDB_THREAD_STACKSIZE stackSize = 8192;
 
   char buf[16];
+  struct ThreadContainer container;
   numAsyncFiles++;
   BaseString::snprintf(buf, sizeof(buf), "AsyncFile%d", numAsyncFiles);
 
@@ -116,11 +118,19 @@
   theStartConditionPtr = NdbCondition_Create();
   NdbMutex_Lock(theStartMutexPtr);
   theStartFlag = false;
-  theThreadPtr = NdbThread_Create(runAsyncFile,
+  container.conf = globalEmulatorData.theConfiguration;
+  container.type = NdbfsThread;
+  theThreadPtr = NdbThread_CreateWithFunc(runAsyncFile,
                                   (void**)this,
                                   stackSize,
                                   (char*)&buf,
-                                  NDB_THREAD_PRIO_MEAN);
+                                  NDB_THREAD_PRIO_MEAN,
+                                  add_thread_id,
+                                  &container,
+                                  sizeof(container),
+                                  remove_thread_id,
+                                  &container,
+                                  sizeof(container));
   if (theThreadPtr == 0)
     ERROR_SET(fatal, NDBD_EXIT_MEMALLOC, "","Could not allocate file system thread");
 

--- 1.62/storage/ndb/src/kernel/main.cpp	2007-01-16 14:26:52 -08:00
+++ 1.63/storage/ndb/src/kernel/main.cpp	2007-01-16 14:26:52 -08:00
@@ -458,20 +458,19 @@
       ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
 		"Connection to mgmd terminated before setup was complete", 
 		"StopOnError missing");
-
   if (!globalTransporterRegistry.start_clients()){
     ndbout_c("globalTransporterRegistry.start_clients() failed");
     exit(-1);
   }
-
   globalEmulatorData.theWatchDog->doStart();
-  
   globalEmulatorData.m_socket_server->startServer();
 
   //  theConfig->closeConfiguration();
-
-  globalEmulatorData.theThreadConfig->ipControlLoop();
-  
+  {
+    Uint32 inx = globalEmulatorData.theConfiguration->addThreadId(MainThread);
+    globalEmulatorData.theThreadConfig->ipControlLoop();
+    globalEmulatorData.theConfiguration->removeThreadId(inx);
+  }
   NdbShutdown(NST_Normal);
 
   return NRT_Default;

--- 1.54/storage/ndb/src/kernel/vm/Configuration.cpp	2007-01-16 14:26:52 -08:00
+++ 1.55/storage/ndb/src/kernel/vm/Configuration.cpp	2007-01-16 14:26:52 -08:00
@@ -37,6 +37,7 @@
 #include "pc.hpp"
 #include <LogLevel.hpp>
 #include <NdbSleep.h>
+#include <NdbThread.h>
 
 extern "C" {
   void ndbSetOwnVersion();
@@ -203,7 +204,14 @@
     _initialStart = true;
     g_start_type |= (1 << NodeState::ST_INITIAL_START);
   }
-  
+
+  threadIdMutex = NdbMutex_Create();
+  if (!threadIdMutex)
+  {
+    ndbout_c("Failed to create threadIdMutex");
+    exit(-1);
+  }
+  initThreadArray();
   return true;
 }
 
@@ -443,6 +451,31 @@
 	      "TimeBetweenWatchDogCheck missing");
   }
 
+  if(iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer)){
+    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
+	      "SchedulerExecutionTimer missing");
+  }
+
+  if(iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer)){
+    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
+	      "SchedulerSpinTimer missing");
+  }
+
+  if(iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler)){
+    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
+	      "RealtimeScheduler missing");
+  }
+
+  if(iter.get(CFG_DB_EXECUTE_LOCK_CPU, &_executeLockCPU)){
+    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
+	      "LockExecuteThreadToCPU missing");
+  }
+
+  if(iter.get(CFG_DB_MAINT_LOCK_CPU, &_maintLockCPU)){
+    ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched", 
+	      "LockMaintThreadsToCPU missing");
+  }
+
   /**
    * Get paths
    */  
@@ -485,6 +518,73 @@
 }
 
 int 
+Configuration::schedulerExecutionTimer() const {
+  return _schedulerExecutionTimer;
+}
+
+void 
+Configuration::schedulerExecutionTimer(int value) {
+  if (value < 11000)
+    _schedulerExecutionTimer = value;
+}
+
+int 
+Configuration::schedulerSpinTimer() const {
+  return _schedulerSpinTimer;
+}
+
+void 
+Configuration::schedulerSpinTimer(int value) {
+  if (value < 11000)
+    _schedulerSpinTimer = value;
+}
+
+bool 
+Configuration::realtimeScheduler() const
+{
+  return (bool)_realtimeScheduler;
+}
+
+void 
+Configuration::realtimeScheduler(bool realtime_on)
+{
+   bool old_value = (bool)_realtimeScheduler;
+  _realtimeScheduler = (Uint32)realtime_on;
+  if (old_value != realtime_on)
+    setAllRealtimeScheduler();
+}
+
+Uint32
+Configuration::executeLockCPU() const
+{
+  return _executeLockCPU;
+}
+
+void
+Configuration::executeLockCPU(Uint32 value)
+{
+  Uint32 old_value = _executeLockCPU;
+  _executeLockCPU = value;
+  if (value != old_value)
+    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;
 }
@@ -892,3 +992,186 @@
 Configuration::setInitialStart(bool val){
   _initialStart = val;
 }
+
+void
+Configuration::setAllRealtimeScheduler()
+{
+  Uint32 i;
+  for (i = 0; i < threadInfo.size(); i++)
+  {
+    if (threadInfo[i].type != NotInUse)
+    {
+      if (setRealtimeScheduler(threadInfo[i].threadHandle,
+                               threadInfo[i].type,
+                               FALSE))
+        return;
+    }
+  }
+}
+
+void
+Configuration::setAllLockCPU(bool exec_thread)
+{
+  Uint32 i;
+  for (i = 0; i < threadInfo.size(); i++)
+  {
+    if (threadInfo[i].type != NotInUse)
+    {
+      if (setLockCPU(threadInfo[i].threadId,
+                     threadInfo[i].type,
+                     exec_thread,
+                     FALSE))
+        return;
+    }
+  }
+}
+
+int
+Configuration::setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
+                                    enum ThreadTypes type,
+                                    bool init)
+{
+  /*
+    We ignore thread characteristics on platforms where we cannot
+    determine the thread id.
+  */
+  if (!threadHandle)
+    return 0; 
+  if (!init || _realtimeScheduler)
+  {
+    int error_no;
+    ndbout << "Set scheduler " << _realtimeScheduler;
+    ndbout << " threadHandle = " << (int)threadHandle << endl;
+    if ((error_no = Ndb_SetScheduler(threadHandle, _realtimeScheduler,
+                                    (type != MainThread))))
+    {
+      ndbout << "Set scheduler failed with error_no = " << error_no << endl;
+      ;//Warning, no permission to set scheduler
+      return 1;
+    }
+  }
+  return 0;
+}
+
+int
+Configuration::setLockCPU(NDB_TID_TYPE threadId,
+                          enum ThreadTypes type,
+                          bool exec_thread,
+                          bool init)
+{
+  Uint32 cpu_id;
+  /*
+    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 (!threadId)
+    return 0;
+  if ((exec_thread && type != MainThread) ||
+      (!exec_thread && type == MainThread))
+    return 0;
+  if (type == MainThread)
+    cpu_id = _executeLockCPU;
+  else
+    cpu_id = _maintLockCPU;
+  if (!init ||
+      cpu_id != NO_LOCK_CPU)
+  {
+    int error_no;
+    ndbout << "Lock threadId = " << threadId;
+    ndbout << " to CPU id = " << cpu_id << endl;
+    if ((error_no = Ndb_LockCPU(threadId, cpu_id)))
+    {
+      ndbout << "Failed to lock CPU, error_no = " << error_no << endl;
+      ;//Warning, no permission to lock thread to CPU
+      return 1;
+    }
+  }
+  return 0;
+}
+
+void fill_thread_object(void *param, uint *len, bool server)
+{
+  struct ThreadContainer container;
+
+  memset((char*)&container, sizeof(container), 0);
+  container.conf = globalEmulatorData.theConfiguration;
+  container.type = server ? SocketServerThread : SocketClientThread;
+  memcpy((char*)param, (char*)&container, sizeof(container));
+  *len = sizeof(container);
+}
+
+void*
+add_thread_id(void *param)
+{
+  struct ThreadContainer container;
+
+  memcpy((char*)&container, param, sizeof(struct ThreadContainer));
+  container.index = container.conf->addThreadId(container.type);
+  memcpy(param, (char*)&container, sizeof(struct ThreadContainer));
+  return NULL;
+}
+
+void*
+remove_thread_id(void *param)
+{
+  struct ThreadContainer container;
+
+  memcpy((char*)&container, param, sizeof(struct ThreadContainer));
+  container.conf->removeThreadId(container.index);
+  return NULL;
+}
+
+Uint32 Configuration::addThreadId(enum ThreadTypes type)
+{
+  NDB_TID_TYPE threadId;
+  NDB_THAND_TYPE threadHandle;
+  Uint32 i, cpu_id;
+  NdbMutex_Lock(threadIdMutex);
+  for (i = 0; i < threadInfo.size(); i++)
+  {
+    if (threadInfo[i].type == NotInUse)
+      break;
+  }
+  if (i == threadInfo.size())
+  {
+    struct ThreadInfo tmp;
+    threadInfo.push_back(tmp);
+  }
+  threadHandle = Ndb_getThreadHandle();
+  threadInfo[i].threadHandle = threadHandle;
+  threadId = Ndb_getThreadId();
+  threadInfo[i].threadId = threadId;
+  threadInfo[i].type = type;
+  NdbMutex_Unlock(threadIdMutex);
+  setRealtimeScheduler(threadHandle, type, TRUE);
+  setLockCPU(threadId, type, (type == MainThread), TRUE);
+  return i;
+}
+
+void
+Configuration::removeThreadId(Uint32 index)
+{
+  NdbMutex_Lock(threadIdMutex);
+  threadInfo[index].threadId = 0;
+  threadInfo[index].threadHandle = 0;
+  threadInfo[index].type = NotInUse;
+  NdbMutex_Unlock(threadIdMutex);
+}
+
+void
+Configuration::initThreadArray()
+{
+  NdbMutex_Lock(threadIdMutex);
+  for (Uint32 i = 0; i < threadInfo.size(); i++)
+  {
+    threadInfo[i].threadId = 0;
+    threadInfo[i].threadHandle = 0;
+    threadInfo[i].type = NotInUse;
+  }
+  NdbMutex_Unlock(threadIdMutex);
+}
+
+template class Vector<struct ThreadInfo>;
+

--- 1.20/storage/ndb/src/kernel/vm/Configuration.hpp	2007-01-16 14:26:52 -08:00
+++ 1.21/storage/ndb/src/kernel/vm/Configuration.hpp	2007-01-16 14:26:52 -08:00
@@ -19,6 +19,37 @@
 #include <util/BaseString.hpp>
 #include <mgmapi.h>
 #include <ndb_types.h>
+#include <NdbMutex.h>
+#include <NdbThread.h>
+
+enum ThreadTypes
+{
+  WatchDogThread = 1,
+  SocketServerThread = 2,
+  SocketClientThread = 3,
+  NdbfsThread = 3,
+  MainThread = 4,
+  NotInUse = 5
+};
+
+#define MAX_NDB_THREADS 256
+#define NO_LOCK_CPU 65535
+
+struct ThreadInfo
+{
+  NDB_TID_TYPE threadId;
+  NDB_THAND_TYPE threadHandle;
+  enum ThreadTypes type;
+};
+
+class Configuration;
+
+struct ThreadContainer
+{
+  Configuration *conf;
+  enum ThreadTypes type;
+  Uint32 index;
+};
 
 class ConfigRetriever;
 
@@ -37,7 +68,35 @@
   void closeConfiguration(bool end_session= true);
   
   bool lockPagesInMainMemory() const;
-  
+
+  int schedulerExecutionTimer() const;
+  void schedulerExecutionTimer(int value);
+
+  int schedulerSpinTimer() const;
+  void schedulerSpinTimer(int value);
+
+  bool realtimeScheduler() const;
+  void realtimeScheduler(bool realtime_on);
+
+  Uint32 executeLockCPU() const;
+  void executeLockCPU(Uint32 value);
+
+  Uint32 maintLockCPU() const;
+  void maintLockCPU(Uint32 value);
+
+  void setAllRealtimeScheduler();
+  void setAllLockCPU(bool exec_thread);
+  int setLockCPU(NDB_TID_TYPE threadId,
+                 enum ThreadTypes type,
+                 bool exec_thread,
+                 bool init);
+  int setRealtimeScheduler(NDB_THAND_TYPE threadHandle,
+                           enum ThreadTypes type,
+                           bool init);
+  Uint32 addThreadId(enum ThreadTypes type);
+  void removeThreadId(Uint32 index);
+  void initThreadArray();
+
   int timeBetweenWatchDogCheck() const ;
   void timeBetweenWatchDogCheck(int value);
   
@@ -84,6 +143,14 @@
   Uint32 _maxErrorLogs;
   Uint32 _lockPagesInMainMemory;
   Uint32 _timeBetweenWatchDogCheck;
+  Uint32 _schedulerExecutionTimer;
+  Uint32 _schedulerSpinTimer;
+  Uint32 _realtimeScheduler;
+  Uint32 _executeLockCPU;
+  Uint32 _maintLockCPU;
+
+  Vector<struct ThreadInfo> threadInfo;
+  NdbMutex *threadIdMutex;
 
   ndb_mgm_configuration * m_ownConfig;
   ndb_mgm_configuration * m_clusterConfig;

--- 1.10/storage/ndb/src/kernel/vm/FastScheduler.cpp	2007-01-16 14:26:52 -08:00
+++ 1.11/storage/ndb/src/kernel/vm/FastScheduler.cpp	2007-01-16 14:26:52 -08:00
@@ -497,3 +497,37 @@
   execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
 }
 
+void 
+FastScheduler::reportThreadConfigLoop(Uint32 expired_time,
+                                      Uint32 extra_constant,
+                                      Uint32 *no_exec_loops,
+                                      Uint32 *tot_exec_time,
+                                      Uint32 *no_extra_loops,
+                                      Uint32 *tot_extra_time)
+{
+  SignalT<6> signalT;
+  Signal &signal= *(Signal*)&signalT;
+
+  memset(&signal.header, 0, sizeof(signal.header));
+  signal.header.theLength = 6;
+  signal.header.theSendersSignalId = 0;
+  signal.header.theSendersBlockRef = numberToRef(0, 0);  
+
+  signal.theData[0] = NDB_LE_ThreadConfigLoop;
+  signal.theData[1] = expired_time;
+  signal.theData[2] = extra_constant;
+  signal.theData[3] = (*tot_exec_time)/(*no_exec_loops);
+  signal.theData[4] = *no_extra_loops;
+  if (*no_extra_loops > 0)
+    signal.theData[5] = (*tot_extra_time)/(*no_extra_loops);
+  else
+    signal.theData[5] = 0;
+
+  *no_exec_loops = 0;
+  *tot_exec_time = 0;
+  *no_extra_loops = 0;
+  *tot_extra_time = 0;
+
+  execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
+}
+

--- 1.5/storage/ndb/src/kernel/vm/FastScheduler.hpp	2007-01-16 14:26:52 -08:00
+++ 1.6/storage/ndb/src/kernel/vm/FastScheduler.hpp	2007-01-16 14:26:52 -08:00
@@ -115,7 +115,10 @@
   void insertTimeQueue(Signal* aSignal, BlockNumber bnr,
 		       GlobalSignalNumber gsn, Uint32 aIndex);
   void scheduleTimeQueue(Uint32 aIndex);
-  
+  void reportThreadConfigLoop(Uint32 expired_time, Uint32 extra_constant,
+                              Uint32 *no_exec_loops, Uint32 *tot_exec_time,
+                              Uint32 *no_extra_loops, Uint32 *tot_extra_time);
+
 private:
   void highestAvailablePrio(Priority prio);
   void reportJob(Priority aPriority);

--- 1.6/storage/ndb/src/kernel/vm/ThreadConfig.cpp	2007-01-16 14:26:53 -08:00
+++ 1.7/storage/ndb/src/kernel/vm/ThreadConfig.cpp	2007-01-16 14:26:53 -08:00
@@ -99,63 +99,183 @@
 //--------------------------------------------------------------------
 void ThreadConfig::ipControlLoop()
 {
-
+  Uint32 execute_loop_constant =
+        globalEmulatorData.theConfiguration->schedulerExecutionTimer();
+  Uint32 min_spin_time = 
+    globalEmulatorData.theConfiguration->schedulerSpinTimer();
+  struct MicroSecondTimer start_micro, end_micro, statistics_start_micro;
+  Uint32 no_exec_loops = 0;
+  Uint32 no_extra_loops = 0;
+  Uint32 tot_exec_time = 0;
+  Uint32 tot_extra_time = 0;
+  Uint32 micros_passed;
+  bool spinning;
+  int res1 = 0;
+  int res2 = 0;
+  Uint32 i = 0;
+#if defined NDB_OSE || defined NDB_SOFTOSE
+//--------------------------------------------------------------------
+// To let the Cello Watchdog do it's work NDB must sleep a short 
+// period every 10 minutes. If this is not done, the watchdog will 
+// reboot the board NDB is running on when the load is high. 
+//--------------------------------------------------------------------
+  int loopCounter = 0;
+#endif
 //--------------------------------------------------------------------
 // initialise the counter that keeps track of the current millisecond
 //--------------------------------------------------------------------
   globalData.internalMillisecCounter = NdbTick_CurrentMillisecond();
-  Uint32 i = 0;
-  while (globalData.theRestartFlag != perform_stop)  { 
+  res1 = NdbTick_getMicroTimer(&start_micro);
+  end_micro = start_micro;
+  res2 = res1;
+  statistics_start_micro = start_micro;
 
-    Uint32 timeOutMillis = 0;
-    if (LEVEL_IDLE == globalData.highestAvailablePrio) {
+  while (globalData.theRestartFlag != perform_stop)  { 
+#if defined NDB_OSE || defined NDB_SOFTOSE
+    loopCounter++;
+    if(loopCounter > 1000){
 //--------------------------------------------------------------------
-// The buffers are empty, we need to wait for a while until we continue.
-// We cannot wait forever since we can also have timed events.
+// This is done to allow OSE do a context switch to let the watchdog 
+// do it's stuff.
 //--------------------------------------------------------------------
+      NdbSleep_MilliSleep(1);
+      loopCounter = 0;
+    }
+#endif
+
+
+    Uint32 timeOutMillis = 0;
 //--------------------------------------------------------------------
-// Set the time we will sleep on the sockets before waking up
-// unconditionally to 10 ms. Will never sleep more than 10 milliseconds
-// on a socket.
+// We send all messages buffered during execution of job buffers
 //--------------------------------------------------------------------
-      timeOutMillis = 10;
-    }//if
+    globalData.incrementWatchDogCounter(6);
+    globalTransporterRegistry.performSend();
+
 //--------------------------------------------------------------------
 // Now it is time to check all interfaces. We will send all buffers
 // plus checking for any received messages.
 //--------------------------------------------------------------------
     if (i++ >= 20) {
+      execute_loop_constant = 
+        globalEmulatorData.theConfiguration->schedulerExecutionTimer();
+      min_spin_time = 
+        globalEmulatorData.theConfiguration->schedulerSpinTimer();
       globalTransporterRegistry.update_connections();
       globalData.incrementWatchDogCounter(5);
       i = 0;
     }//if
-
-    globalData.incrementWatchDogCounter(6);
-    globalTransporterRegistry.performSend();
-    
-    globalData.incrementWatchDogCounter(7);
-    if (globalTransporterRegistry.pollReceive(timeOutMillis)) {
-      globalData.incrementWatchDogCounter(8);
-      globalTransporterRegistry.performReceive();
-    }
-
+    spinning = false;
+    do
+    {
 //--------------------------------------------------------------------
 // We scan the time queue to see if there are any timed signals that
 // is now ready to be executed.
 //--------------------------------------------------------------------
-    globalData.incrementWatchDogCounter(2);
-    scanTimeQueue(); 
+      globalData.incrementWatchDogCounter(2);
+      scanTimeQueue(); 
 
+      if (LEVEL_IDLE == globalData.highestAvailablePrio) {
+//--------------------------------------------------------------------
+// The buffers are empty, we need to wait for a while until we continue.
+// We cannot wait forever since we can also have timed events.
+//--------------------------------------------------------------------
+// We set the time to sleep on sockets before waking up to 10
+// milliseconds unless we have set spin timer to be larger than 0. In
+// this case we spin checking for events on the transporter until we
+// have expired the spin time.
+//--------------------------------------------------------------------
+        timeOutMillis = 10;
+        if (min_spin_time)
+        {
+          if (spinning)
+            res2 = NdbTick_getMicroTimer(&end_micro);
+          if (!(res1 + res2))
+          {
+            micros_passed = 
+              (Uint32)NdbTick_getMicrosPassed(start_micro, end_micro);
+            if (micros_passed < min_spin_time)
+              timeOutMillis = 0;
+          }
+        }
+      }
+
+//--------------------------------------------------------------------
+// Perform receive before entering execute loop
+//--------------------------------------------------------------------
+      globalData.incrementWatchDogCounter(7);
+      if (globalTransporterRegistry.pollReceive(timeOutMillis)) {
+        globalData.incrementWatchDogCounter(8);
+        globalTransporterRegistry.performReceive();
+      }
+      spinning = true;
+//--------------------------------------------------------------------
+// In an idle system we will use this loop to wait either for external
+// signal received or a message generated by the time queue.
+//--------------------------------------------------------------------
+    } while (LEVEL_IDLE == globalData.highestAvailablePrio);
+//--------------------------------------------------------------------
+// Get current microsecond to ensure we will continue executing
+// signals for at least a configured time while there are more
+// signals to receive.
+//--------------------------------------------------------------------
+    if (execute_loop_constant || min_spin_time)
+      res1= NdbTick_getMicroTimer(&start_micro);
+    do
+    {
 //--------------------------------------------------------------------
 // This is where the actual execution of signals occur. We execute
 // until all buffers are empty or until we have executed 2048 signals.
 //--------------------------------------------------------------------
-    globalScheduler.doJob();
-  }//while
+      globalScheduler.doJob();
 
+//--------------------------------------------------------------------
+// Get timer after executing this set of jobs. If we have passed the
+// maximum execution time we will break out of the loop always
+// otherwise we will check for new received signals before executing
+// the send of the buffers.
+// By setting exec_loop_constant to 0 we go back to the traditional
+// algorithm of sending once per receive instance.
+//--------------------------------------------------------------------
+      if (!execute_loop_constant && !min_spin_time)
+        break;
+      res2= NdbTick_getMicroTimer(&end_micro);
+      if (res1 + res2)
+        break;
+      micros_passed = (Uint32)NdbTick_getMicrosPassed(start_micro, end_micro);
+      tot_exec_time += micros_passed;
+      if (no_exec_loops++ >= 8192)
+      {
+        Uint32 expired_time = 
+          (Uint32)NdbTick_getMicrosPassed(statistics_start_micro, end_micro);
+        statistics_start_micro = end_micro;
+        globalScheduler.reportThreadConfigLoop(expired_time,
+                                               execute_loop_constant,
+                                               &no_exec_loops,
+                                               &tot_exec_time,
+                                               &no_extra_loops,
+                                               &tot_extra_time);
+      }
+      if (micros_passed > execute_loop_constant)
+        break;
+
+//--------------------------------------------------------------------
+// There were still time for execution left, we check if there are
+// signals newly received on the transporters and if so we execute one
+// more round before sending the buffered signals.
+//--------------------------------------------------------------------
+      globalData.incrementWatchDogCounter(7);
+      if (!globalTransporterRegistry.pollReceive(0))
+        break;
+
+      no_extra_loops++;
+      tot_extra_time += micros_passed;
+      start_micro = end_micro;
+      globalData.incrementWatchDogCounter(8);
+      globalTransporterRegistry.performReceive();
+    } while (1);
+  }//while
   globalData.incrementWatchDogCounter(6);
   globalTransporterRegistry.performSend();
-
 }//ThreadConfig::ipControlLoop()
 
 int

--- 1.6/storage/ndb/src/kernel/vm/WatchDog.cpp	2007-01-16 14:26:53 -08:00
+++ 1.7/storage/ndb/src/kernel/vm/WatchDog.cpp	2007-01-16 14:26:53 -08:00
@@ -22,6 +22,7 @@
 #include <NdbOut.hpp>
 #include <NdbSleep.h>
 #include <ErrorHandlingMacros.hpp>
+#include <Configuration.hpp>
    
 extern "C" 
 void* 
@@ -49,13 +50,23 @@
 }
 
 void
-WatchDog::doStart(){
+WatchDog::doStart()
+{
+  struct ThreadContainer container;
   theStop = false;
-  theThreadPtr = NdbThread_Create(runWatchDog, 
+  container.conf = globalEmulatorData.theConfiguration;
+  container.type = WatchDogThread;
+  theThreadPtr = NdbThread_CreateWithFunc(runWatchDog, 
 				  (void**)this, 
 				  32768,
 				  "ndb_watchdog",
-                                  NDB_THREAD_PRIO_HIGH);
+                                  NDB_THREAD_PRIO_HIGH,
+                                  add_thread_id,
+                                  &container,
+                                  sizeof(container),
+                                  remove_thread_id,
+                                  &container,
+                                  sizeof(container));
 }
 
 void

--- 1.57/storage/ndb/src/ndbapi/TransporterFacade.cpp	2007-01-16 14:26:53 -08:00
+++ 1.58/storage/ndb/src/ndbapi/TransporterFacade.cpp	2007-01-16 14:26:53 -08:00
@@ -60,6 +60,21 @@
  * Call back functions
  *****************************************************************************/
 
+void* add_thread_id(void *param)
+{
+  return NULL;
+}
+
+void *remove_thread_id(void *param)
+{
+  return NULL;
+}
+
+void fill_thread_object(void *param, uint *len, bool server)
+{
+  *len = 0;
+}
+
 void
 reportError(void * callbackObj, NodeId nodeId,
 	    TransporterError errorCode, const char *info)

--- 1.13/BUILD/Makefile.am	2007-01-16 14:26:53 -08:00
+++ 1.14/BUILD/Makefile.am	2007-01-16 14:26:53 -08:00
@@ -28,6 +28,7 @@
 			compile-alpha-debug \
 			compile-amd64-debug-max \
 			compile-amd64-max \
+			compile-amd64-max-sci \
 			compile-darwin-mwcc \
 			compile-dist \
 			compile-hpux11-parisc2-aCC \
@@ -52,6 +53,8 @@
 			compile-pentium-valgrind-max \
 			compile-pentium64-debug \
 			compile-pentium64-debug-max \
+			compile-pentium64-max \
+			compile-pentium64-max-sci \
 			compile-pentium64-valgrind-max \
 			compile-ppc \
 			compile-ppc-debug \

--- 1.106/libmysqld/Makefile.am	2007-01-16 14:26:53 -08:00
+++ 1.107/libmysqld/Makefile.am	2007-01-16 14:26:53 -08:00
@@ -92,7 +92,7 @@
 		$(top_builddir)/dbug/libdbug.a \
 		$(top_builddir)/vio/libvio.a \
 		@mysql_plugin_libs@ \
-		$(yassl_inc_libs)
+		$(yassl_inc_libs) @NDB_SCI_LIBS@
 
 if HAVE_YASSL
 yassl_inc_libs=	$(top_builddir)/extra/yassl/src/.libs/libyassl.a \

--- 1.36/libmysqld/examples/Makefile.am	2007-01-16 14:26:53 -08:00
+++ 1.37/libmysqld/examples/Makefile.am	2007-01-16 14:26:53 -08:00
@@ -35,7 +35,8 @@
 		-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
 		$(openssl_includes)
 LIBS =		@LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
+LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
+                @NDB_SCI_LIBS@
 
 mysqltest_embedded_LINK = $(CXXLINK)
 mysqltest_embedded_SOURCES =	mysqltest.c

--- 1.9/storage/ndb/include/mgmapi/ndb_logevent.h	2007-01-16 14:26:53 -08:00
+++ 1.10/storage/ndb/include/mgmapi/ndb_logevent.h	2007-01-16 14:26:53 -08:00
@@ -132,6 +132,8 @@
     NDB_LE_ReceiveBytesStatistic = 41,
     /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
     NDB_LE_MemoryUsage = 50,
+    /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
+    NDB_LE_ThreadConfigLoop = 61,
 
     /** NDB_MGM_EVENT_CATEGORY_ERROR */
     NDB_LE_TransporterError = 42,
@@ -175,8 +177,8 @@
     /** NDB_MGM_EVENT_CATEGORY_STARTUP */
     NDB_LE_StartReport = 60
 
-    /* 60 unused */
-    /* 61 unused */
+    /* 60 used */
+    /* 61 used */
     /* 62 unused */
 
   };
Thread
bk commit into 5.1 tree (mtaylor:1.2383)Monty Taylor16 Jan