MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:March 6 2007 5:38pm
Subject:bk commit into 5.1 tree (tomas:1.2450)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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
  1.2450 07/03/07 00:38:30 tomas@stripped +44 -0
  Merge poseidon.mysql.com:/home/tomas/mysql-5.1-new-ndb
  into  poseidon.mysql.com:/home/tomas/mysql-5.1-telco-merge

  configure.in
    1.436 07/03/07 00:38:19 tomas@stripped +1 -2
    manual merge

  storage/ndb/tools/restore/Restore.cpp
    1.48 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/test/src/NdbRestarter.cpp
    1.20 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/test/run-test/daily-basic-tests.txt
    1.74 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/test/ndbapi/testNodeRestart.cpp
    1.48 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/test/include/NdbRestarter.hpp
    1.14 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/ndberror.c
    1.88 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/SignalSender.cpp
    1.18 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbScanOperation.cpp
    1.111 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbRecAttr.cpp
    1.37 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.83 07/03/07 00:36:43 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/ClusterMgr.hpp
    1.23 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.cpp
    1.88 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.57 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.125 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
    1.32 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/ConfigInfo.cpp
    1.100 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.87 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.87 07/03/07 00:36:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.58 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
    1.25 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.52 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
    1.56 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
    1.23 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
    1.61 07/03/07 00:36:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.139 07/03/07 00:36:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
    1.51 07/03/07 00:36:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.146 07/03/07 00:36:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
    1.62 07/03/07 00:36:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
    1.115 07/03/07 00:36:39 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
    1.23 07/03/07 00:36:39 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
    1.32 07/03/07 00:36:39 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
    1.49 07/03/07 00:36:39 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.119 07/03/07 00:36:39 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
    1.50 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/backup/Backup.cpp
    1.65 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/util/ConfigValues.cpp
    1.16 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/transporter/Transporter.cpp
    1.30 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/debugger/EventLogger.cpp
    1.42 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.622 07/03/07 00:36:38 tomas@stripped +0 -0
    Auto merged

  sql/item_func.cc
    1.357 07/03/07 00:36:37 tomas@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.417 07/03/07 00:36:37 tomas@stripped +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.273 07/03/07 00:36:36 tomas@stripped +0 -0
    Auto merged

  BitKeeper/etc/ignore
    1.279 07/03/07 00:36:01 tomas@stripped +0 -0
    auto-union

# 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:	tomas
# Host:	poseidon.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-merge/RESYNC

--- 1.435/configure.in	2007-02-14 15:57:47 +07:00
+++ 1.436/configure.in	2007-03-07 00:38:19 +07:00
@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
 AC_CANONICAL_SYSTEM
 # The Docs Makefile.am parses this line!
 # remember to also update version.c in ndb
-AM_INIT_AUTOMAKE(mysql, 5.1.16-ndb-6.2.0)
+AM_INIT_AUTOMAKE(mysql, 5.1.17-ndb-6.2.0)
 AM_CONFIG_HEADER(config.h)
 
 NDB_VERSION_MAJOR=6
@@ -720,7 +720,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatin
  sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
  unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
  sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
- sys/resource.h sys/param.h)
+ sys/resource.h sys/param.h port.h)
 
 AC_CHECK_HEADERS([xfs/xfs.h])
 
@@ -988,7 +988,7 @@ case $SYSTEM_TYPE in
     AC_DEFINE([DEFAULT_SKIP_THREAD_PRIORITY], [1], [default to skip thread priority])
     if test "$ac_cv_prog_gcc" = "yes"
     then
-      FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
+      FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL"
       CFLAGS="$CFLAGS $FLAGS"
       CXXFLAGS="$CXXFLAGS $FLAGS"
       MAX_C_OPTIMIZE="-O"
@@ -1888,9 +1888,9 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bs
   pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
   realpath rename rint rwlock_init setupterm \
   shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
-  sighold sigset sigthreadmask sleep \
-  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr strtol \
-  strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
+  sighold sigset sigthreadmask port_create sleep \
+  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
+  strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
   posix_fallocate)
 
 #

--- 1.356/sql/item_func.cc	2007-02-15 20:39:16 +07:00
+++ 1.357/sql/item_func.cc	2007-03-07 00:36:37 +07:00
@@ -3087,14 +3087,8 @@ public:
   int count;
   bool locked;
   pthread_cond_t cond;
-#ifndef EMBEDDED_LIBRARY
-  pthread_t thread;
-  void set_thread(THD *thd) { thread= thd->real_id; }
-#else
-  THD       *thread;
-  void set_thread(THD *thd) { thread= thd; }
-#endif /*EMBEDDED_LIBRARY*/
-  ulong thread_id;
+  my_thread_id thread_id;
+  void set_thread(THD *thd) { thread_id= thd->thread_id; }
 
   User_level_lock(const char *key_arg,uint length, ulong id) 
     :key_length(length),count(1),locked(1), thread_id(id)
