List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 8 2009 1:43pm
Subject:bzr commit into mysql-5.1-telco-7.1 branch (magnus.blaudd:3060)
Bug#46113
View as plain text  
#At file:///home/msvensson/mysql/bug46113/7.1/ based on revid:jonas@strippednb0nm61dq9e63

 3060 Magnus Blåudd	2009-10-08 [merge]
      Merge bug#46113 to 7.1

    added:
      mysql-test/include/not_windows_embedded.inc
      storage/ndb/src/cw/cpcd/CMakeLists.txt
    modified:
      BUILD/compile-ndb-autotest
      mysql-test/mysql-test-run.pl
      mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
      mysql-test/t/plugin.test
      mysql-test/t/plugin_load.test
      storage/ndb/CMakeLists.txt
      storage/ndb/include/ndb_global.h.in
      storage/ndb/src/CMakeLists.txt
      storage/ndb/src/cw/cpcd/CPCD.cpp
      storage/ndb/src/cw/cpcd/CPCD.hpp
      storage/ndb/src/cw/cpcd/Process.cpp
      storage/ndb/src/cw/cpcd/common.cpp
      storage/ndb/src/cw/cpcd/main.cpp
      storage/ndb/src/kernel/blocks/backup/Backup.hpp
      storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
      storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
      storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp
      storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
      storage/ndb/src/kernel/blocks/suma/Suma.hpp
      storage/ndb/src/kernel/blocks/trix/Trix.hpp
      storage/ndb/src/kernel/vm/DLFifoList.hpp
      storage/ndb/src/kernel/vm/DLHashTable.hpp
      storage/ndb/src/kernel/vm/DLList.hpp
      storage/ndb/src/kernel/vm/LockQueue.hpp
      storage/ndb/src/kernel/vm/SimulatedBlock.hpp
=== modified file 'BUILD/compile-ndb-autotest'
--- a/BUILD/compile-ndb-autotest	2008-06-24 10:53:41 +0000
+++ b/BUILD/compile-ndb-autotest	2009-10-08 13:42:54 +0000
@@ -14,7 +14,7 @@ else
     extra_flags="$fast_cflags"
 fi
 
-extra_flags="$extra_flags $max_cflags -g"
+extra_flags="$extra_flags $max_cflags -g -std=c++0x"
 extra_configs="$extra_configs $NDB_AUTOTEST_CONFIGURE_OPTIONS"
 
 . "$path/FINISH.sh"