@@ -3411,11 +3405,7 @@ longlong Item_func_release_lock::val_int
   }
   else
   {
-#ifdef EMBEDDED_LIBRARY
-    if (ull->locked && (current_thd == ull->thread))
-#else
-    if (ull->locked && pthread_equal(pthread_self(),ull->thread))
-#endif
+    if (ull->locked && current_thd->thread_id == ull->thread_id)
     {
       result=1;					// Release is ok
       item_user_lock_release(ull);
@@ -3460,7 +3450,7 @@ longlong Item_func_benchmark::val_int()
   THD *thd=current_thd;
   ulong loop_count;
 
-  loop_count= args[0]->val_int();
+  loop_count= (ulong) args[0]->val_int();
 
   if (args[0]->null_value)
   {

--- 1.621/sql/mysqld.cc	2007-02-22 21:49:30 +07:00
+++ 1.622/sql/mysqld.cc	2007-03-07 00:36:38 +07:00
@@ -59,10 +59,6 @@
 
 #define mysqld_charset &my_charset_latin1
 
-#ifndef DBUG_OFF
-#define ONE_THREAD
-#endif
-
 #ifdef HAVE_purify
 #define IF_PURIFY(A,B) (A)
 #else
@@ -282,6 +278,16 @@ static TYPELIB tc_heuristic_recover_type
   array_elements(tc_heuristic_recover_names)-1,"",
   tc_heuristic_recover_names, NULL
 };
+
+static const char *thread_handling_names[]=
+{ "one-thread-per-connection", "no-threads", "pool-of-threads", NullS};
+
+TYPELIB thread_handling_typelib=
+{
+  array_elements(thread_handling_names) - 1, "",
+  thread_handling_names, NULL
+};
+
 const char *first_keyword= "first", *binary_keyword= "BINARY";
 const char *my_localhost= "localhost", *delayed_user= "DELAYED";
 #if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
@@ -467,7 +473,8 @@ ulong thread_stack, what_to_log;
 ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
 ulong open_files_limit, max_binlog_size, max_relay_log_size;
 ulong slave_net_timeout, slave_trans_retries;
-ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
+ulong thread_cache_size=0, thread_pool_size= 0;
+ulong binlog_cache_size=0, max_binlog_cache_size=0;
 ulong query_cache_size=0;
 ulong refresh_version, flush_version;	/* Increments on each reload */
 query_id_t global_query_id;
@@ -681,6 +688,8 @@ my_bool opt_enable_shared_memory;
 HANDLE smem_event_connect_request= 0;
 #endif
 
+scheduler_functions thread_scheduler;
+
 #define SSL_VARS_NOT_STATIC
 #include "sslopt-vars.h"
 #ifdef HAVE_OPENSSL
@@ -861,6 +870,7 @@ static void close_connections(void)
       continue;
 
     tmp->killed= THD::KILL_CONNECTION;
+    thread_scheduler.post_kill_notification(tmp);
     if (tmp->mysys_var)
     {
       tmp->mysys_var->abort=1;
@@ -1254,6 +1264,7 @@ void clean_up(bool print_message)
   if (!opt_bootstrap)
     (void) my_delete(pidfile_name,MYF(0));	// This may not always exist
 #endif
+  thread_scheduler.end();
   finish_client_errs();
   my_free((gptr) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
           MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
@@ -1513,6 +1524,9 @@ static void network_init(void)
   DBUG_ENTER("network_init");
   LINT_INIT(ret);
 
+  if (thread_scheduler.init())
+    unireg_abort(1);			/* purecov: inspected */
+
   set_ports();
 
   if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
@@ -1731,21 +1745,55 @@ extern "C" sig_handler end_thread_signal
   if (thd && ! thd->bootstrap)
   {
     statistic_increment(killed_threads, &LOCK_status);
-    end_thread(thd,0);
+    thread_scheduler.end_thread(thd,0);		/* purecov: inspected */
   }
   DBUG_VOID_RETURN;				/* purecov: deadcode */
 }
 
 
-void end_thread(THD *thd, bool put_in_cache)
+/*
+  Unlink thd from global list of available connections and free thd
+
+  SYNOPSIS
+    unlink_thd()
+    thd		 Thread handler
+
+  NOTES
+    LOCK_thread_count is locked and left locked
+*/
+
+void unlink_thd(THD *thd)
 {
-  DBUG_ENTER("end_thread");
+  DBUG_ENTER("unlink_thd");
+  DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
   thd->cleanup();
   (void) pthread_mutex_lock(&LOCK_thread_count);
   thread_count--;
   delete thd;
+  DBUG_VOID_RETURN;
+}
+
 
-  if (put_in_cache && cached_thread_count < thread_cache_size &&
+/*
+  Store thread in cache for reuse by new connections
+
+  SYNOPSIS
+    cache_thread()
+
+  NOTES
+    LOCK_thread_count has to be locked
+
+  RETURN
+    0  Thread was not put in cache
+    1  Thread is to be reused by new connection.
+       (ie, caller should return, not abort with pthread_exit())
+*/
+
+
+static bool cache_thread()
+{
+  safe_mutex_assert_owner(&LOCK_thread_count);
+  if (cached_thread_count < thread_cache_size &&
       ! abort_loop && !kill_cached_threads)
   {
     /* Don't kill the thread, just put it in cache for reuse */
@@ -1758,31 +1806,56 @@ void end_thread(THD *thd, bool put_in_ca
       pthread_cond_signal(&COND_flush_thread_cache);
     if (wake_thread)
     {
+      THD *thd;
       wake_thread--;
-      thd=thread_cache.get();
-      thd->real_id=pthread_self();
+      thd= thread_cache.get();
       thd->thread_stack= (char*) &thd;          // For store_globals
       (void) thd->store_globals();
       thd->thr_create_time= time(NULL);
       threads.append(thd);
-      pthread_mutex_unlock(&LOCK_thread_count);
-      DBUG_VOID_RETURN;
+      return(1);
     }
   }
+  return(0);
+}
+
+
+/*
+  End thread for the current connection
+
+  SYNOPSIS
+    one_thread_per_connection_end()
+    thd		  Thread handler
+    put_in_cache  Store thread in cache, if there is room in it
+                  Normally this is true in all cases except when we got
+                  out of resources initializing the current thread
+
+  NOTES
+    If thread is cached, we will wait until thread is scheduled to be
+    reused and then we will return.
+    If thread is not cached, we end the thread.
+
+  RETURN
+    0    Signal to handle_one_connection to reuse connection
+*/
+
+bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
+{
+  DBUG_ENTER("one_thread_per_connection_end");
+  unlink_thd(thd);
+  if (put_in_cache)
+    put_in_cache= cache_thread();
+  pthread_mutex_unlock(&LOCK_thread_count);
+  if (put_in_cache)
+    DBUG_RETURN(0);                             // Thread is reused
 
-  /* Tell main we are ready */
-  (void) pthread_mutex_unlock(&LOCK_thread_count);
   /* It's safe to broadcast outside a lock (COND... is not deleted here) */
   DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
   (void) pthread_cond_broadcast(&COND_thread_count);
-#ifdef ONE_THREAD
-  if (!(test_flags & TEST_NO_THREADS))	// For debugging under Linux
-#endif
-  {
-    my_thread_end();
-    pthread_exit(0);
-  }
-  DBUG_VOID_RETURN;
+
+  my_thread_end();
+  pthread_exit(0);
+  DBUG_RETURN(0);                               // Impossible
 }
 
 
@@ -2123,14 +2196,15 @@ and this may fail.\n\n");
           (ulong) dflt_key_cache->key_cache_mem_size);
   fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
   fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
-  fprintf(stderr, "max_connections=%lu\n", max_connections);
+  fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
   fprintf(stderr, "threads_connected=%u\n", thread_count);
   fprintf(stderr, "It is possible that mysqld could use up to \n\
-key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %lu K\n\
+key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
 bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
 		     (global_system_variables.read_buff_size +
 		      global_system_variables.sortbuff_size) *
-		     max_connections)/ 1024);
+		     thread_scheduler.max_threads +
+                     max_connections * sizeof(THD)) / 1024);
   fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
 
 #if defined(HAVE_LINUXTHREADS)
@@ -2331,7 +2405,7 @@ pthread_handler_t signal_hand(void *arg 
     This should actually be '+ max_number_of_slaves' instead of +10,
     but the +10 should be quite safe.
   */
-  init_thr_alarm(max_connections +
+  init_thr_alarm(thread_scheduler.max_threads +
 		 global_system_variables.max_insert_delayed_threads + 10);
 #if SIGINT != THR_KILL_SIGNAL
   if (test_flags & TEST_SIGINT)
@@ -2535,18 +2609,6 @@ static void my_str_free_mysqld(void *ptr
 
 #ifdef __WIN__
 
-struct utsname
-{
-  char nodename[FN_REFLEN];
-};
-
-
-int uname(struct utsname *a)
-{
-  return -1;
-}
-
-
 pthread_handler_t handle_shutdown(void *arg)
 {
   MSG msg;
@@ -3357,7 +3419,7 @@ server.");
 #ifdef HAVE_REPLICATION
   if (opt_bin_log && expire_logs_days)
   {
-    long purge_time= time(0) - expire_logs_days*24*60*60;
+    long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
     if (purge_time >= 0)
       mysql_bin_log.purge_logs_before_date(purge_time);
   }
@@ -4009,7 +4071,7 @@ static void bootstrap(FILE *file)
   my_net_init(&thd->net,(st_vio*) 0);
   thd->max_client_packet_length= thd->net.max_packet;
   thd->security_ctx->master_access= ~(ulong)0;
-  thd->thread_id=thread_id++;
+  thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
   thread_count++;
 
   bootstrap_file=file;
@@ -4052,6 +4114,74 @@ static bool read_init_file(char *file_na
 
 
 #ifndef EMBEDDED_LIBRARY
+
+/*
+   Simple scheduler that use the main thread to handle the request
+
+   NOTES
+     This is only used for debugging, when starting mysqld with
+     --thread-handling=no-threads or --one-thread
+
+     When we enter this function, LOCK_thread_count is hold!
+*/
+   
+void handle_connection_in_main_thread(THD *thd)
+{
+  safe_mutex_assert_owner(&LOCK_thread_count);
+  thread_cache_size=0;			// Safety
+  threads.append(thd);
+  (void) pthread_mutex_unlock(&LOCK_thread_count);
+  handle_one_connection((void*) thd);
+}
+
+
+/*
+  Scheduler that uses one thread per connection
+*/
+
+void create_thread_to_handle_connection(THD *thd)
+{
+  if (cached_thread_count > wake_thread)
+  {
+    /* Get thread from cache */
+    thread_cache.append(thd);
+    wake_thread++;
+    pthread_cond_signal(&COND_thread_cache);
+  }
+  else
+  {
+    /* Create new thread to handle connection */
+    int error;
+    thread_created++;
+    threads.append(thd);
+    DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
+    thd->connect_time = time(NULL);
+    if ((error=pthread_create(&thd->real_id,&connection_attrib,
+                              handle_one_connection,
+                              (void*) thd)))
+    {
+      /* purify: begin inspected */
+      DBUG_PRINT("error",
+                 ("Can't create thread to handle request (error %d)",
+                  error));
+      thread_count--;
+      thd->killed= THD::KILL_CONNECTION;			// Safety
+      (void) pthread_mutex_unlock(&LOCK_thread_count);
+      statistic_increment(aborted_connects,&LOCK_status);
+      net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
+      (void) pthread_mutex_lock(&LOCK_thread_count);
+      close_connection(thd,0,0);
+      delete thd;
+      (void) pthread_mutex_unlock(&LOCK_thread_count);
+      return;
+      /* purecov: end */
+    }
+  }
+  (void) pthread_mutex_unlock(&LOCK_thread_count);
+  DBUG_PRINT("info",("Thread created"));
+}
+
+
 /*
   Create new thread to handle incoming connection.
 
@@ -4088,64 +4218,15 @@ static void create_new_thread(THD *thd)
     DBUG_VOID_RETURN;
   }
   pthread_mutex_lock(&LOCK_thread_count);
-  thd->thread_id=thread_id++;
-
-  thd->real_id=pthread_self();			// Keep purify happy
+  thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
 
   /* Start a new thread to handle connection */
   thread_count++;
 
-#ifdef ONE_THREAD
-  if (test_flags & TEST_NO_THREADS)		// For debugging under Linux
-  {
-    thread_cache_size=0;			// Safety
-    threads.append(thd);
-    thd->real_id=pthread_self();
-    (void) pthread_mutex_unlock(&LOCK_thread_count);
-    handle_one_connection((void*) thd);
-  }
-  else
-#endif
-  {
-    if (thread_count-delayed_insert_threads > max_used_connections)
-      max_used_connections=thread_count-delayed_insert_threads;
+  if (thread_count - delayed_insert_threads > max_used_connections)
+    max_used_connections= thread_count - delayed_insert_threads;
 
-    if (cached_thread_count > wake_thread)
-    {
-      thread_cache.append(thd);
-      wake_thread++;
-      pthread_cond_signal(&COND_thread_cache);
-    }
-    else
-    {
-      int error;
-      thread_created++;
-      threads.append(thd);
-      DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
-      thd->connect_time = time(NULL);
-      if ((error=pthread_create(&thd->real_id,&connection_attrib,
-				handle_one_connection,
-				(void*) thd)))
-      {
-	DBUG_PRINT("error",
-		   ("Can't create thread to handle request (error %d)",
-		    error));
-	thread_count--;
-	thd->killed= THD::KILL_CONNECTION;			// Safety
-	(void) pthread_mutex_unlock(&LOCK_thread_count);
-	statistic_increment(aborted_connects,&LOCK_status);
-	net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
-	(void) pthread_mutex_lock(&LOCK_thread_count);
-	close_connection(thd,0,0);
-	delete thd;
-	(void) pthread_mutex_unlock(&LOCK_thread_count);
-	DBUG_VOID_RETURN;
-      }
-    }
-    (void) pthread_mutex_unlock(&LOCK_thread_count);
-
-  }
-  DBUG_PRINT("info",("Thread created"));
+  thread_scheduler.add_connection(thd);
   DBUG_VOID_RETURN;
 }
 #endif /* EMBEDDED_LIBRARY */
@@ -4896,6 +4977,7 @@ enum options_mysqld
   OPT_GENERAL_LOG,
   OPT_SLOW_LOG,
   OPT_MERGE,
+  OPT_THREAD_HANDLING,
   OPT_INNODB_ROLLBACK_ON_TIMEOUT
 };
 
@@ -5509,11 +5591,9 @@ Disable with --skip-ndbcluster (will sav
    (gptr*) &global_system_variables.old_passwords,
    (gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
-#ifdef ONE_THREAD
   {"one-thread", OPT_ONE_THREAD,
-   "Only use one thread (for debugging under Linux).", 0, 0, 0, GET_NO_ARG,
-   NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
+   "(deprecated): Only use one thread (for debugging under Linux). Use thread-handling=no-threads instead",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
    "Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)",
    (gptr*) &opt_old_style_user_limits, (gptr*) &opt_old_style_user_limits,
@@ -5992,7 +6072,7 @@ The minimum value for this variable is 4
   // children, to avoid "too many connections" error in a common setup
   {"max_connections", OPT_MAX_CONNECTIONS,
    "The number of simultaneous clients allowed.", (gptr*) &max_connections,
-   (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 16384, 0, 1,
+   (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
    0},
   {"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
    "Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.",
@@ -6283,6 +6363,12 @@ The minimum value for this variable is 4
    "Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
    (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
    DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0},
+#if HAVE_POOL_OF_THREADS == 1
+  {"thread_pool_size", OPT_THREAD_CACHE_SIZE,
+   "How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'",
+   (gptr*) &thread_pool_size, (gptr*) &thread_pool_size, 0, GET_ULONG,
+   REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
+#endif
   {"thread_stack", OPT_THREAD_STACK,
    "The stack size for each thread.", (gptr*) &thread_stack,
    (gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
@@ -6307,6 +6393,10 @@ The minimum value for this variable is 4
    (gptr*) &global_system_variables.trans_prealloc_size,
    (gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
    REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
+  {"thread_handling", OPT_THREAD_HANDLING,
+   "Define threads usage for handling queries:  "
+   "one-thread-per-connection or no-threads", 0, 0,
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT,
    "1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).",
    (gptr*) &global_system_variables.updatable_views_with_limit,
@@ -7248,7 +7338,6 @@ get_one_option(int optid, const struct m
     break;
   case 'T':
     test_flags= argument ? (uint) atoi(argument) : 0;
-    test_flags&= ~TEST_NO_THREADS;
     opt_endinfo=1;
     break;
   case (int) OPT_BIG_TABLES:
@@ -7480,11 +7569,6 @@ get_one_option(int optid, const struct m
     opt_skip_show_db=1;
     opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
     break;
-#ifdef ONE_THREAD
-  case (int) OPT_ONE_THREAD:
-    test_flags |= TEST_NO_THREADS;
-#endif
-    break;
   case (int) OPT_WANT_CORE:
     test_flags |= TEST_CORE_ON_SIGNAL;
     break;
@@ -7730,6 +7814,23 @@ get_one_option(int optid, const struct m
 						   sql_mode);
     break;
   }
+  case OPT_ONE_THREAD:
+    global_system_variables.thread_handling= 2;
+    break;
+  case OPT_THREAD_HANDLING:
+  {
+    if ((global_system_variables.thread_handling=
+         find_type(argument, &thread_handling_typelib, 2)) <= 0 ||
+        (global_system_variables.thread_handling == SCHEDULER_POOL_OF_THREADS
+         && !HAVE_POOL_OF_THREADS))
+    {
+      /* purecov: begin tested */
+      fprintf(stderr,"Unknown/unsupported thread-handling: %s\n",argument);
+      exit(1);
+      /* purecov: end */
+    }
+    break;
+  }
   case OPT_FT_BOOLEAN_SYNTAX:
     if (ft_boolean_check_syntax_string((byte*) argument))
     {
@@ -7850,6 +7951,7 @@ static void get_options(int argc,char **
   if (mysqld_chroot)
     set_root(mysqld_chroot);
 #else
+  global_system_variables.thread_handling = SCHEDULER_NO_THREADS;
   max_allowed_packet= global_system_variables.max_allowed_packet;
   net_buffer_length= global_system_variables.net_buffer_length;
 #endif
@@ -7880,6 +7982,17 @@ static void get_options(int argc,char **
 				  &global_system_variables.datetime_format))
     exit(1);
 
+#ifdef EMBEDDED_LIBRARY
+  one_thread_scheduler(&thread_scheduler);
+#else
+  if (global_system_variables.thread_handling <=
+      SCHEDULER_ONE_THREAD_PER_CONNECTION)
+    one_thread_per_connection_scheduler(&thread_scheduler);
+  else if (global_system_variables.thread_handling == SCHEDULER_NO_THREADS)
+    one_thread_scheduler(&thread_scheduler);
+  else
+    pool_of_threads_scheduler(&thread_scheduler);  /* purecov: tested */
+#endif
 }
 
 
@@ -8220,5 +8333,3 @@ template class I_List<NAMED_LIST>;
 template class I_List<Statement>;
 template class I_List_iterator<Statement>;
 #endif
-
-

--- 1.22/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2007-01-24 12:20:36 +07:00
+++ 1.23/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2007-03-07 00:36:41 +07:00
@@ -153,12 +153,10 @@ Dbtup::Disk_alloc_info::Disk_alloc_info(
     return;
   
   Uint32 min_size= 4*tabPtrP->m_offsets[DD].m_fix_header_size;
-  Uint32 var_size= tabPtrP->m_offsets[DD].m_max_var_offset;
   
   if (tabPtrP->m_attributes[DD].m_no_of_varsize == 0)
   {
     Uint32 recs_per_page= (4*Tup_fixsize_page::DATA_WORDS)/min_size;
-    Uint32 pct_free= 0;
     m_page_free_bits_map[0] = recs_per_page; // 100% free
     m_page_free_bits_map[1] = 1;
     m_page_free_bits_map[2] = 0;
@@ -317,7 +315,7 @@ Dbtup::restart_setup_page(Disk_alloc_inf
 			    0, 0, 0);
     unsigned uncommitted, committed;
     uncommitted = committed = ~(unsigned)0;
-    int ret = tsman.get_page_free_bits(&page, &uncommitted, &committed);
+    (void) tsman.get_page_free_bits(&page, &uncommitted, &committed);
     
     idx = alloc.calc_page_free_bits(real_free);
     ddassert(idx == committed);
@@ -858,9 +856,6 @@ Dbtup::disk_page_set_dirty(PagePtr pageP
 
   if (DBG_DISK)
     ndbout << " disk_page_set_dirty " << key << endl;
-  
-  Uint32 tableId = pagePtr.p->m_table_id;
-  Uint32 fragId = pagePtr.p->m_fragment_id;
   
   Ptr<Tablerec> tabPtr;
   tabPtr.i= pagePtr.p->m_table_id;

--- 1.15/storage/ndb/src/common/util/ConfigValues.cpp	2007-02-06 04:13:42 +07:00
+++ 1.16/storage/ndb/src/common/util/ConfigValues.cpp	2007-03-07 00:36:38 +07:00
@@ -88,18 +88,18 @@ bool
 ConfigValues::getByPos(Uint32 pos, Entry * result) const {
   assert(pos < (2 * m_size));
   Uint32 keypart = m_values[pos];
-  Uint32 val = m_values[pos+1];
+  Uint32 val2 = m_values[pos+1];
 
   switch(::getTypeOf(keypart)){
   case IntType:
   case SectionType:
-    result->m_int = val;
+    result->m_int = val2;
     break;
   case StringType:
-    result->m_string = * getString(val);
+    result->m_string = * getString(val2);
     break;
   case Int64Type:
-    result->m_int64 = * get64(val);
+    result->m_int64 = * get64(val2);
     break;
   case InvalidType: 
   default:

--- 1.272/mysql-test/mysql-test-run.pl	2007-02-22 21:49:30 +07:00
+++ 1.273/mysql-test/mysql-test-run.pl	2007-03-07 00:36:36 +07:00
@@ -409,24 +409,24 @@ sub main () {
     {
       next if $test->{skip};
 
-      $need_ndbcluster||= $test->{ndb_test};
-      $need_im||= $test->{component_id} eq 'im';
-
-      # Count max number of slaves used by a test case
-      if ( $test->{slave_num} > $max_slave_num)
+      if (!$opt_extern)
       {
-	$max_slave_num= $test->{slave_num};
-	mtr_error("Too many slaves") if $max_slave_num > 3;
-      }
+	$need_ndbcluster||= $test->{ndb_test};
+	$need_im||= $test->{component_id} eq 'im';
 
-      # Count max number of masters used by a test case
-      if ( $test->{master_num} > $max_master_num)
-      {
-	$max_master_num= $test->{master_num};
-	mtr_error("Too many masters") if $max_master_num > 2;
-	mtr_error("Too few masters") if $max_master_num < 1;
-      }
+	# Count max number of slaves used by a test case
+	if ( $test->{slave_num} > $max_slave_num) {
+	  $max_slave_num= $test->{slave_num};
+	  mtr_error("Too many slaves") if $max_slave_num > 3;
+	}
 
+	# Count max number of masters used by a test case
+	if ( $test->{master_num} > $max_master_num) {
+	  $max_master_num= $test->{master_num};
+	  mtr_error("Too many masters") if $max_master_num > 2;
+	  mtr_error("Too few masters") if $max_master_num < 1;
+	}
+      }
       $use_innodb||= $test->{'innodb_test'};
     }
 
@@ -700,7 +700,9 @@ sub command_line_setup () {
 				       "$glob_basedir/client",
 				       "$glob_basedir/bin");
 
-  $exe_mysqld=         mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
+  if (!$opt_extern)
+  {
+    $exe_mysqld=       mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
 				       "$glob_basedir/sql/mysqld",
 				       "$path_client_bindir/mysqld-max-nt",
 				       "$path_client_bindir/mysqld-max",
@@ -712,8 +714,16 @@ sub command_line_setup () {
 				       "$glob_basedir/bin/mysqld",
 				       "$glob_basedir/sbin/mysqld");
 
-  # Use the mysqld found above to find out what features are available
-  collect_mysqld_features();
+    # Use the mysqld found above to find out what features are available
+    collect_mysqld_features();
+  }
+  else
+  {
+    $mysqld_variables{'port'}= 3306;
+    $mysqld_variables{'master-port'}= 3306;
+    $opt_skip_ndbcluster= 1;
+    $opt_skip_im= 1;
+  }
 
   if ( $opt_comment )
   {
@@ -750,7 +760,7 @@ sub command_line_setup () {
   # --------------------------------------------------------------------------
   # NOTE if the default binlog format is changed, this has to be changed
   $used_binlog_format= "stmt";
-  if ( $mysql_version_id >= 50100 )
+  if (!$opt_extern && $mysql_version_id >= 50100 )
   {
     $used_binlog_format= "mixed"; # Default value for binlog format
 
@@ -836,19 +846,20 @@ sub command_line_setup () {
   # --------------------------------------------------------------------------
   # Check im suport
   # --------------------------------------------------------------------------
-  if ( $mysql_version_id < 50000 )
+  if (!$opt_extern)
   {
-    # Instance manager is not supported until 5.0
-    $opt_skip_im= 1;
+    if ( $mysql_version_id < 50000 ) {
+      # Instance manager is not supported until 5.0
+      $opt_skip_im= 1;
 
-  }
+    }
 
-  if ( $glob_win32 )
-  {
-    mtr_report("Disable Instance manager - not supported on Windows");
-    $opt_skip_im= 1;
-  }
+    if ( $glob_win32 ) {
+      mtr_report("Disable Instance manager - not supported on Windows");
+      $opt_skip_im= 1;
+    }
 
+  }
   # --------------------------------------------------------------------------
   # Record flag
   # --------------------------------------------------------------------------
@@ -1212,7 +1223,7 @@ sub command_line_setup () {
     $opt_skip_rpl= 1;
 
     # Setup master->[0] with the settings for the extern server
-    $master->[0]->{'path_sock'}=  $opt_socket if $opt_socket;
+    $master->[0]->{'path_sock'}=  $opt_socket ? $opt_socket : "/tmp/mysql.sock";
     mtr_report("Using extern server at '$master->[0]->{path_sock}'");
   }
   else
@@ -1478,61 +1489,66 @@ sub executable_setup () {
   $exe_mysqlbinlog=    mtr_exe_exists("$path_client_bindir/mysqlbinlog");
   $exe_mysqladmin=     mtr_exe_exists("$path_client_bindir/mysqladmin");
   $exe_mysql=          mtr_exe_exists("$path_client_bindir/mysql");
-  if ( $mysql_version_id >= 50100 )
-  {
-    $exe_mysqlslap=    mtr_exe_exists("$path_client_bindir/mysqlslap");
-  }
-  if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
-  {
-    $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
-  }
-  else
-  {
-    $exe_mysql_upgrade= "";
-  }
 
-  if ( ! $glob_win32 )
+  if (!$opt_extern)
   {
-    # Look for mysql_fix_system_table script
-    $exe_mysql_fix_system_tables=
-      mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
-			"$path_client_bindir/mysql_fix_privilege_tables");
-  }
-
-  # Look for mysql_fix_privilege_tables.sql script
-  $file_mysql_fix_privilege_tables=
-    mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
-		    "$glob_basedir/share/mysql_fix_privilege_tables.sql");
-
-  if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
-  {
-    mtr_warning("Could not find all required ndb binaries, " .
-		"all ndb tests will fail, use --skip-ndbcluster to " .
-		"skip testing it.");
+    if ( $mysql_version_id >= 50100 )
+    {
+      $exe_mysqlslap=    mtr_exe_exists("$path_client_bindir/mysqlslap");
+    }
+    if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
+    {
+      $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
+    }
+    else
+    {
+      $exe_mysql_upgrade= "";
+    }
 
-    foreach my $cluster (@{$clusters})
+    if ( ! $glob_win32 )
     {
-      $cluster->{"executable_setup_failed"}= 1;
+      # Look for mysql_fix_system_table script
+      $exe_mysql_fix_system_tables=
+        mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
+  			"$path_client_bindir/mysql_fix_privilege_tables");
     }
-  }
 
-  if ( ! $opt_skip_im and executable_setup_im())
-  {
-    mtr_warning("Could not find all required instance manager binaries, " .
-		"all im tests will fail, use --skip-im to " .
-		"continue without instance manager");
-    $instance_manager->{"executable_setup_failed"}= 1;
-  }
+    # Look for mysql_fix_privilege_tables.sql script
+    $file_mysql_fix_privilege_tables=
+      mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
+  		    "$glob_basedir/share/mysql_fix_privilege_tables.sql");
 
-  # Look for the udf_example library
-  $lib_udf_example=
-    mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
-                    "$glob_basedir/sql/.libs/udf_example.so",);
+    if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
+    {
+      mtr_warning("Could not find all required ndb binaries, " .
+  		"all ndb tests will fail, use --skip-ndbcluster to " .
+  		"skip testing it.");
 
-  # Look for the ha_example library
-  $lib_example_plugin=
-    mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
-                    "$glob_basedir/storage/example/.libs/ha_example.so",);
+      foreach my $cluster (@{$clusters})
+      {
+        $cluster->{"executable_setup_failed"}= 1;
+      }
+    }
+
+    if ( ! $opt_skip_im and executable_setup_im())
+    {
+      mtr_warning("Could not find all required instance manager binaries, " .
+  		"all im tests will fail, use --skip-im to " .
+  		"continue without instance manager");
+      $instance_manager->{"executable_setup_failed"}= 1;
+    }
+
+    # Look for the udf_example library
+    $lib_udf_example=
+      mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
+                      "$glob_basedir/sql/.libs/udf_example.so",);
+
+    # Look for the ha_example library
+    $lib_example_plugin=
+      mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+                      "$glob_basedir/storage/example/.libs/ha_example.so",);
+
+  }
 
   # Look for mysqltest executable
   if ( $glob_use_embedded_server )
@@ -1599,7 +1615,7 @@ sub mysql_client_test_arguments()
   mtr_add_arg($args, "--port=$master->[0]->{'port'}");
   mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
 
-  if ( $mysql_version_id >= 50000 )
+  if ( $opt_extern || $mysql_version_id >= 50000 )
   {
     mtr_add_arg($args, "--vardir=$opt_vardir")
   }
@@ -1718,7 +1734,7 @@ sub environment_setup () {
   }
 
   $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
-				$ENV{'LD_LIBRARY_PATHS'} ?
+				$ENV{'LD_LIBRARY_PATH'} ?
 				split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
   mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
 
@@ -1899,7 +1915,7 @@ sub environment_setup () {
   my $cmdline_mysqlbinlog=
     "$exe_mysqlbinlog" .
       " --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir";
-  if ( $mysql_version_id >= 50000 )
+  if ( !$opt_extern && $mysql_version_id >= 50000 )
   {
     $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
   }
@@ -1930,7 +1946,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   # Setup env so childs can execute mysql_upgrade
   # ----------------------------------------------------
-  if ( $mysql_version_id >= 50000 )
+  if ( !$opt_extern && $mysql_version_id >= 50000 )
   {
     $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
   }
@@ -1938,7 +1954,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   # Setup env so childs can execute mysql_fix_system_tables
   # ----------------------------------------------------
-  if ( ! $glob_win32 )
+  if ( !$opt_extern && ! $glob_win32 )
   {
     my $cmdline_mysql_fix_system_tables=
       "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
@@ -1948,7 +1964,10 @@ sub environment_setup () {
       "--socket=$master->[0]->{'path_sock'}";
     $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
   }
-  $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}=  $file_mysql_fix_privilege_tables;
+  if (!$opt_extern)
+  {
+    $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}=  $file_mysql_fix_privilege_tables;
+  }
 
   # ----------------------------------------------------
   # Setup env so childs can execute my_print_defaults
@@ -2253,7 +2272,10 @@ sub check_ssl_support ($) {
 
   if ($opt_skip_ssl || $opt_extern)
   {
-    mtr_report("Skipping SSL");
+    if (!$opt_extern)
+    {
+      mtr_report("Skipping SSL");
+    }
     $opt_ssl_supported= 0;
     $opt_ssl= 0;
     return;
@@ -2328,9 +2350,12 @@ sub vs_config_dirs ($$) {
 sub check_ndbcluster_support ($) {
   my $mysqld_variables= shift;
 
-  if ($opt_skip_ndbcluster)
+  if ($opt_skip_ndbcluster || $opt_extern)
   {
-    mtr_report("Skipping ndbcluster");
+    if (!$opt_extern)
+    {
+      mtr_report("Skipping ndbcluster");
+    }
     $opt_skip_ndbcluster_slave= 1;
     return;
   }
@@ -2746,7 +2771,10 @@ sub initialize_servers () {
     }
     else
     {
-      mtr_report("No need to create '$opt_vardir' it already exists");
+      if ($opt_verbose)
+      {
+	mtr_report("No need to create '$opt_vardir' it already exists");
+      }
     }
   }
   else
@@ -3143,17 +3171,17 @@ sub do_before_run_mysqltest($)
   unlink("$result_dir/$tname.log");
   unlink("$result_dir/$tname.warnings");
 
-  if ( $mysql_version_id < 50000 )
-  {
-    # Set environment variable NDB_STATUS_OK to 1
-    # if script decided to run mysqltest cluster _is_ installed ok
-    $ENV{'NDB_STATUS_OK'} = "1";
-  }
-  elsif ( $mysql_version_id < 50100 )
+  if (!$opt_extern)
   {
-    # Set environment variable NDB_STATUS_OK to YES
-    # if script decided to run mysqltest cluster _is_ installed ok
-    $ENV{'NDB_STATUS_OK'} = "YES";
+    if ( $mysql_version_id < 50000 ) {
+      # Set environment variable NDB_STATUS_OK to 1
+      # if script decided to run mysqltest cluster _is_ installed ok
+      $ENV{'NDB_STATUS_OK'} = "1";
+    } elsif ( $mysql_version_id < 50100 ) {
+      # Set environment variable NDB_STATUS_OK to YES
+      # if script decided to run mysqltest cluster _is_ installed ok
+      $ENV{'NDB_STATUS_OK'} = "YES";
+    }
   }
 }
 
@@ -4934,10 +4962,10 @@ sub usage ($) {
 
   if ( $message )
   {
-    print STDERR "$message \n";
+    print STDERR "$message\n";
   }
 
-  print STDERR <<HERE;
+  print <<HERE;
 
 $0 [ OPTIONS ] [ TESTCASE ]
 

--- 1.41/storage/ndb/src/common/debugger/EventLogger.cpp	2007-02-27 00:01:06 +07:00
+++ 1.42/storage/ndb/src/common/debugger/EventLogger.cpp	2007-03-07 00:36:38 +07:00
@@ -623,21 +623,21 @@ void getTextTransporterError(QQQQ) {
   lenth = sizeof(TransporterErrorString)/sizeof(struct myTransporterError);
   for(i=0; i<lenth; i++)
   {
-    if(theData[2] == TransporterErrorString[i].errorNum)
+    if(theData[2] == (Uint32) TransporterErrorString[i].errorNum)
     {
       BaseString::snprintf(m_text, m_text_len,
-                          "Transporter to node %d reported error 0x%x: %s",
-                          theData[1],
-			  theData[2],
-                          TransporterErrorString[i].errorString);
+                           "Transporter to node %d reported error 0x%x: %s",
+                           theData[1],
+                           theData[2],
+                           TransporterErrorString[i].errorString);
       break;
     }
   }
   if(i == lenth)
     BaseString::snprintf(m_text, m_text_len,   
-                        "Transporter to node %d reported error 0x%x: unknown error",
-                          theData[1],
-			  theData[2]);
+                         "Transporter to node %d reported error 0x%x: unknown error",
+                         theData[1],
+                         theData[2]);
 }
 void getTextTransporterWarning(QQQQ) {
   getTextTransporterError(m_text, m_text_len, theData, len);
@@ -1058,6 +1058,7 @@ EventLogger::close()
 }
 
 #ifdef NOT_USED
+
 static NdbOut&
 operator<<(NdbOut& out, const LogLevel & ll)
 {

--- 1.64/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2007-02-02 23:10:44 +07:00
+++ 1.65/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2007-03-07 00:36:38 +07:00
@@ -1488,7 +1488,6 @@ Backup::execCREATE_TRIG_CONF(Signal* sig
   const Uint32 ptrI = conf->getConnectionPtr();
   const Uint32 tableId = conf->getTableId();
   const TriggerEvent::Value type = conf->getTriggerEvent();
-  const Uint32 triggerId = conf->getTriggerId();
 
   BackupRecordPtr ptr LINT_SET_PTR;
   c_backupPool.getPtr(ptr, ptrI);
@@ -2152,7 +2151,6 @@ Backup::execDROP_TRIG_CONF(Signal* signa
   
   DropTrigConf* conf = (DropTrigConf*)signal->getDataPtr();
   const Uint32 ptrI = conf->getConnectionPtr();
-  const Uint32 triggerId= conf->getTriggerId();
 
   BackupRecordPtr ptr LINT_SET_PTR;
   c_backupPool.getPtr(ptr, ptrI);
@@ -4658,7 +4656,6 @@ Backup::execABORT_BACKUP_ORD(Signal* sig
   }
   ndbrequire(ok);
   
-  Uint32 ref= ptr.p->masterRef;
   ptr.p->masterRef = reference();
   ptr.p->nodes.clear();
   ptr.p->nodes.set(getOwnNodeId());

--- 1.118/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-03-02 17:52:08 +07:00
+++ 1.119/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-03-07 00:36:39 +07:00
@@ -291,7 +291,6 @@ Dbdict::execDUMP_STATE_ORD(Signal* signa
     for(; ok; ok = c_obj_hash.next(iter))
     {
       Rope name(c_rope_pool, iter.curr.p->m_name);
-      const Uint32 size = name.size();
       char buf[1024];
       name.copy(buf);
       ndbout_c("%s m_ref_count: %d", buf, iter.curr.p->m_ref_count); 
@@ -3802,7 +3801,7 @@ Dbdict::execCREATE_TABLE_REQ(Signal* sig
     createTabPtr.p->m_dihAddFragPtr = RNIL;
 
     Uint32 key = c_opRecordSequence + 1;
-    Uint32 *theData = signal->getDataPtrSend(), i;
+    Uint32 *theData = signal->getDataPtrSend();
     Uint16 *frag_data= (Uint16*)&signal->theData[25];
     CreateFragmentationReq * const req = (CreateFragmentationReq*)theData;
     req->senderRef = reference();
@@ -4958,7 +4957,6 @@ Dbdict::execCREATE_FRAGMENTATION_CONF(Si
   packTableIntoPages(w, tabPtr);
   
   SegmentedSectionPtr spDataPtr;
-  Ptr<SectionSegment> tmpTsPtr;
   w.getPtr(spDataPtr);
   
   signal->setSection(spDataPtr, CreateTabReq::DICT_TAB_INFO);
@@ -5443,7 +5441,6 @@ Dbdict::execADD_FRAGREQ(Signal* signal) 
   Uint32 fragCount = req->totalFragments;
   Uint32 requestInfo = req->requestInfo;
   Uint32 startGci = req->startGci;
-  Uint32 tablespace_id= req->tablespaceId;
   Uint32 logPart = req->logPartId;
 
   ndbrequire(node == getOwnNodeId());
@@ -7565,7 +7562,6 @@ void
 Dbdict::execLIST_TABLES_REQ(Signal* signal)
 {
   jamEntry();
-  Uint32 i;
   ListTablesReq * req = (ListTablesReq*)signal->getDataPtr();
   Uint32 senderRef  = req->senderRef;
   Uint32 senderData = req->senderData;
@@ -9456,7 +9452,6 @@ Dbdict::createEventUTIL_PREPARE(Signal* 
     evntRecPtr.i = ref->getSenderData();
     ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
 
-    Uint32 err;
     interpretUtilPrepareErrorCode(errorCode, evntRecPtr.p->m_errorCode,
 				  evntRecPtr.p->m_errorLine);
     evntRecPtr.p->m_errorNode = reference();
@@ -15225,7 +15220,6 @@ Dbdict::execDROP_OBJ_REQ(Signal* signal)
   const Uint32 objId = req->objId;
   const Uint32 objVersion = req->objVersion;
   const Uint32 objType = req->objType;
-  const Uint32 requestInfo = req->requestInfo;
   
   DropObjRecordPtr dropObjPtr;  
   ndbrequire(c_opDropObj.seize(dropObjPtr));
@@ -15724,8 +15718,7 @@ Dbdict::execCREATE_FILEGROUP_CONF(Signal
 
 void
 Dbdict::create_fg_abort_start(Signal* signal, SchemaOp* op){
-  CreateFilegroupImplReq* req = 
-    (CreateFilegroupImplReq*)signal->getDataPtrSend();
+  (void) signal->getDataPtrSend();
 
   if (op->m_obj_ptr_i != RNIL)
   {

--- 1.48/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2007-02-06 04:13:43 +07:00
+++ 1.49/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2007-03-07 00:36:39 +07:00
@@ -1975,6 +1975,7 @@ public:
     NodeBitmask m_nodes;
     
     Uint32 m_errorCode;
+    SchemaTransaction() {}
     void setErrorCode(Uint32 c){ if(m_errorCode == 0) m_errorCode = c;}
 
     /**

--- 1.114/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-03-02 17:52:08 +07:00
+++ 1.115/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-03-07 00:36:39 +07:00
@@ -2098,8 +2098,11 @@ void Dbdih::gcpBlockedLab(Signal* signal
   /*-------------------------------------------------------------------------*/
   Uint32 startVersion = getNodeInfo(c_nodeStartMaster.startNode).m_version;
   
-  if ((getMajor(startVersion) == 4 && startVersion >= NDBD_INCL_NODECONF_VERSION_4) ||
-      (getMajor(startVersion) == 5 && startVersion >= NDBD_INCL_NODECONF_VERSION_5))
+  if ((getMajor(startVersion) == 4 && 
+       startVersion >= NDBD_INCL_NODECONF_VERSION_4) ||
+      (getMajor(startVersion) == 5 && 
+       startVersion >= NDBD_INCL_NODECONF_VERSION_5) ||
+      (getMajor(startVersion) > 5))
   {
     c_INCL_NODEREQ_Counter.setWaitingFor(c_nodeStartMaster.startNode);
   }
@@ -2342,8 +2345,11 @@ void Dbdih::execINCL_NODEREQ(Signal* sig
     CRASH_INSERTION(7171);
     Uint32 masterVersion = getNodeInfo(refToNode(cmasterdihref)).m_version;
     
-    if ((NDB_VERSION_MAJOR == 4 && masterVersion >= NDBD_INCL_NODECONF_VERSION_4) ||
-	(NDB_VERSION_MAJOR == 5 && masterVersion >= NDBD_INCL_NODECONF_VERSION_5))
+    if ((NDB_VERSION_MAJOR == 4 && 
+	 masterVersion >= NDBD_INCL_NODECONF_VERSION_4) ||
+	(NDB_VERSION_MAJOR == 5 && 
+	 masterVersion >= NDBD_INCL_NODECONF_VERSION_5) ||
+	(NDB_VERSION_MAJOR > 5))
     {
       signal->theData[0] = getOwnNodeId();
       signal->theData[1] = getOwnNodeId();
@@ -2965,7 +2971,6 @@ Dbdih::nr_start_fragment(Signal* signal,
     if (replicaPtr.p->lcpStatus[idx] == ZVALID) 
     {
       ndbrequire(replicaPtr.p->lcpId[idx] > maxLcpId);
-      Uint32 startGci = replicaPtr.p->maxGciCompleted[idx];
       Uint32 stopGci = replicaPtr.p->maxGciStarted[idx];
       for (;j < replicaPtr.p->noCrashedReplicas; j++)
       {
@@ -10620,8 +10625,6 @@ Dbdih::handle_invalid_lcp_no(const LcpFr
   ndbrequire(!isMaster());
   Uint32 lcpNo = rep->lcpNo;
   Uint32 lcpId = rep->lcpId;
-  Uint32 replicaLcpNo = replicaPtr.p->nextLcp;
-  Uint32 prevReplicaLcpNo = prevLcpNo(replicaLcpNo);
 
   warningEvent("Detected previous node failure of %d during lcp",
 	       rep->nodeId);

--- 1.145/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-02-27 00:01:06 +07:00
+++ 1.146/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-03-07 00:36:40 +07:00
@@ -600,7 +600,7 @@ Dblqh::execDEFINE_BACKUP_REF(Signal* sig
     case DefineBackupRef::FailedInsertTableList: 
       jam();
       err_code = NDBD_EXIT_INVALID_CONFIG;
-      extra_msg = "Probably Backup parameters configuration error, Please consult the manual";
+      extra_msg = (char*) "Probably Backup parameters configuration error, Please consult the manual";
       progError(__LINE__, err_code, extra_msg);
   }
 
@@ -3964,7 +3964,6 @@ void
 Dblqh::handle_nr_copy(Signal* signal, Ptr<TcConnectionrec> regTcPtr)
 {
   jam();
-  Uint32 tableId = regTcPtr.p->tableref;
   Uint32 fragPtr = fragptr.p->tupFragptr;
   Uint32 op = regTcPtr.p->operation;
 
@@ -6731,7 +6730,6 @@ void Dblqh::execABORT(Signal* signal) 
   }//if
   
   TcConnectionrec * const regTcPtr = tcConnectptr.p;
-  Uint32 activeCreat = regTcPtr->activeCreat;
   if (ERROR_INSERTED(5100))
   {
     SET_ERROR_INSERT_VALUE(5101);
@@ -6811,7 +6809,6 @@ void Dblqh::execABORTREQ(Signal* signal)
     return;
   }//if
   TcConnectionrec * const regTcPtr = tcConnectptr.p;
-  Uint32 activeCreat = regTcPtr->activeCreat;
   if (regTcPtr->transactionState != TcConnectionrec::PREPARED) {
     warningReport(signal, 10);
     return;

--- 1.138/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2007-02-22 21:49:31 +07:00
+++ 1.139/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2007-03-07 00:36:40 +07:00
@@ -6938,7 +6938,6 @@ void Dbtc::execGCP_NOMORETRANS(Signal* s
 /*****************************************************************************/
 void Dbtc::execNODE_FAILREP(Signal* signal) 
 {
-  HostRecordPtr tmpHostptr;
   jamEntry();
 
   NodeFailRep * const nodeFail = (NodeFailRep *)&signal->theData[0];
@@ -12174,8 +12173,6 @@ void Dbtc::execTCKEYREF(Signal* signal)
   }
   const UintR TconnectIndex = indexOp->connectionIndex;
   ApiConnectRecord * const regApiPtr = &apiConnectRecord[TconnectIndex];
-  Uint32 tcKeyRequestInfo  = indexOp->tcIndxReq.requestInfo;
-  Uint32 commitFlg = TcKeyReq::getCommitFlag(tcKeyRequestInfo);
 
   switch(indexOp->indexOpState) {
   case(IOS_NOOP): {
@@ -13638,7 +13635,6 @@ Dbtc::execROUTE_ORD(Signal* signal)
   Uint32 dstRef = ord->dstRef;
   Uint32 srcRef = ord->srcRef;
   Uint32 gsn = ord->gsn;
-  Uint32 cnt = ord->cnt;
 
   if (likely(getNodeInfo(refToNode(dstRef)).m_connected))
   {

--- 1.60/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2007-02-15 00:24:38 +07:00
+++ 1.61/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2007-03-07 00:36:41 +07:00
@@ -516,6 +516,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
       return (m_key.m_file_no << 16) ^ m_key.m_page_idx;
     }
 
+    Extent_info() {}
     bool equal(const Extent_info & rec) const {
       return m_key.m_file_no == rec.m_key.m_file_no &&
 	m_key.m_page_idx == rec.m_key.m_page_idx;
@@ -667,6 +668,7 @@ struct Operationrec {
     Uint32 currentAttrinbufLen; //Used until copyAttrinfo
   };
 
+  Operationrec() {}
   bool is_first_operation() const { return prevActiveOp == RNIL;}
   bool is_last_operation() const { return nextActiveOp == RNIL;}
 
@@ -1241,6 +1243,7 @@ typedef Ptr<HostBuffer> HostBufferPtr;
     STATIC_CONST( LCP_KEEP    = 0x02000000 ); // Should be returned in LCP
     STATIC_CONST( FREE        = 0x02800000 ); // Is free
     
+    Tuple_header() {}
     Uint32 get_tuple_version() const { 
       return m_header_bits & TUP_VERSION_MASK;
     }

--- 1.55/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-02-22 00:08:28 +07:00
+++ 1.56/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-03-07 00:36:41 +07:00
@@ -451,7 +451,6 @@ Dbtup::load_diskpage(Signal* signal, 
   Tuple_header* ptr= (Tuple_header*)tmp;
   
   int res= 1;
-  Uint32 opPtr= ptr->m_operation_ptr_i;
   if(ptr->m_header_bits & Tuple_header::DISK_PART)
   {
     Page_cache_client::Request req;
@@ -536,7 +535,6 @@ Dbtup::load_diskpage_scan(Signal* signal
   Tuple_header* ptr= (Tuple_header*)tmp;
   
   int res= 1;
-  Uint32 opPtr= ptr->m_operation_ptr_i;
   if(ptr->m_header_bits & Tuple_header::DISK_PART)
   {
     Page_cache_client::Request req;
@@ -2923,7 +2921,6 @@ Dbtup::nr_read_pk(Uint32 fragPtrI, 
   ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec);
 
   Local_key tmp = *key;
-  Uint32 pages = fragPtr.p->noOfPages;
   
   int ret;
   PagePtr page_ptr;

--- 1.82/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2007-02-12 15:00:08 +07:00
+++ 1.83/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2007-03-07 00:36:43 +07:00
@@ -1338,6 +1338,7 @@ operator<<(NdbOut& out, const Gci_contai
   return out;
 }
 
+#ifdef VM_TRACE
 static
 NdbOut&
 operator<<(NdbOut& out, const Gci_container_pod& gci)
@@ -1346,7 +1347,7 @@ operator<<(NdbOut& out, const Gci_contai
   out << *ptr;
   return out;
 }
-
+#endif
 
 static
 Gci_container*
@@ -1586,7 +1587,7 @@ NdbEventBuffer::complete_outof_order_gci
       ndbout_c(" moved %ld rows -> %ld", (long) bucket->m_data.m_count,
 	       (long) m_complete_data.m_data.m_count);
 #else
-      ndbout_c("");
+      ndbout_c(" ");
 #endif
     }
     bzero(bucket, sizeof(Gci_container));

--- 1.416/sql/ha_ndbcluster.cc	2007-03-02 17:52:08 +07:00
+++ 1.417/sql/ha_ndbcluster.cc	2007-03-07 00:36:37 +07:00
@@ -2771,10 +2771,12 @@ int ha_ndbcluster::write_row(byte *recor
   {
     Ndb *ndb= get_ndb();
     Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
+#ifndef DBUG_OFF
     char buff[22];
     DBUG_PRINT("info", 
                ("Trying to set next auto increment value to %s",
                 llstr(next_val, buff)));
+#endif
     Ndb_tuple_id_range_guard g(m_share);
     if (ndb->setAutoIncrementValue(m_table, g.range, next_val, TRUE)
         == -1)
@@ -2827,7 +2829,7 @@ int ha_ndbcluster::key_cmp(uint keynr, c
 
 int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
 {
-  THD *thd= current_thd;
+  THD *thd= table->in_use;
   NdbTransaction *trans= m_active_trans;
   NdbScanOperation* cursor= m_active_cursor;
   NdbOperation *op;
@@ -3014,7 +3016,7 @@ int ha_ndbcluster::update_row(const byte
 
 int ha_ndbcluster::delete_row(const byte *record)
 {
-  THD *thd= current_thd;
+  THD *thd= table->in_use;
   NdbTransaction *trans= m_active_trans;
   NdbScanOperation* cursor= m_active_cursor;
   NdbOperation *op;
@@ -4006,7 +4008,7 @@ int ha_ndbcluster::end_bulk_insert()
       }
       else
       {
-        int res= trans->restart();
+        IF_DBUG(int res=) trans->restart();
         DBUG_ASSERT(res == 0);
       }
     }
@@ -4724,7 +4726,9 @@ static int create_ndb_column(NDBCOL &col
   // Set autoincrement
   if (field->flags & AUTO_INCREMENT_FLAG) 
   {
+#ifndef DBUG_OFF
     char buff[22];
+#endif
     col.setAutoIncrement(TRUE);
     ulonglong value= info->auto_increment_value ?
       info->auto_increment_value : (ulonglong) 1;
@@ -5395,7 +5399,7 @@ int ha_ndbcluster::rename_table(const ch
   {
     DBUG_PRINT("NDB_SHARE", ("%s temporary  use_count: %u",
                              share->key, share->use_count));
-    int r= rename_share(share, to);
+    IF_DBUG(int r=) rename_share(share, to);
     DBUG_ASSERT(r == 0);
   }
 #endif
@@ -5416,8 +5420,8 @@ int ha_ndbcluster::rename_table(const ch
 #ifdef HAVE_NDB_BINLOG
     if (share)
     {
-      int r= rename_share(share, from);
-      DBUG_ASSERT(r == 0);
+      IF_DBUG(int ret=) rename_share(share, from);
+      DBUG_ASSERT(ret == 0);
       /* ndb_share reference temporary free */
       DBUG_PRINT("NDB_SHARE", ("%s temporary free  use_count: %u",
                                share->key, share->use_count));
@@ -6023,7 +6027,7 @@ void ha_ndbcluster::set_part_info(partit
 int ha_ndbcluster::close(void)
 {
   DBUG_ENTER("close");
-  THD *thd= current_thd;
+  THD *thd= table->in_use;
   Ndb *ndb= thd ? check_ndb_in_thd(thd) : g_ndb;
   /* ndb_share reference handler free */
   DBUG_PRINT("NDB_SHARE", ("%s handler free  use_count: %u",
@@ -7310,7 +7314,9 @@ uint ndb_get_commitcount(THD *thd, char 
     if (share->commit_count != 0)
     {
       *commit_count= share->commit_count;
+#ifndef DBUG_OFF
       char buff[22];
+#endif
       DBUG_PRINT("info", ("Getting commit_count: %s from share",
                           llstr(share->commit_count, buff)));
       pthread_mutex_unlock(&share->mutex);
@@ -7346,7 +7352,9 @@ uint ndb_get_commitcount(THD *thd, char 
   pthread_mutex_lock(&share->mutex);
   if (share->commit_count_lock == lock)
   {
+#ifndef DBUG_OFF
     char buff[22];
+#endif
     DBUG_PRINT("info", ("Setting commit_count to %s",
                         llstr(stat.commit_count, buff)));
     share->commit_count= stat.commit_count;
@@ -7405,7 +7413,9 @@ ndbcluster_cache_retrieval_allowed(THD *
   bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
   char *dbname= full_name;
   char *tabname= dbname+strlen(dbname)+1;
+#ifndef DBUG_OFF
   char buff[22], buff2[22];
+#endif
   DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
   DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d",
                        dbname, tabname, is_autocommit));
@@ -7472,7 +7482,9 @@ ha_ndbcluster::register_query_cache_tabl
                                           ulonglong *engine_data)
 {
   Uint64 commit_count;
+#ifndef DBUG_OFF
   char buff[22];
+#endif
   bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
   DBUG_ENTER("ha_ndbcluster::register_query_cache_table");
   DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d",
@@ -7917,7 +7929,9 @@ ndb_get_table_statistics(ha_ndbcluster* 
   int retries= 10;
   int reterr= 0;
   int retry_sleep= 30 * 1000; /* 30 milliseconds */
+#ifndef DBUG_OFF
   char buff[22], buff2[22], buff3[22], buff4[22];
+#endif
   DBUG_ENTER("ndb_get_table_statistics");
   DBUG_PRINT("enter", ("table: %s", ndbtab->getName()));
 
@@ -8735,7 +8749,9 @@ pthread_handler_t ndb_util_thread_func(v
             ndb_get_table_statistics(NULL, FALSE, ndb,
                                      ndbtab_g.get_table(), &stat) == 0)
         {
+#ifndef DBUG_OFF
           char buff[22], buff2[22];
+#endif
           DBUG_PRINT("info",
                      ("Table: %s  commit_count: %s  rows: %s",
                       share->key,
@@ -9587,8 +9603,8 @@ void ndb_serialize_cond(const Item *item
           DBUG_PRINT("info", ("INT_ITEM"));
           if (context->expecting(Item::INT_ITEM)) 
           {
-            Item_int *int_item= (Item_int *) item;      
-            DBUG_PRINT("info", ("value %ld", (long) int_item->value));
+            DBUG_PRINT("info", ("value %ld",
+                                (long) ((Item_int*) item)->value));
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::INT_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
@@ -9614,8 +9630,7 @@ void ndb_serialize_cond(const Item *item
           DBUG_PRINT("info", ("REAL_ITEM"));
           if (context->expecting(Item::REAL_ITEM)) 
           {
-            Item_float *float_item= (Item_float *) item;      
-            DBUG_PRINT("info", ("value %f", float_item->value));
+            DBUG_PRINT("info", ("value %f", ((Item_float*) item)->value));
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::REAL_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
@@ -9662,8 +9677,8 @@ void ndb_serialize_cond(const Item *item
           DBUG_PRINT("info", ("DECIMAL_ITEM"));
           if (context->expecting(Item::DECIMAL_ITEM)) 
           {
-            Item_decimal *decimal_item= (Item_decimal *) item;      
-            DBUG_PRINT("info", ("value %f", decimal_item->val_real()));
+            DBUG_PRINT("info", ("value %f",
+                                ((Item_decimal*) item)->val_real()));
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::DECIMAL_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);

--- 1.278/BitKeeper/etc/ignore	2007-02-22 21:49:17 +07:00
+++ 1.279/BitKeeper/etc/ignore	2007-03-07 00:36:01 +07:00
@@ -2665,6 +2665,7 @@ storage/ndb/src/mgmclient/test_cpcd/*.d
 storage/ndb/src/mgmsrv/ndb_mgmd
 storage/ndb/src/mgmsrv/ndb_mgmd.dsp
 storage/ndb/src/ndbapi/libndbapi.dsp
+storage/ndb/src/ndbapi/ndberror_check
 storage/ndb/test/ndbapi/DbAsyncGenerator
 storage/ndb/test/ndbapi/DbCreate
 storage/ndb/test/ndbapi/bank/bankCreator

--- 1.17/storage/ndb/src/ndbapi/SignalSender.cpp	2007-03-02 17:52:08 +07:00
+++ 1.18/storage/ndb/src/ndbapi/SignalSender.cpp	2007-03-07 00:36:43 +07:00
@@ -19,15 +19,6 @@
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
 
-#ifdef NOT_USED
-static
-void
-require(bool x)
-{
-  if (!x)
-    abort();
-}
-#endif
 
 SimpleSignal::SimpleSignal(bool dealloc){
   memset(this, 0, sizeof(* this));
Thread
bk commit into 5.1 tree (tomas:1.2450)tomas6 Mar