=== added file 'mysql-test/include/not_windows_embedded.inc'
--- a/mysql-test/include/not_windows_embedded.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_windows_embedded.inc	2009-10-08 11:12:41 +0000
@@ -0,0 +1,11 @@
+let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
+let $is_embedded = `select version() like '%embedded%'`;
+#echo is_win: $is_win;
+#echo is_embedded: $is_embedded;
+if ($is_win)
+{
+  if ($is_embedded)
+  {
+    skip Not supported with embedded on windows;
+  }
+}

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-10-01 07:16:52 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-10-08 11:12:41 +0000
@@ -1785,7 +1785,7 @@ sub environment_setup {
   # --------------------------------------------------------------------------
   # Add the path where mysqld will find ha_example.so
   # --------------------------------------------------------------------------
-  if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
+  if ($mysql_version_id >= 50100) {
     my $plugin_filename;
     if (IS_WINDOWS)
     {

=== modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test'
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2009-07-31 13:00:35 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2009-10-08 11:13:25 +0000
@@ -94,15 +94,24 @@ DROP TABLE t1;
 
 SET GLOBAL log_warnings = @old_log_warnings;
 
-let LOG_ERROR= `SELECT @@GLOBAL.log_error`;
+let $log_error= `SELECT @@GLOBAL.log_error`;
+if(!$log_error)
+{
+  # MySQL Server on windows is started with --console and thus
+  # does not know the location of its .err log, use default location
+  let $log_error = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+# Assign env variable LOG_ERROR
+let LOG_ERROR=$log_error;
 
 --echo # Count the number of times the "Unsafe" message was printed
 --echo # to the error log.
 
 perl;
-  $log_error= $ENV{'LOG_ERROR'};
+  use strict;
+  my $log_error= $ENV{'LOG_ERROR'} || die "LOG_ERROR not set";
   open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
-  $count = () = grep(/Bug#46265/g,<FILE>);
+  my $count = () = grep(/Bug#46265/g,<FILE>);
   print "Occurrences: $count\n";
   close(FILE);
 EOF

=== modified file 'mysql-test/t/plugin.test'
--- a/mysql-test/t/plugin.test	2009-06-10 08:59:49 +0000
+++ b/mysql-test/t/plugin.test	2009-10-08 11:12:41 +0000
@@ -1,3 +1,4 @@
+--source include/not_windows_embedded.inc
 --source include/have_example_plugin.inc
 
 CREATE TABLE t1(a int) ENGINE=EXAMPLE;

=== modified file 'mysql-test/t/plugin_load.test'
--- a/mysql-test/t/plugin_load.test	2008-01-26 00:05:15 +0000
+++ b/mysql-test/t/plugin_load.test	2009-10-08 11:12:41 +0000
@@ -1,3 +1,4 @@
+--source include/not_windows_embedded.inc
 --source include/have_example_plugin.inc
 
 SELECT @@global.example_enum_var = 'e2';

=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt	2009-10-07 07:38:15 +0000
+++ b/storage/ndb/CMakeLists.txt	2009-10-08 13:42:54 +0000
@@ -28,6 +28,9 @@ IF(NOT SOURCE_SUBLIBS)
   ADD_SUBDIRECTORY(src)
   ADD_SUBDIRECTORY(tools)
   ADD_SUBDIRECTORY(test)
+  IF(WITH_NDB_TEST)
+    ADD_SUBDIRECTORY(src/cw/cpcd)
+  ENDIF()
   ADD_SUBDIRECTORY(docs)
 ENDIF()
 

=== modified file 'storage/ndb/include/ndb_global.h.in'
--- a/storage/ndb/include/ndb_global.h.in	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/ndb_global.h.in	2009-10-08 12:40:36 +0000
@@ -165,4 +165,49 @@ extern "C" {
 
 #define NDB_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
+
+/*
+  NDB_STATIC_ASSERT(expr)
+   - Check coding assumptions during compile time
+     by laying out code that will generate a compiler error
+     if the expression is false.
+*/
+
+#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
+
+/*
+  Prefer to use the 'static_assert' function from C++0x
+  to get best error message
+*/
+#define NDB_STATIC_ASSERT(expr) static_assert(expr, #expr)
+
+#else
+
+/*
+  Fallback to use home grown solution
+*/
+
+#define STR_CONCAT_(x, y) x##y
+#define STR_CONCAT(x, y) STR_CONCAT_(x, y)
+
+#define NDB_STATIC_ASSERT(expr) \
+  enum {STR_CONCAT(static_assert_, __LINE__) = 1 / (!!(expr)) }
+
+#undef STR_CONCAT_
+#undef STR_CONCAT
+
+#endif
+
+
+#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
+#define HAVE_COMPILER_TYPE_TRAITS
+#endif
+
+#ifdef HAVE_COMPILER_TYPE_TRAITS
+#define ASSERT_TYPE_HAS_CONSTRUCTOR(x)     \
+  NDB_STATIC_ASSERT(!__has_trivial_constructor(x))
+#else
+#define ASSERT_TYPE_HAS_CONSTRUCTOR(x)
+#endif
+
 #endif

=== modified file 'storage/ndb/src/CMakeLists.txt'
--- a/storage/ndb/src/CMakeLists.txt	2008-08-20 13:22:29 +0000
+++ b/storage/ndb/src/CMakeLists.txt	2009-10-08 09:20:37 +0000
@@ -20,7 +20,6 @@ ADD_SUBDIRECTORY(ndbapi)
 ADD_SUBDIRECTORY(kernel)
 ADD_SUBDIRECTORY(mgmclient)
 ADD_SUBDIRECTORY(mgmsrv)
-ADD_SUBDIRECTORY(cw)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/ndb/include
                      {CMAKE_SOURCE_DIR}/include)

=== added file 'storage/ndb/src/cw/cpcd/CMakeLists.txt'
--- a/storage/ndb/src/cw/cpcd/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/cw/cpcd/CMakeLists.txt	2009-10-08 09:20:37 +0000
@@ -0,0 +1,41 @@
+# Copyright (C) 2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+INCLUDE(${CMAKE_SOURCE_DIR}/storage/ndb/config/type_ndbapi.cmake)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/ndb/src/ndbapi
+                    ${CMAKE_SOURCE_DIR}/storage/ndb/src/mgmapi
+                    ${CMAKE_SOURCE_DIR}/storage/ndb/src/common/mgmcommon
+                    ${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib
+                    ${CMAKE_SOURCE_DIR}/storage/ndb/src/mgmclient
+                    ${CMAKE_SOURCE_DIR}/sql)
+
+LINK_LIBRARIES(ndbmgmclient
+               ndbclient
+               dbug
+               mysys
+               strings
+               ndbgeneral
+               ndbportlib
+               ${NDB_SCI_LIBS})
+
+ADD_EXECUTABLE(ndb_cpcd
+        APIService.cpp
+        CPCD.cpp
+        Monitor.cpp
+        Process.cpp
+        common.cpp
+        main.cpp)
+

=== modified file 'storage/ndb/src/cw/cpcd/CPCD.cpp'
--- a/storage/ndb/src/cw/cpcd/CPCD.cpp	2009-06-11 12:28:55 +0000
+++ b/storage/ndb/src/cw/cpcd/CPCD.cpp	2009-10-08 04:35:04 +0000
@@ -26,6 +26,11 @@
 #include <NdbMutex.h> 
 
 #include "common.hpp"
+#ifdef _WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <direct.h>
+#endif
 
 extern const ParserRow<CPCDAPISession> commands[];
 
@@ -230,7 +235,7 @@ CPCD::notifyChanges() {
 static int link(const char* from_file, const char* to_file)
 {
   BOOL fail_if_exists = TRUE;
-  if (CopyFile(from_file, to_file, fail_if_exists) != 0)
+  if (CopyFile(from_file, to_file, fail_if_exists) == 0)
   {
     /* "On error, -1 is returned" */
     return -1;
@@ -361,6 +366,7 @@ CPCD::loadProcessList(){
   }
 
   CPCDAPISession sess(f, *this);
+  fclose(f);
   sess.loadFile();
   loadingProcessList = false;
 

=== modified file 'storage/ndb/src/cw/cpcd/CPCD.hpp'
--- a/storage/ndb/src/cw/cpcd/CPCD.hpp	2009-06-11 12:28:55 +0000
+++ b/storage/ndb/src/cw/cpcd/CPCD.hpp	2009-10-08 04:34:10 +0000
@@ -27,13 +27,33 @@
 #include <NdbCondition.h>
 #include <BaseString.hpp>
 
-/* XXX Need to figure out how to do this for non-Unix systems */
-#define CPCD_DEFAULT_WORK_DIR		"/var/run/ndb_cpcd"
+#ifdef _WIN32
+typedef DWORD pid_t;
+#else
+typedef int pid_t;
+#endif
+const pid_t bad_pid = -1;
+
+inline bool is_bad_pid(pid_t pid)
+{
+#ifdef _WIN32
+  return pid == bad_pid;
+#else
+  return pid <= 1;
+#endif
+}
+
 #define CPCD_DEFAULT_PROC_FILE    	"ndb_cpcd.conf"
 #define CPCD_DEFAULT_TCP_PORT		1234
 #define CPCD_DEFAULT_POLLING_INTERVAL	5 /* seconds */
+#ifndef _WIN32
+#define CPCD_DEFAULT_WORK_DIR		"/var/run/ndb_cpcd"
 #define CPCD_DEFAULT_CONFIG_FILE        "/etc/ndb_cpcd.conf"
 
+#else
+#define CPCD_DEFAULT_WORK_DIR		"c:\\ndb_cpcd"
+#define CPCD_DEFAULT_CONFIG_FILE        "c:\\ndb_cpcd\\ndb_cpcd.conf"
+#endif
 enum ProcessStatus {
   STOPPED  = 0,
   STARTING = 1,
@@ -87,7 +107,7 @@ public:
    *  @brief Manages a process
    */
   class Process {
-    int m_pid;
+    pid_t m_pid;
   public:
     /** 
      * @brief Constructs and empty Process

=== modified file 'storage/ndb/src/cw/cpcd/Process.cpp'
--- a/storage/ndb/src/cw/cpcd/Process.cpp	2009-06-11 12:28:55 +0000
+++ b/storage/ndb/src/cw/cpcd/Process.cpp	2009-10-08 10:21:00 +0000
@@ -18,14 +18,22 @@
 
 #include <ndb_global.h>
 
+#ifdef _WIN32
+#include <process.h>
+#include <sys/stat.h>
+#include <io.h>
+#endif
 #include <BaseString.hpp>
 #include <InputStream.hpp>
 
 #include "common.hpp"
 #include "CPCD.hpp"
+#include <errno.h>
 
 #ifndef _WIN32
 #include <pwd.h>
+#else
+#include <direct.h>
 #endif
 
 #ifdef HAVE_GETRLIMIT
@@ -55,7 +63,7 @@ CPCD::Process::print(FILE * f){
 
 CPCD::Process::Process(const Properties & props, class CPCD *cpcd) {
   m_id = -1;
-  m_pid = -1;
+  m_pid = bad_pid;
   props.get("id", (Uint32 *) &m_id);
   props.get("name", m_name);
   props.get("group", m_group);
@@ -77,6 +85,10 @@ CPCD::Process::Process(const Properties 
   if(strcasecmp(m_type.c_str(), "temporary") == 0){
     m_processType = TEMPORARY;
   } else {
+#ifdef _WIN32
+    logger.critical("Process type must be 'temporary' on windows");
+    exit(1);
+#endif
     m_processType = PERMANENT;
   }
   
@@ -108,12 +120,31 @@ CPCD::Process::monitor() { 
 bool
 CPCD::Process::isRunning() {
 
-  if(m_pid <= 1){
+  if (is_bad_pid(m_pid)) {
     //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
     return false;
   }
   /* Check if there actually exists a process with such a pid */
   errno = 0;
+
+#ifdef _WIN32
+  HANDLE proc;
+
+  if (!(proc = OpenProcess(PROCESS_QUERY_INFORMATION, 0, m_pid))) {
+    logger.debug("Cannot OpenProcess on %d\n", m_pid);
+    return false;
+  }
+
+  BOOL result;
+  DWORD exitcode;
+  if (result = GetExitCodeProcess(proc, &exitcode) && exitcode != STILL_ACTIVE) {
+    CloseHandle(proc);
+    return false;
+  }
+
+  CloseHandle(proc);
+
+#else
   int s = kill((pid_t)-m_pid, 0); /* Sending "signal" 0 to a process only
 				   * checkes if the process actually exists */
   if(s != 0) {
@@ -130,14 +161,15 @@ CPCD::Process::isRunning() {
       break;
     }
     return false;
-  } 
+  }
+#endif
   return true;
 }
 
 int
 CPCD::Process::readPid() {
-  if(m_pid != -1){
-    logger.critical("Reading pid while != -1(%d)", m_pid);
+  if (!is_bad_pid(m_pid)) {
+    logger.critical("Reading pid while having valid process (%d)", m_pid);
     return m_pid;
   }
 
@@ -167,6 +199,17 @@ CPCD::Process::readPid() {
   
   return -1;
 }
+#ifdef _WIN32
+inline int mkstemp(char *tmp)
+{
+  int fd;
+
+  if (!_mktemp(tmp))
+    return -1;
+  fd = _open(tmp, _O_CREAT|_O_RDWR|_O_TEXT|_O_TRUNC, _S_IREAD|_S_IWRITE);
+  return fd;
+}
+#endif
 
 int
 CPCD::Process::writePid(int pid) {
@@ -193,6 +236,10 @@ CPCD::Process::writePid(int pid) {
   fprintf(f, "%d", pid);
   fclose(f);
 
+#ifdef _WIN32
+  unlink(filename);
+#endif
+
   if(rename(tmpfilename, filename) == -1){
     logger.error("Unable to rename from %s to %s", tmpfilename, filename);
     return -1;
@@ -256,9 +303,44 @@ set_ulimit(const BaseString & pair){
   return 0;
 }
 
+#ifdef _WIN32
+const int S_IRUSR = _S_IREAD, S_IWUSR = _S_IWRITE;
+
+static void
+save_environment(const char *env, Vector<BaseString> &saved) {
+  char **ptr;
+
+  ptr = BaseString::argify("", env);
+  if(!ptr) {
+    logger.error("Could not argify new environment");
+    return;
+  }
+
+  for(int i = 0; ptr[i] != NULL; i++) {
+    if(!ptr[i][0]) {
+      continue;
+    }
+    char *str1 = strdup(ptr[i]);
+    char *str2;
+    BaseString bs;
+
+    *strchr(str1, '=') = 0;
+    str2 = getenv(str1);
+    bs.assfmt("%s=%s", str1, str2 ? str2 : "");
+    saved.push_back(bs);
+  }
+}
+#endif
+
 void
 CPCD::Process::do_exec() {
-  size_t i; 
+  size_t i;
+
+#ifdef _WIN32
+  Vector<BaseString> saved;
+  save_environment(m_env.c_str(), saved);
+#endif
+
   setup_environment(m_env.c_str());
 
   char **argv = BaseString::argify(m_path.c_str(), m_args.c_str());
@@ -271,7 +353,7 @@ CPCD::Process::do_exec() {
       _exit(1);
     }
   }
-
+#ifndef _WIN32
   Vector<BaseString> ulimit;
   m_ulimit.split(ulimit);
   for(i = 0; i<ulimit.size(); i++){
@@ -279,19 +361,27 @@ CPCD::Process::do_exec() {
       _exit(1);
     }
   }
+#endif
 
-  int fd = open("/dev/null", O_RDWR, 0);
-  if(fd == -1) {
-    logger.error("Cannot open `/dev/null': %s\n", strerror(errno));
+  const char *nul = IF_WIN("nul:", "/dev/null");
+  int fdnull = open(nul, O_RDWR, 0);
+  if(fdnull == -1) {
+    logger.error("Cannot open `%s': %s\n", nul, strerror(errno));
     _exit(1);
   }
   
   BaseString * redirects[] = { &m_stdin, &m_stdout, &m_stderr };
   int fds[3];
-  for(i = 0; i<3; i++){
-    if(redirects[i]->empty()){
+#ifdef _WIN32
+  int std_dups[3];
+#endif
+  for (i = 0; i < 3; i++) {
+#ifdef _WIN32
+    std_dups[i] = dup(i);
+#endif
+    if (redirects[i]->empty()) {
 #ifndef DEBUG
-      dup2(fd, i);
+      dup2(fdnull, i);
 #endif
       continue;
     }
@@ -318,8 +408,12 @@ CPCD::Process::do_exec() {
       _exit(1);
     }
     dup2(f, i);
+#ifdef _WIN32
+    close(f);
+#endif
   }
 
+#ifndef _WIN32
   /* Close all filedescriptors */
   for(i = STDERR_FILENO+1; (int)i < getdtablesize(); i++)
     close(i);
@@ -330,8 +424,46 @@ CPCD::Process::do_exec() {
    * create a new logger here */
   logger.error("Exec failed: %s\n", strerror(errno));
   /* NOTREACHED */
+#else
+  HANDLE proc = (HANDLE)_spawnvp(_P_NOWAIT, m_path.c_str(), argv);
+
+  // get back to original std i/o
+  for(i = 0; i < 3; i++) {
+    dup2(std_dups[i], i);
+    close(std_dups[i]);
+  }
+
+  for (i = 0; i < saved.size(); i++) {
+    putenv(saved[i].c_str());
+  }
+
+  DWORD exitcode;
+  BOOL result = GetExitCodeProcess(proc, &exitcode);
+  //maybe a short running process
+  if (result && exitcode == 259) {
+    m_status = STOPPED;
+    logger.warning("Process terminated\n");
+  }
+
+  int pid = GetProcessId(proc);
+  CloseHandle(proc);
+  if (!pid) {
+    logger.critical("Couldn't get process ID");
+  }
+
+  m_status = RUNNING;
+  writePid(pid);
+#endif
+
+  close(fdnull);
 }
 
+#ifdef _WIN32
+void sched_yield() {
+  Sleep(100);
+}
+#endif
+
 int
 CPCD::Process::start() {
   /* We need to fork() twice, so that the second child (grandchild?) can
@@ -352,6 +484,7 @@ CPCD::Process::start() {
   int pid = -1;
   switch(m_processType){
   case TEMPORARY:{
+#ifndef _WIN32
     /**
      * Simple fork
      * don't ignore child
@@ -375,8 +508,12 @@ CPCD::Process::start() {
       logger.debug("Started temporary %d : pid=%d", m_id, pid);
       break;
     }
+#else //_WIN32
+    do_exec();
+#endif
     break;
   }
+#ifndef _WIN32
   case PERMANENT:{
     /**
      * PERMANENT
@@ -417,6 +554,7 @@ CPCD::Process::start() {
     }
     break;
   }
+#endif
   default:
     logger.critical("Unknown process type");
     return -1;
@@ -427,17 +565,18 @@ CPCD::Process::start() {
   }
   
   errno = 0;
-  pid_t pgid = getpgid(pid);
+  pid_t pgid = IF_WIN(-1, getpgid(pid));
   
   if(pgid != -1 && pgid != m_pid){
     logger.error("pgid and m_pid don't match: %d %d (%d)", pgid, m_pid, pid);
   }
-  
+
   if(isRunning()){
     m_status = RUNNING;
     return 0;
   }
   m_status = STOPPED;
+
   return -1;
 }
 
@@ -448,13 +587,15 @@ CPCD::Process::stop() {
   BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
   unlink(filename);
   
-  if(m_pid <= 1){
+  if (is_bad_pid(m_pid)) {
     logger.critical("Stopping process with bogus pid: %d id: %d", 
 		    m_pid, m_id);
     return;
   }
+
   m_status = STOPPING;
-  
+
+#ifndef _WIN32
   errno = 0;
   int signo= SIGTERM;
   if(m_shutdown_options == "SIGKILL")
@@ -482,7 +623,25 @@ CPCD::Process::stop() {
       break;
     }
   } 
-  
-  m_pid = -1;
+#else
+  if (isRunning()) {
+    HANDLE proc = OpenProcess(PROCESS_TERMINATE, 0, m_pid);
+
+    if (!proc) {
+      logger.critical("Cannot open process %d\n", m_pid);
+      return;
+    }
+
+    BOOL tp = TerminateProcess(proc, -1);
+
+    CloseHandle(proc);
+    if (!tp) {
+      logger.critical("Cannot terminate process %d\n", m_pid);
+      return;
+    }
+  }
+#endif
+
+  m_pid = bad_pid;
   m_status = STOPPED;
 }

=== modified file 'storage/ndb/src/cw/cpcd/common.cpp'
--- a/storage/ndb/src/cw/cpcd/common.cpp	2009-06-11 12:28:55 +0000
+++ b/storage/ndb/src/cw/cpcd/common.cpp	2009-10-08 04:34:10 +0000
@@ -32,6 +32,7 @@ int debug = 0;
 
 Logger logger;
 
+#ifndef _WIN32
 int
 runas(const char * user){
   if(user == 0 || strlen(user) == 0){
@@ -56,6 +57,7 @@ runas(const char * user){
   }
   return res;
 }
+#endif
 
 int
 insert(const char * pair, Properties & p){

=== modified file 'storage/ndb/src/cw/cpcd/main.cpp'
--- a/storage/ndb/src/cw/cpcd/main.cpp	2009-06-11 12:28:55 +0000
+++ b/storage/ndb/src/cw/cpcd/main.cpp	2009-10-08 04:34:10 +0000
@@ -114,10 +114,12 @@ int main(int argc, char** argv){
   if(debug)
     logger.createConsoleHandler();
 
+#ifndef _WIN32
   if(user && runas(user) != 0){
     logger.critical("Unable to change user: %s", user);
     _exit(1);
   }
+#endif
 
   if(logfile != NULL){
     BaseString tmp;
@@ -127,8 +129,10 @@ int main(int argc, char** argv){
     logger.addHandler(new FileLogHandler(tmp.c_str()));
   }
   
+#ifndef _WIN32
   if(use_syslog)
     logger.addHandler(new SysLogHandler());
+#endif
 
   logger.info("Starting");
 

=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.hpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp	2009-05-29 06:23:51 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp	2009-10-08 12:40:36 +0000
@@ -185,7 +185,7 @@ public:
     Uint32 nextPool;
   };
   typedef Ptr<Page32> Page32Ptr;
-  
+
   struct Fragment {
     Uint64 noOfRecords;
     Uint32 tableId;

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2009-09-01 12:34:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2009-10-08 13:42:54 +0000
@@ -501,6 +501,8 @@ public:
   /* WHEN THE INDEX IS DROPPED.               */
   /* **************************************** */
   struct TcIndexData {
+    TcIndexData() {}
+
     /**
      *  IndexState
      */

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2009-09-16 13:54:07 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2009-10-08 13:42:54 +0000
@@ -475,6 +475,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
 
   // Scan Lock
   struct ScanLock {
+    ScanLock() {}
     Uint32 m_accLockOp;
     union {
       Uint32 nextPool;
@@ -571,6 +572,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
 
   struct Page_request 
   {
+    Page_request() {}
     Local_key m_key;
     Uint32 m_frag_ptr_i;
     Uint32 m_extent_info_ptr;
@@ -1304,6 +1306,8 @@ typedef Ptr<HostBuffer> HostBufferPtr;
    * Build index operation record.
    */
   struct BuildIndexRec {
+    BuildIndexRec() {}
+
     BuildIndxImplReq m_request;
     Uint8  m_build_vs;          // varsize pages
     Uint32 m_indexId;           // the index

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2009-10-08 11:41:21 +0000
@@ -24,6 +24,7 @@
 
 struct Tup_page 
 {
+  Tup_page() {}
   struct File_formats::Page_header m_page_header;
   Uint32 m_restart_seq;
   Uint32 page_state;

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2009-06-03 06:25:51 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2009-10-08 12:40:36 +0000
@@ -357,6 +357,7 @@ private:
 
   // ScanLock
   struct ScanLock {
+    ScanLock() {}
     Uint32 m_accLockOp;
     union {
     Uint32 nextPool;

=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.hpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2009-10-08 12:40:36 +0000
@@ -140,6 +140,7 @@ public:
   };
 
   struct Subscriber {
+    Subscriber() {}
     Uint32 m_senderRef;
     Uint32 m_senderData;
     Uint32 nextList;
@@ -207,6 +208,8 @@ public:
 
   struct SubOpRecord
   {
+    SubOpRecord() {}
+
     enum OpType
     {
       R_SUB_START_REQ,

=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.hpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.hpp	2009-10-08 12:40:36 +0000
@@ -73,6 +73,7 @@ private:
 
   // Node data needed when communicating with remote TRIX:es
   struct NodeRecord {
+    NodeRecord() {}
     bool alive;
     BlockReference trixRef;
     union {

=== modified file 'storage/ndb/src/kernel/vm/DLFifoList.hpp'
--- a/storage/ndb/src/kernel/vm/DLFifoList.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/vm/DLFifoList.hpp	2009-10-08 12:40:36 +0000
@@ -177,11 +177,16 @@ template <typename P, typename T, typena
 inline
 DLFifoListImpl<P,T,U>::Head::Head()
 {
+  // Require user defined constructor on T since we fiddle
+  // with T's members
+  ASSERT_TYPE_HAS_CONSTRUCTOR(T);
+
   firstItem = RNIL;
   lastItem = RNIL;
 #ifdef VM_TRACE
   in_use = false;
 #endif
+
 }
 
 template <typename P, typename T, typename U>

=== modified file 'storage/ndb/src/kernel/vm/DLHashTable.hpp'
--- a/storage/ndb/src/kernel/vm/DLHashTable.hpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DLHashTable.hpp	2009-10-08 09:55:36 +0000
@@ -158,6 +158,10 @@ inline
 DLHashTableImpl<P, T, U>::DLHashTableImpl(P & _pool)
   : thePool(_pool)
 {
+  // Require user defined constructor on T since we fiddle
+  // with T's members
+  ASSERT_TYPE_HAS_CONSTRUCTOR(T);
+
   mask = 0;
   hashValues = 0;
 }

=== modified file 'storage/ndb/src/kernel/vm/DLList.hpp'
--- a/storage/ndb/src/kernel/vm/DLList.hpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DLList.hpp	2009-10-08 09:55:36 +0000
@@ -183,6 +183,9 @@ inline
 DLListImpl<P,T,U>::DLListImpl(P & _pool)
   : thePool(_pool)
 {
+  // Require user defined constructor on T since we fiddle
+  // with T's members
+  ASSERT_TYPE_HAS_CONSTRUCTOR(T);
 }
 
 template <typename P, typename T, typename U>

=== modified file 'storage/ndb/src/kernel/vm/LockQueue.hpp'
--- a/storage/ndb/src/kernel/vm/LockQueue.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/vm/LockQueue.hpp	2009-10-08 12:40:36 +0000
@@ -34,6 +34,8 @@ public:
    */
   struct LockQueueElement 
   {
+    LockQueueElement() {}
+
     UtilLockReq m_req;
     union {
       Uint32 nextPool;

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2009-09-25 14:38:24 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2009-10-08 13:42:54 +0000
@@ -921,6 +921,7 @@ public: 
      * core interface
      */
     struct ActiveMutex {
+      ActiveMutex() {}
       Uint32 m_gsn; // state
       Uint32 m_mutexId;
       Callback m_callback;

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20091008134254-wr6k1sti04mjja9l.bundle
Thread
bzr commit into mysql-5.1-telco-7.1 branch (magnus.blaudd:3060)Bug#46113Magnus Blåudd8 Oct