Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart 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-08-13 10:26:43+10:00, stewart@willster.(none) +48 -0
ndb_win
CMakeLists.txt@stripped, 2007-08-09 18:26:02+10:00, stewart@willster.(none) +35 -20
Import patch ndb_win
extra/CMakeLists.txt@stripped, 2007-08-09 18:26:02+10:00, stewart@willster.(none) +5 -0
Import patch ndb_win
extra/perror.c@stripped, 2007-08-09 18:26:03+10:00, stewart@willster.(none) +3 -0
Import patch ndb_win
include/config-win.h@stripped, 2007-08-09 18:26:03+10:00, stewart@willster.(none) +5 -0
Import patch ndb_win
libmysql/CMakeLists.txt@stripped, 2007-08-09 18:26:03+10:00, stewart@willster.(none) +2 -2
Import patch ndb_win
ndb/include/ndb_types.h.in@stripped, 2007-08-09 18:26:03+10:00, stewart@willster.(none) +14
-10
Import patch ndb_win
ndb/include/ndbapi/NdbOperation.hpp@stripped, 2007-08-09 18:26:03+10:00,
stewart@willster.(none) +1 -1
Import patch ndb_win
ndb/src/common/debugger/signaldata/CntrStart.cpp@stripped, 2007-08-09 18:26:03+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/common/debugger/signaldata/ReadNodesConf.cpp@stripped, 2007-08-09 18:26:04+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/common/logger/Logger.cpp@stripped, 2007-08-09 18:26:04+10:00,
stewart@willster.(none) +1 -1
Import patch ndb_win
ndb/src/common/portlib/NdbCondition.c@stripped, 2007-08-09 18:26:04+10:00,
stewart@willster.(none) +108 -1
Import patch ndb_win
ndb/src/common/portlib/NdbConfig.c@stripped, 2007-08-09 18:26:04+10:00,
stewart@willster.(none) +2 -1
Import patch ndb_win
ndb/src/common/portlib/NdbDaemon.c@stripped, 2007-08-09 18:26:04+10:00,
stewart@willster.(none) +31 -13
Import patch ndb_win
ndb/src/common/portlib/NdbHost.c@stripped, 2007-08-09 18:26:04+10:00, stewart@willster.(none)
+27 -0
Import patch ndb_win
ndb/src/common/portlib/NdbMutex.c@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +24 -0
Import patch ndb_win
ndb/src/common/portlib/NdbPortLibTest.cpp@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +2 -2
Import patch ndb_win
ndb/src/common/portlib/NdbSleep.c@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +4 -0
Import patch ndb_win
ndb/src/common/portlib/NdbTCP.cpp@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +0 -2
Import patch ndb_win
ndb/src/common/portlib/NdbThread.c@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +67 -2
Import patch ndb_win
ndb/src/common/portlib/NdbTick.c@stripped, 2007-08-09 18:26:05+10:00, stewart@willster.(none)
+21 -1
Import patch ndb_win
ndb/src/common/util/Properties.cpp@stripped, 2007-08-09 18:26:05+10:00,
stewart@willster.(none) +1 -1
Import patch ndb_win
ndb/src/common/util/SocketClient.cpp@stripped, 2007-08-09 18:26:06+10:00,
stewart@willster.(none) +15 -1
Import patch ndb_win
ndb/src/common/util/basestring_vsnprintf.c@stripped, 2007-08-09 18:26:06+10:00,
stewart@willster.(none) +4 -0
Import patch ndb_win
ndb/src/kernel/blocks/backup/Backup.hpp@stripped, 2007-08-09 18:26:06+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-08-09 18:26:06+10:00,
stewart@willster.(none) +1 -1
Import patch ndb_win
ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp@stripped, 2007-08-09 18:26:06+10:00,
stewart@willster.(none) +10 -0
Import patch ndb_win
ndb/src/kernel/blocks/dbdih/Dbdih.hpp@stripped, 2007-08-09 18:26:07+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp@stripped, 2007-08-09 18:26:07+10:00,
stewart@willster.(none) +3 -2
Import patch ndb_win
ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp@stripped, 2007-08-09
18:26:07+10:00, stewart@willster.(none) +10 -0
Import patch ndb_win
ndb/src/kernel/blocks/dbtc/Dbtc.hpp@stripped, 2007-08-09 18:26:07+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/kernel/blocks/dbtux/Dbtux.hpp@stripped, 2007-08-09 18:26:07+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp@stripped, 2007-08-09 18:26:07+10:00,
stewart@willster.(none) +10 -1
Import patch ndb_win
ndb/src/kernel/blocks/suma/Suma.hpp@stripped, 2007-08-09 18:26:08+10:00,
stewart@willster.(none) +1 -0
Import patch ndb_win
ndb/src/kernel/main.cpp@stripped, 2007-08-09 18:26:06+10:00, stewart@willster.(none) +3 -0
Import patch ndb_win
ndb/src/kernel/vm/Emulator.cpp@stripped, 2007-08-09 18:26:08+10:00, stewart@willster.(none)
+2 -0
Import patch ndb_win
ndb/src/kernel/vm/MetaData.hpp@stripped, 2007-08-09 18:26:08+10:00, stewart@willster.(none)
+1 -0
Import patch ndb_win
ndb/src/kernel/vm/SimulatedBlock.cpp@stripped, 2007-08-09 18:26:08+10:00,
stewart@willster.(none) +1 -1
Import patch ndb_win
ndb/src/kernel/vm/TransporterCallback.cpp@stripped, 2007-08-09 18:26:08+10:00,
stewart@willster.(none) +3 -3
Import patch ndb_win
ndb/src/kernel/vm/WatchDog.cpp@stripped, 2007-08-09 18:26:08+10:00, stewart@willster.(none)
+4 -0
Import patch ndb_win
ndb/src/mgmapi/LocalConfig.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none)
+1 -1
Import patch ndb_win
ndb/src/mgmapi/ndb_logevent.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none)
+16 -0
Import patch ndb_win
ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-08-09 18:26:09+10:00,
stewart@willster.(none) +12 -0
Import patch ndb_win
ndb/src/mgmclient/main.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none) +4
-0
Import patch ndb_win
ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none) +1
-1
Import patch ndb_win
ndb/src/mgmsrv/main.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none) +10 -0
Import patch ndb_win
ndb/tools/ndb_config.cpp@stripped, 2007-08-09 18:26:09+10:00, stewart@willster.(none) +4 -0
Import patch ndb_win
sql/CMakeLists.txt@stripped, 2007-08-09 18:26:10+10:00, stewart@willster.(none) +13 -2
Import patch ndb_win
sql/ha_ndbcluster.cc@stripped, 2007-08-09 18:26:10+10:00, stewart@willster.(none) +18 -36
Import patch ndb_win
# 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: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.0/ndb-win32
--- 1.48/extra/perror.c 2007-03-29 03:46:36 +10:00
+++ 1.49/extra/perror.c 2007-08-09 18:26:03 +10:00
@@ -17,6 +17,9 @@
#define PERROR_VERSION "2.10"
+#ifdef HAVE_NDBCLUSTER_DB
+#include <ndb_global.h>
+#endif
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
--- 1.85/include/config-win.h 2007-03-29 07:00:25 +10:00
+++ 1.86/include/config-win.h 2007-08-09 18:26:03 +10:00
@@ -153,7 +153,11 @@
#define Socket_defined
#define my_socket SOCKET
+#ifndef __cplusplus
#define bool BOOL
+#define true ((BOOL)1)
+#define false ((BOOL)0)
+#endif
#define SIGPIPE SIGINT
#define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID
@@ -172,6 +176,7 @@
#endif
#define VOID_SIGHANDLER
#define SIZEOF_CHAR 1
+#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
--- 1.13/CMakeLists.txt 2007-05-04 17:37:49 +10:00
+++ 1.14/CMakeLists.txt 2007-08-09 18:26:02 +10:00
@@ -14,17 +14,22 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
PROJECT(MySql)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
# This reads user configuration, generated by configure.js.
-INCLUDE(win/configure.data)
+INCLUDE(win/configure.data OPTIONAL)
+
+IF(NOT EXISTS win/configure.data)
+INCLUDE(config.cmake)
+ENDIF(NOT EXISTS win/configure.data)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
# Set standard options
-ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE)
-ADD_DEFINITIONS(-D CMAKE_BUILD)
-ADD_DEFINITIONS(-D HAVE_YASSL)
+ADD_DEFINITIONS(-DWITH_MYISAM_STORAGE_ENGINE)
+ADD_DEFINITIONS(-DCMAKE_BUILD)
+ADD_DEFINITIONS(-DHAVE_YASSL)
# Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
@@ -34,39 +39,46 @@
IF(WITH_ARCHIVE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_ARCHIVE_DB)
+ ADD_DEFINITIONS(-DHAVE_ARCHIVE_DB)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF (WITH_HEAP_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DWITH_HEAP_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
ENDIF (WITH_HEAP_STORAGE_ENGINE)
IF (WITH_MYISAMMRG_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DWITH_MYISAMMRG_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
ENDIF (WITH_MYISAMMRG_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_INNOBASE_DB)
- ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_INNOBASE_DB)
+ ADD_DEFINITIONS(-DWITH_INNOBASE_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+IF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_NDBCLUSTER_DB)
+ ADD_DEFINITIONS(-DWITH_NDBCLUSTER_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_ndbcluster_plugin")
+ SET(WITH_PARTITION_STORAGE_ENGINE TRUE)
+ENDIF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+
IF(WITH_FEDERATED_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_FEDERATED_DB)
- ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_FEDERATED_DB)
+ ADD_DEFINITIONS(-DWITH_FEDERATED_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_BERKELEY_DB)
- ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_BERKELEY_DB)
+ ADD_DEFINITIONS(-DWITH_BERKELEY_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
IF (WITH_BLACKHOLE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_BLACKHOLE_DB)
+ ADD_DEFINITIONS(-DHAVE_BLACKHOLE_DB)
ENDIF (WITH_BLACKHOLE_STORAGE_ENGINE)
SET(localstatedir "C:\\mysql\\data")
@@ -82,14 +94,14 @@
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
IF(__NT__)
- ADD_DEFINITIONS(-D __NT__)
+ ADD_DEFINITIONS(-D__NT__)
ENDIF(__NT__)
# in some places we use DBUG_OFF
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D DBUG_OFF")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D DBUG_OFF")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
@@ -133,7 +145,7 @@
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
CMAKE_GENERATOR MATCHES "Visual Studio 8")
-ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE")
+ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
IF(EMBED_MANIFESTS)
# Search for the Manifest tool. CMake will first search it's defaults
@@ -187,6 +199,9 @@
IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+IF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+ ADD_SUBDIRECTORY(ndb)
+ENDIF(WITH_NDBCLUSTER_STORAGE_ENGINE)
ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(sql/examples)
ADD_SUBDIRECTORY(server-tools/instance-manager)
--- 1.5/extra/CMakeLists.txt 2007-04-24 05:41:22 +10:00
+++ 1.6/extra/CMakeLists.txt 2007-08-09 18:26:02 +10:00
@@ -18,6 +18,11 @@
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+IF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ndb/include
+ ${CMAKE_SOURCE_DIR}/ndb/include/ndbapi
+ ${CMAKE_SOURCE_DIR}/ndb/include/mgmapi)
+ENDIF(WITH_NDBCLUSTER_STORAGE_ENGINE)
ADD_EXECUTABLE(comp_err comp_err.c)
TARGET_LINK_LIBRARIES(comp_err dbug mysys strings zlib wsock32)
--- 1.3/libmysql/CMakeLists.txt 2007-04-24 05:41:22 +10:00
+++ 1.4/libmysql/CMakeLists.txt 2007-08-09 18:26:03 +10:00
@@ -63,8 +63,8 @@
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c
../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c
../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
-ADD_DEPENDENCIES(libmysql dbug vio mysys strings GenError zlib yassl taocrypt)
-TARGET_LINK_LIBRARIES(libmysql mysys strings wsock32)
+ADD_DEPENDENCIES(libmysql vio GenError)
+TARGET_LINK_LIBRARIES(libmysql dbug mysys strings zlib yassl taocrypt wsock32)
ADD_EXECUTABLE(myTest mytest.c)
TARGET_LINK_LIBRARIES(myTest libmysql)
--- 1.6/sql/CMakeLists.txt 2007-05-16 00:30:09 +10:00
+++ 1.7/sql/CMakeLists.txt 2007-08-09 18:26:10 +10:00
@@ -28,6 +28,12 @@
${CMAKE_SOURCE_DIR}/bdb/build_win32
${CMAKE_SOURCE_DIR}/bdb/dbinc)
+IF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+ INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ndb/include
+ ${CMAKE_SOURCE_DIR}/ndb/include
+ ${CMAKE_SOURCE_DIR}/ndb/include/ndbapi)
+ENDIF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc
${CMAKE_SOURCE_DIR}/sql/message.h
${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
@@ -48,9 +54,10 @@
ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
- filesort.cc gstream.cc ha_blackhole.cc
+ filesort.cc gstream.cc
ha_archive.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc
ha_innodb.cc ha_federated.cc ha_berkeley.cc ha_blackhole.cc
+ ha_ndbcluster.cc ha_ndbcluster_cond.cc
handler.cc hash_filo.cc hash_filo.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
@@ -97,6 +104,10 @@
TARGET_LINK_LIBRARIES(mysqld innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+IF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld ndbclient)
+ENDIF(WITH_NDBCLUSTER_STORAGE_ENGINE)
+
IF(WITH_BERKELEY_STORAGE_ENGINE)
TARGET_LINK_LIBRARIES(mysqld bdb)
ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
@@ -138,4 +149,4 @@
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings)
-TARGET_LINK_LIBRARIES(udf_example wsock32)
+TARGET_LINK_LIBRARIES(udf_example strings wsock32)
--- 1.2/ndb/src/common/debugger/signaldata/CntrStart.cpp 2006-12-31 10:40:58 +11:00
+++ 1.3/ndb/src/common/debugger/signaldata/CntrStart.cpp 2007-08-09 18:26:03 +10:00
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <ndb_global.h>
#include <signaldata/CntrStart.hpp>
bool
--- 1.2/ndb/src/common/debugger/signaldata/ReadNodesConf.cpp 2006-12-31 10:40:58 +11:00
+++ 1.3/ndb/src/common/debugger/signaldata/ReadNodesConf.cpp 2007-08-09 18:26:04 +10:00
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <ndb_global.h>
#include <signaldata/ReadNodesConf.hpp>
bool
--- 1.23/ndb/tools/ndb_config.cpp 2007-01-22 23:10:38 +11:00
+++ 1.24/ndb/tools/ndb_config.cpp 2007-08-09 18:26:09 +10:00
@@ -24,7 +24,11 @@
#include <my_getopt.h>
#include <mysql_version.h>
+#ifndef NDB_WIN32
#include <netdb.h>
+#else
+#define strncasecmp(A,B,L) strnicmp((A),(B),(L))
+#endif
#include <NdbOut.hpp>
#include <mgmapi.h>
--- 1.16/ndb/include/ndb_types.h.in 2006-12-24 06:04:08 +11:00
+++ 1.17/ndb/include/ndb_types.h.in 2007-08-09 18:26:03 +10:00
@@ -20,22 +20,26 @@
#ifndef NDB_TYPES_H
#define NDB_TYPES_H
-#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
-#define NDB_SIZEOF_CHARP SIZEOF_CHARP
-#define NDB_SIZEOF_CHAR SIZEOF_CHAR
-#define NDB_SIZEOF_SHORT 2
-#define NDB_SIZEOF_INT SIZEOF_INT
-#define NDB_SIZEOF_LONG SIZEOF_LONG
-#define NDB_SIZEOF_LONG_LONG SIZEOF_LONG_LONG
-typedef unsigned __int64 Uint64;
-typedef signed __int64 Int64;
-#else
#define NDB_SIZEOF_CHARP @NDB_SIZEOF_CHARP@
#define NDB_SIZEOF_CHAR @NDB_SIZEOF_CHAR@
#define NDB_SIZEOF_INT @NDB_SIZEOF_INT@
#define NDB_SIZEOF_SHORT @NDB_SIZEOF_SHORT@
#define NDB_SIZEOF_LONG @NDB_SIZEOF_LONG@
#define NDB_SIZEOF_LONG_LONG @NDB_SIZEOF_LONG_LONG@
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+typedef unsigned __int64 Uint64;
+typedef signed __int64 Int64;
+#if defined (_WIN64)
+# define ssize_t __int64
+#elif defined (_WIN32)
+# define ssize_t long
+#endif
+#ifndef my_socket_defined
+#define my_socket SOCKET
+#define my_socket_defined
+#endif
+#else
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif
--- 1.37/ndb/include/ndbapi/NdbOperation.hpp 2007-04-24 16:15:29 +10:00
+++ 1.38/ndb/include/ndbapi/NdbOperation.hpp 2007-08-09 18:26:03 +10:00
@@ -337,8 +337,8 @@
* the attribute, or a NULL pointer
* (indicating error).
*/
- NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0);
NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0);
+ NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0);
NdbRecAttr* getValue(const NdbDictionary::Column*, char* val = 0);
/**
--- 1.14/ndb/src/common/logger/Logger.cpp 2006-12-24 06:04:13 +11:00
+++ 1.15/ndb/src/common/logger/Logger.cpp 2007-08-09 18:26:04 +10:00
@@ -200,7 +200,7 @@
if(handler == NULL)
{
- snprintf(errStr,len,"Could not create log destination: %s",
+ BaseString::snprintf(errStr,len,"Could not create log destination: %s",
logdest[i].c_str());
DBUG_RETURN(false);
}
--- 1.25/ndb/src/mgmapi/LocalConfig.cpp 2007-01-22 23:10:37 +11:00
+++ 1.26/ndb/src/mgmapi/LocalConfig.cpp 2007-08-09 18:26:09 +10:00
@@ -186,7 +186,7 @@
if (buf == tempString2)
break;
// try to add default port to see if it works
- snprintf(tempString2, sizeof(tempString2),"%s:%s", buf, NDB_PORT);
+ BaseString::snprintf(tempString2, sizeof(tempString2),"%s:%s", buf, NDB_PORT);
buf= tempString2;
} while(1);
return false;
--- 1.18/ndb/src/common/portlib/NdbConfig.c 2006-12-24 06:04:13 +11:00
+++ 1.19/ndb/src/common/portlib/NdbConfig.c 2007-08-09 18:26:04 +10:00
@@ -79,7 +79,8 @@
if (node_id > 0)
basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
else
- basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
+ basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u",
+ NdbHost_GetProcessId());
tmp_buf[sizeof(tmp_buf)-1]= 0;
buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf));
--- 1.6/ndb/src/common/portlib/NdbPortLibTest.cpp 2006-12-24 06:04:13 +11:00
+++ 1.7/ndb/src/common/portlib/NdbPortLibTest.cpp 2007-08-09 18:26:05 +10:00
@@ -53,7 +53,7 @@
if (arg1 != 7)
fail("TEST1", "Wrong arg");
- return returnvalue;
+ return (void*) returnvalue;
}
// test 2 variables and funcs
@@ -76,7 +76,7 @@
fail("TEST2", "Failed to unlock mutex");
int returnvalue = arg1;
- return returnvalue;
+ return (void*) returnvalue;
}
--- 1.8/ndb/src/common/portlib/NdbCondition.c 2006-12-24 06:04:13 +11:00
+++ 1.9/ndb/src/common/portlib/NdbCondition.c 2007-08-09 18:26:04 +10:00
@@ -23,7 +23,15 @@
struct NdbCondition
{
+#ifndef NDB_WIN32
pthread_cond_t cond;
+#else
+ long nWaiters;
+ NdbMutex* pNdbMutexWaitersLock;
+ HANDLE hSemaphore;
+ HANDLE hEventWaitersDone;
+ int bWasBroadcast;
+#endif
};
@@ -39,7 +47,18 @@
if (tmpCond == NULL)
return NULL;
+#ifndef NDB_WIN32
result = pthread_cond_init(&tmpCond->cond, NULL);
+#else
+ tmpCond->nWaiters = 0;
+ tmpCond->bWasBroadcast = 0;
+ if(!(tmpCond->hSemaphore = CreateSemaphore(0, 0, MAXLONG, 0)))
+ result = -1;
+ else if(!(tmpCond->pNdbMutexWaitersLock = NdbMutex_Create()))
+ result = -1;
+ else if(!(tmpCond->hEventWaitersDone = CreateEvent(0, 0, 0, 0)))
+ result = -1;
+#endif
assert(result==0);
return tmpCond;
@@ -52,11 +71,34 @@
NdbMutex* p_mutex)
{
int result;
+#ifdef NDB_WIN32
+ int bLastWaiter;
+#endif
if (p_cond == NULL || p_mutex == NULL)
return 1;
+#ifndef NDB_WIN32
result = pthread_cond_wait(&p_cond->cond, p_mutex);
+#else
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ p_cond->nWaiters++;
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+
+ if(NdbMutex_Unlock(p_mutex))
+ return -1;
+ result = WaitForSingleObject (p_cond->hSemaphore, INFINITE);
+
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ p_cond->nWaiters--;
+ bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0);
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+
+ if(result==WAIT_OBJECT_0 && bLastWaiter)
+ SetEvent(p_cond->hEventWaitersDone);
+
+ NdbMutex_Lock(p_mutex);
+#endif
return result;
}
@@ -66,12 +108,17 @@
NdbMutex* p_mutex,
int msecs){
int result;
+#ifndef NDB_WIN32
struct timespec abstime;
int secs = 0;
+#else
+ int bLastWaiter;
+#endif
if (p_cond == NULL || p_mutex == NULL)
return 1;
-
+
+#ifndef NDB_WIN32
#ifdef HAVE_CLOCK_GETTIME
clock_gettime(CLOCK_REALTIME, &abstime);
#else
@@ -96,6 +143,30 @@
}
result = pthread_cond_timedwait(&p_cond->cond, p_mutex, &abstime);
+#else
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ p_cond->nWaiters++;
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+ if(msecs<0)
+ msecs = 0;
+
+ if(NdbMutex_Unlock(p_mutex))
+ return -1;
+ result = WaitForSingleObject(p_cond->hSemaphore, msecs);
+
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ p_cond->nWaiters--;
+ bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0);
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+
+ if(result!=WAIT_OBJECT_0)
+ result = -1;
+
+ if(bLastWaiter)
+ SetEvent(p_cond->hEventWaitersDone);
+
+ NdbMutex_Lock(p_mutex);
+#endif
return result;
}
@@ -107,7 +178,16 @@
if (p_cond == NULL)
return 1;
+#ifndef NDB_WIN32
result = pthread_cond_signal(&p_cond->cond);
+#else
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ result = (p_cond->nWaiters > 0);
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+
+ if(result)
+ return (ReleaseSemaphore(p_cond->hSemaphore, 1, 0) ? 0 : -1);
+#endif
return result;
}
@@ -120,7 +200,27 @@
if (p_cond == NULL)
return 1;
+#ifndef NDB_WIN32
result = pthread_cond_broadcast(&p_cond->cond);
+#else
+ NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
+ result = 0;
+ if(p_cond->nWaiters > 0)
+ {
+ p_cond->bWasBroadcast = !0;
+ result= 1;
+ }
+ NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
+ if(result)
+ {
+ result = 0;
+ if(!ReleaseSemaphore(p_cond->hSemaphore, p_cond->nWaiters, 0))
+ result = -1;
+ else if(WaitForSingleObject (p_cond->hEventWaitersDone, INFINITE) !=
WAIT_OBJECT_0)
+ result = -1;
+ p_cond->bWasBroadcast = 0;
+ }
+#endif
return result;
}
@@ -133,7 +233,14 @@
if (p_cond == NULL)
return 1;
+#ifndef NDB_WIN32
result = pthread_cond_destroy(&p_cond->cond);
+#else
+ CloseHandle(p_cond->hEventWaitersDone);
+ NdbMutex_Destroy(p_cond->pNdbMutexWaitersLock);
+ result = (CloseHandle(p_cond->hSemaphore) ? 0 : -1);
+#endif
+
free(p_cond);
return 0;
--- 1.12/ndb/src/common/portlib/NdbDaemon.c 2006-12-24 06:04:13 +11:00
+++ 1.13/ndb/src/common/portlib/NdbDaemon.c 2007-08-09 18:26:04 +10:00
@@ -21,6 +21,13 @@
int NdbDaemon_ErrorCode = 0;
char NdbDaemon_ErrorText[NdbDaemon_ErrorSize] = "";
+#ifdef NDB_WIN32
+#define F_ULOCK _LK_UNLCK
+#define F_LOCK _LK_LOCK
+#define F_TLOCK _LK_NBLCK
+#define lockf(fd,mode,size) _locking((fd),(mode),(size))
+#endif
+
int
NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
{
@@ -34,7 +41,7 @@
lockfd = open(lockfile, O_CREAT|O_RDWR, 0644);
if (lockfd == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: open for write failed: %s", lockfile, strerror(errno));
return -1;
}
@@ -43,14 +50,14 @@
n = read(lockfd, buf, sizeof(buf));
if (n < 0) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: read failed: %s", lockfile, strerror(errno));
return -1;
}
NdbDaemon_DaemonPid = atol(buf);
if (lseek(lockfd, 0, SEEK_SET) == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: lseek failed: %s", lockfile, strerror(errno));
return -1;
}
@@ -59,12 +66,12 @@
if (lockf(lockfd, F_TLOCK, 0) == -1)
{
if (errno == EACCES || errno == EAGAIN) { /* results may vary */
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: already locked by pid=%ld", lockfile, NdbDaemon_DaemonPid);
return -1;
}
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: lock test failed: %s", lockfile, strerror(errno));
return -1;
}
@@ -74,7 +81,7 @@
logfd = open(logfile, O_CREAT|O_WRONLY|O_APPEND, 0644);
if (logfd == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: open for write failed: %s", logfile, strerror(errno));
return -1;
}
@@ -82,17 +89,18 @@
#ifdef F_TLOCK
if (lockf(lockfd, F_ULOCK, 0) == -1)
{
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: fail to unlock", lockfile);
return -1;
}
#endif
+#ifndef NDB_WIN32
/* Fork */
n = fork();
if (n == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"fork failed: %s", strerror(errno));
return -1;
}
@@ -100,26 +108,32 @@
if (n != 0) {
exit(0);
}
+#endif
+
/* Running in child process */
- NdbDaemon_DaemonPid = getpid();
+ NdbDaemon_DaemonPid = NdbHost_GetProcessId();
/* Lock the lock file (likely to succeed due to test above) */
if (lockf(lockfd, F_LOCK, 0) == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: lock failed: %s", lockfile, strerror(errno));
return -1;
}
+#ifndef NDB_WIN32
/* Become process group leader */
if (setsid() == -1) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"setsid failed: %s", strerror(errno));
return -1;
}
/* Write pid to lock file */
if (ftruncate(lockfd, 0) == -1) {
+#else
+ if (_chsize(lockfd, 0) == -1) {
+#endif
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: ftruncate failed: %s", lockfile, strerror(errno));
return -1;
}
@@ -127,13 +141,17 @@
n = strlen(buf);
if (write(lockfd, buf, n) != n) {
NdbDaemon_ErrorCode = errno;
- snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ basestring_snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
"%s: write failed: %s", lockfile, strerror(errno));
return -1;
}
/* Do input/output redirections (assume fd 0,1,2 not in use) */
close(0);
+#ifndef NDB_WIN32
open("/dev/null", O_RDONLY);
+#else
+ open("nul:", O_RDONLY);
+#endif
if (logfile != 0) {
dup2(logfd, 1);
dup2(logfd, 2);
--- 1.4/ndb/src/common/portlib/NdbHost.c 2006-12-24 06:04:13 +11:00
+++ 1.5/ndb/src/common/portlib/NdbHost.c 2007-08-09 18:26:04 +10:00
@@ -19,15 +19,42 @@
int NdbHost_GetHostName(char* buf)
{
+#ifndef NDB_WIN32
if (gethostname(buf, MAXHOSTNAMELEN) != 0)
{
return -1;
}
+#else
+ /* We must initialize TCP/IP if we want to call gethostname */
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ wVersionRequested = MAKEWORD( 2, 0 );
+ err = WSAStartup( wVersionRequested, &wsaData );
+ if ( err != 0 ) {
+ /**
+ * Tell the user that we couldn't find a usable
+ * WinSock DLL.
+ */
+ return -1;
+ }
+
+ /* Get host name */
+ if(gethostname(buf, MAXHOSTNAMELEN))
+ {
+ return -1;
+ }
+#endif
return 0;
}
int NdbHost_GetProcessId(void)
{
+#ifndef NDB_WIN32
return getpid();
+#else
+ return _getpid();
+#endif
}
--- 1.10/ndb/src/common/portlib/NdbMutex.c 2006-12-24 06:04:13 +11:00
+++ 1.11/ndb/src/common/portlib/NdbMutex.c 2007-08-09 18:26:05 +10:00
@@ -32,8 +32,12 @@
if (pNdbMutex == NULL)
DBUG_RETURN(NULL);
+#ifndef NDB_WIN32
result = pthread_mutex_init(pNdbMutex, NULL);
assert(result == 0);
+#else
+ InitializeCriticalSection(pNdbMutex);
+#endif
DBUG_RETURN(pNdbMutex);
}
@@ -47,7 +51,12 @@
if (p_mutex == NULL)
DBUG_RETURN(-1);
+#ifndef NDB_WIN32
result = pthread_mutex_destroy(p_mutex);
+#else
+ DeleteCriticalSection(p_mutex);
+ result = 0;
+#endif
DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex));
NdbMem_Free(p_mutex);
@@ -64,7 +73,12 @@
if (p_mutex == NULL)
return -1;
+#ifndef NDB_WIN32
result = pthread_mutex_lock(p_mutex);
+#else
+ EnterCriticalSection(p_mutex);
+ result = 0;
+#endif
return result;
}
@@ -77,7 +91,12 @@
if (p_mutex == NULL)
return -1;
+#ifndef NDB_WIN32
result = pthread_mutex_unlock(p_mutex);
+#else
+ LeaveCriticalSection(p_mutex);
+ result = 0;
+#endif
return result;
}
@@ -88,7 +107,12 @@
int result = -1;
if (p_mutex != NULL) {
+#ifndef NDB_WIN32
result = pthread_mutex_trylock(p_mutex);
+#else
+ if (TryEnterCriticalSection(p_mutex))
+ result = 0;
+#endif
}
return result;
--- 1.7/ndb/src/common/portlib/NdbSleep.c 2006-12-24 06:04:13 +11:00
+++ 1.8/ndb/src/common/portlib/NdbSleep.c 2007-08-09 18:26:05 +10:00
@@ -35,7 +35,11 @@
int
NdbSleep_SecSleep(int seconds){
int result = 0;
+#ifndef NDB_WIN32
result = sleep(seconds);
+#else
+ sleep(seconds);
+#endif
return result;
}
--- 1.14/ndb/src/common/portlib/NdbTCP.cpp 2006-12-24 06:04:13 +11:00
+++ 1.15/ndb/src/common/portlib/NdbTCP.cpp 2007-08-09 18:26:05 +10:00
@@ -53,14 +53,12 @@
return -1; //DBUG_RETURN(-1);
}
-#ifndef DBUG_OFF
extern "C"
int NDB_CLOSE_SOCKET(int fd)
{
DBUG_PRINT("info", ("NDB_CLOSE_SOCKET(%d)", fd));
return _NDB_CLOSE_SOCKET(fd);
}
-#endif
#if 0
int
--- 1.26/ndb/src/common/portlib/NdbThread.c 2006-12-24 06:04:13 +11:00
+++ 1.27/ndb/src/common/portlib/NdbThread.c 2007-08-09 18:26:05 +10:00
@@ -29,18 +29,29 @@
struct NdbThread
{
+#ifndef NDB_WIN32
pthread_t thread;
+#else
+ HANDLE hThread;
+ unsigned nThreadId;
+#endif
char thread_name[MAX_THREAD_NAME];
NDB_THREAD_FUNC * func;
void * object;
};
static
+#ifndef NDB_WIN32
void*
ndb_thread_wrapper(void* _ss){
+#else
+WINAPI
+ndb_thread_wrapper(void* _ss){
+#endif
my_thread_init();
{
DBUG_ENTER("ndb_thread_wrapper");
+#ifndef NDB_WIN32
#ifdef NDB_SHM_TRANSPORTER
if (g_ndb_shm_signum)
{
@@ -60,6 +71,7 @@
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
+#endif
{
void *ret;
@@ -82,7 +94,12 @@
{
struct NdbThread* tmpThread;
int result;
+#ifndef NDB_WIN32
pthread_attr_t thread_attr;
+#else
+ unsigned initflag;
+ int nPriority = 0;
+#endif
DBUG_ENTER("NdbThread_Create");
(void)thread_prio; /* remove warning for unused parameter */
@@ -98,6 +115,9 @@
strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name));
+ tmpThread->func= p_thread_func;
+ tmpThread->object= p_thread_arg;
+#ifndef NDB_WIN32
pthread_attr_init(&thread_attr);
#if (SIZEOF_CHARP == 8)
pthread_attr_setstacksize(&thread_attr, 2*thread_stack_size);
@@ -112,8 +132,6 @@
#ifdef PTHREAD_CREATE_JOINABLE /* needed on SCO */
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
#endif
- tmpThread->func= p_thread_func;
- tmpThread->object= p_thread_arg;
result = pthread_create(&tmpThread->thread,
&thread_attr,
ndb_thread_wrapper,
@@ -121,6 +139,30 @@
assert(result==0);
pthread_attr_destroy(&thread_attr);
+#else
+ switch(thread_prio)
+ {
+ case NDB_THREAD_PRIO_HIGHEST: nPriority=THREAD_PRIORITY_HIGHEST; break;
+ case NDB_THREAD_PRIO_HIGH: nPriority=THREAD_PRIORITY_ABOVE_NORMAL; break;
+ case NDB_THREAD_PRIO_MEAN: nPriority=THREAD_PRIORITY_NORMAL; break;
+ case NDB_THREAD_PRIO_LOW: nPriority=THREAD_PRIORITY_BELOW_NORMAL; break;
+ case NDB_THREAD_PRIO_LOWEST: nPriority=THREAD_PRIORITY_LOWEST; break;
+ }
+ initflag = (nPriority ? CREATE_SUSPENDED : 0);
+
+ tmpThread->hThread = (HANDLE)_beginthreadex(0, thread_stack_size,
+ ndb_thread_wrapper, p_thread_arg,
+ initflag, &tmpThread->nThreadId);
+
+ if(nPriority && tmpThread->hThread)
+ {
+ SetThreadPriority(tmpThread->hThread, nPriority);
+ ResumeThread (tmpThread->hThread);
+ }
+
+ assert(tmpThread->hThread);
+#endif
+
DBUG_PRINT("exit",("ret: 0x%lx", (long) tmpThread));
DBUG_RETURN(tmpThread);
}
@@ -131,6 +173,10 @@
DBUG_ENTER("NdbThread_Destroy");
if (*p_thread != NULL){
DBUG_PRINT("enter",("*p_thread: 0x%lx", (long) *p_thread));
+#ifdef NDB_WIN32
+ CloseHandle((*p_thread)->hThread);
+ (*p_thread)->hThread = 0;
+#endif
free(* p_thread);
* p_thread = 0;
}
@@ -140,6 +186,7 @@
int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
{
+#ifndef NDB_WIN32
int result;
if (p_wait_thread == NULL)
@@ -151,13 +198,31 @@
result = pthread_join(p_wait_thread->thread, status);
return result;
+#else
+ void *local_status = 0;
+ if (status == 0)
+ status = &local_status;
+
+ if(WaitForSingleObject(p_wait_thread->hThread, INFINITE) == WAIT_OBJECT_0
+ && GetExitCodeThread(p_wait_thread->hThread, (LPDWORD)status))
+ {
+ CloseHandle(p_wait_thread->hThread);
+ p_wait_thread->hThread = 0;
+ return 0;
+ }
+ return -1;
+#endif
}
void NdbThread_Exit(void *status)
{
my_thread_end();
+#ifndef NDB_WIN32
pthread_exit(status);
+#else
+ _endthreadex((DWORD) status);
+#endif
}
--- 1.8/ndb/src/common/portlib/NdbTick.c 2007-01-22 23:10:37 +11:00
+++ 1.9/ndb/src/common/portlib/NdbTick.c 2007-08-09 18:26:05 +10:00
@@ -24,7 +24,27 @@
#define MILLISEC_PER_NANOSEC 1000000
-#ifdef HAVE_CLOCK_GETTIME
+#ifdef NDB_WIN32
+NDB_TICKS NdbTick_CurrentMillisecond(void)
+{
+ LARGE_INTEGER liCount, liFreq;
+ QueryPerformanceCounter(&liCount);
+ QueryPerformanceFrequency(&liFreq);
+ return (liCount.QuadPart*1000) / liFreq.QuadPart;
+}
+
+int
+NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros)
+{
+ LARGE_INTEGER liCount, liFreq;
+ QueryPerformanceCounter(&liCount);
+ QueryPerformanceFrequency(&liFreq);
+ *secs = liCount.QuadPart / liFreq.QuadPart;
+ liCount.QuadPart -= *secs * liFreq.QuadPart;
+ *micros = (liCount.QuadPart*1000000) / liFreq.QuadPart;
+ return 0;
+}
+#elif defined(HAVE_CLOCK_GETTIME)
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
struct timespec tick_time;
--- 1.13/ndb/src/common/util/Properties.cpp 2007-01-22 23:10:37 +11:00
+++ 1.14/ndb/src/common/util/Properties.cpp 2007-08-09 18:26:05 +10:00
@@ -167,7 +167,7 @@
return false;
}
}
- return tmp->put(new PropertyImpl(short_name, value));
+ return (tmp->put(new PropertyImpl(short_name, value))) != NULL;
}
--- 1.15/ndb/src/kernel/blocks/backup/Backup.hpp 2006-12-24 06:04:14 +11:00
+++ 1.16/ndb/src/kernel/blocks/backup/Backup.hpp 2007-08-09 18:26:06 +10:00
@@ -16,6 +16,7 @@
#ifndef BACKUP_H
#define BACKUP_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <SimulatedBlock.hpp>
--- 1.84/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-05-30 20:32:32 +10:00
+++ 1.85/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-08-09 18:26:06 +10:00
@@ -1098,7 +1098,7 @@
if (!ok)
{
char reason_msg[128];
- snprintf(reason_msg, sizeof(reason_msg),
+ BaseString::snprintf(reason_msg, sizeof(reason_msg),
"schema file corrupt, page %u (%s, "
"sz=%u sz0=%u pn=%u)",
n, reason, sf->FileSize, sf0->FileSize, sf->PageNumber);
--- 1.13/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp 2006-12-24 06:04:15 +11:00
+++ 1.14/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp 2007-08-09 18:26:06 +10:00
@@ -17,6 +17,11 @@
#include <ndb_global.h>
#include <ndb_version.h>
+#ifdef NDB_WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <SchemaFile.hpp>
@@ -203,8 +208,13 @@
const char * filename = argv[1];
argc--, argv++;
+#ifndef NDB_WIN32
struct stat sbuf;
const int res = stat(filename, &sbuf);
+#else
+ struct _stat sbuf;
+ const int res = _stat(filename, &sbuf);
+#endif
if (res != 0) {
ndbout << filename << ": not found errno=" << errno <<
endl;
exitcode = 1;
--- 1.20/ndb/src/kernel/blocks/dbdih/Dbdih.hpp 2007-03-22 01:42:10 +11:00
+++ 1.21/ndb/src/kernel/blocks/dbdih/Dbdih.hpp 2007-08-09 18:26:07 +10:00
@@ -16,6 +16,7 @@
#ifndef DBDIH_H
#define DBDIH_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <pc.hpp>
#include <SimulatedBlock.hpp>
--- 1.73/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2007-05-28 23:59:58 +10:00
+++ 1.74/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2007-08-09 18:26:07 +10:00
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define DBDIH_C
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <ndb_version.h>
#include <NdbOut.hpp>
@@ -13662,8 +13663,8 @@
buf2[0]= 0;
for(Uint32 i = 0; i<length; i++)
{
- snprintf(buf, 100, "%s %.8x", buf2, signal->theData[i]);
- snprintf(buf2, 100, "%s", buf);
+ BaseString::snprintf(buf, 100, "%s %.8x", buf2, signal->theData[i]);
+ BaseString::snprintf(buf2, 100, "%s", buf);
}
warningEvent("gsn: %d block: %s, length: %d theData: %s",
gsn, getBlockName(block, "UNKNOWN"), length, buf);
--- 1.5/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp 2006-12-24 06:04:15
+11:00
+++ 1.6/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp 2007-08-09 18:26:07
+10:00
@@ -16,6 +16,11 @@
#include <ndb_global.h>
+#ifdef NDB_WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <Sysfile.hpp>
@@ -125,8 +130,13 @@
for(int i = 1; i<argc; i++){
const char * filename = argv[i];
+#ifndef NDB_WIN32
struct stat sbuf;
const int res = stat(filename, &sbuf);
+#else
+ struct _stat sbuf;
+ const int res = _stat(filename, &sbuf);
+#endif
if(res != 0){
ndbout << "Could not find file: \"" << filename << "\"" <<
endl;
continue;
--- 1.45/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2007-03-24 00:07:48 +11:00
+++ 1.46/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2007-08-09 18:26:07 +10:00
@@ -16,6 +16,7 @@
#ifndef DBTC_H
#define DBTC_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <pc.hpp>
#include <SimulatedBlock.hpp>
--- 1.44/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2006-12-24 06:04:15 +11:00
+++ 1.45/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2007-08-09 18:26:07 +10:00
@@ -16,6 +16,7 @@
#ifndef DBTUX_H
#define DBTUX_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <SimulatedBlock.hpp>
#include <AttributeDescriptor.hpp>
--- 1.22/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2006-12-24 06:04:16 +11:00
+++ 1.23/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2007-08-09 18:26:07 +10:00
@@ -218,7 +218,7 @@
rmrfReq(request, (char*)theFileName.c_str(), request->par.rmrf.own_directory);
break;
case Request:: end:
- if (theFd > 0)
+ if (isOpen())
closeReq(request);
endReq();
return;
@@ -510,6 +510,14 @@
}
DEBUG(ndbout_c("extendfile: maxOffset=%d, size=%d", maxOffset, maxSize));
+#ifdef NDB_WIN32
+ int return_value;
+ if (SetFilePointer(hFile, maxOffset + maxSize, NULL,
+ FILE_BEGIN) == INVALID_SET_FILE_POINTER &&
+ (return_value = GetLastError()) != NO_ERROR)
+ if (!SetEndOfFile(hFile))
+ return GetLastError();
+#else
// Allocate a buffer and fill it with zeros
void* pbuf = ndbd_malloc(maxSize);
memset(pbuf, 0, maxSize);
@@ -531,6 +539,7 @@
}
}
ndbd_free(pbuf,maxSize);
+#endif
DEBUG(ndbout_c("extendfile: \"%s\" OK!", theFileName.c_str()));
return 0;
--- 1.9/ndb/src/kernel/blocks/suma/Suma.hpp 2007-01-22 23:10:37 +11:00
+++ 1.10/ndb/src/kernel/blocks/suma/Suma.hpp 2007-08-09 18:26:08 +10:00
@@ -16,6 +16,7 @@
#ifndef SUMA_H
#define SUMA_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <SimulatedBlock.hpp>
--- 1.62/ndb/src/kernel/main.cpp 2006-12-24 06:04:14 +11:00
+++ 1.63/ndb/src/kernel/main.cpp 2007-08-09 18:26:06 +10:00
@@ -100,7 +100,10 @@
fprintf(child_info_file_w, "\n");
fclose(child_info_file_r);
fclose(child_info_file_w);
+#ifndef NDB_WIN32
+ /* bad practice to use absolute numbers for signals */
signal(6, SIG_DFL);
+#endif
abort();
}
--- 1.21/ndb/src/kernel/vm/Emulator.cpp 2006-12-24 06:04:16 +11:00
+++ 1.22/ndb/src/kernel/vm/Emulator.cpp 2007-08-09 18:26:08 +10:00
@@ -240,8 +240,10 @@
if(type != NST_Normal && type != NST_Restart){
// Signal parent that error occured during startup
+#ifndef NDB_WIN32
if (type == NST_ErrorHandlerStartup)
kill(getppid(), SIGUSR1);
+#endif
g_eventLogger.info("Error handler shutdown completed - %s", exitAbort);
if (opt_core)
{
--- 1.7/ndb/src/kernel/vm/MetaData.hpp 2007-01-22 23:10:37 +11:00
+++ 1.8/ndb/src/kernel/vm/MetaData.hpp 2007-08-09 18:26:08 +10:00
@@ -16,6 +16,7 @@
#ifndef KERNEL_VM_METADATA_HPP
#define KERNEL_VM_METADATA_HPP
+#include <ndb_global.h>
#include <ndb_types.h>
#include <ndb_limits.h>
#include <ErrorReporter.hpp>
--- 1.28/ndb/src/kernel/vm/SimulatedBlock.cpp 2006-12-24 06:04:17 +11:00
+++ 1.29/ndb/src/kernel/vm/SimulatedBlock.cpp 2007-08-09 18:26:08 +10:00
@@ -855,7 +855,7 @@
SimulatedBlock::execSIGNAL_DROPPED_REP(Signal * signal){
char msg[64];
const SignalDroppedRep * const rep = (SignalDroppedRep *)&signal->theData[0];
- snprintf(msg, sizeof(msg), "%s GSN: %u (%u,%u)", getBlockName(number()),
+ BaseString::snprintf(msg, sizeof(msg), "%s GSN: %u (%u,%u)", getBlockName(number()),
rep->originalGsn, rep->originalLength,rep->originalSectionCount);
ErrorReporter::handleError(NDBD_EXIT_OUT_OF_LONG_SIGNAL_MEMORY,
msg,
--- 1.15/ndb/src/kernel/vm/TransporterCallback.cpp 2006-12-24 06:04:17 +11:00
+++ 1.16/ndb/src/kernel/vm/TransporterCallback.cpp 2007-08-09 18:26:08 +10:00
@@ -343,7 +343,7 @@
case TE_SIGNAL_LOST_SEND_BUFFER_FULL:
{
char msg[64];
- snprintf(msg, sizeof(msg), "Remote note id %d.%s%s", nodeId,
+ BaseString::snprintf(msg, sizeof(msg), "Remote note id %d.%s%s", nodeId,
info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL,
msg, __FILE__, NST_ErrorHandler);
@@ -351,7 +351,7 @@
case TE_SIGNAL_LOST:
{
char msg[64];
- snprintf(msg, sizeof(msg), "Remote node id %d,%s%s", nodeId,
+ BaseString::snprintf(msg, sizeof(msg), "Remote node id %d,%s%s", nodeId,
info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST,
msg, __FILE__, NST_ErrorHandler);
@@ -359,7 +359,7 @@
case TE_SHM_IPC_PERMANENT:
{
char msg[128];
- snprintf(msg, sizeof(msg),
+ BaseString::snprintf(msg, sizeof(msg),
"Remote node id %d.%s%s",
nodeId, info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_CONNECTION_SETUP_FAILED,
--- 1.7/ndb/src/kernel/vm/WatchDog.cpp 2007-05-29 00:31:29 +10:00
+++ 1.8/ndb/src/kernel/vm/WatchDog.cpp 2007-08-09 18:26:08 +10:00
@@ -16,7 +16,9 @@
#include <ndb_global.h>
#include <my_pthread.h>
+#ifndef NDB_WIN32
#include <sys/times.h>
+#endif
#include "WatchDog.hpp"
#include "GlobalData.hpp"
@@ -130,6 +132,7 @@
break;
}//switch
g_eventLogger.warning("Ndb kernel is stuck in: %s", last_stuck_action);
+#ifndef NDB_WIN32
{
struct tms my_tms;
times(&my_tms);
@@ -137,6 +140,7 @@
(Uint64)my_tms.tms_utime,
(Uint64)my_tms.tms_stime);
}
+#endif
if(alerts == 3){
shutdownSystem(last_stuck_action);
}
--- 1.78/ndb/src/mgmclient/CommandInterpreter.cpp 2007-06-15 02:40:30 +10:00
+++ 1.79/ndb/src/mgmclient/CommandInterpreter.cpp 2007-08-09 18:26:09 +10:00
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <NdbTCP.h>
#include <my_sys.h>
//#define HAVE_GLOBAL_REPLICATION
@@ -21,6 +22,17 @@
#include <Vector.hpp>
#ifdef HAVE_GLOBAL_REPLICATION
#include "../rep/repapi/repapi.h"
+#endif
+
+#ifdef NDB_WIN32
+inline int xsleep(unsigned seconds)
+{
+ sleep(seconds);
+ return 0;
+}
+#undef sleep
+#define sleep(X) xsleep(X)
+#define strncasecmp(S1,S2,L) strnicmp((S1),(S2),(L))
#endif
#include <mgmapi.h>
--- 1.25/ndb/src/mgmclient/main.cpp 2007-02-22 04:38:38 +11:00
+++ 1.26/ndb/src/mgmclient/main.cpp 2007-08-09 18:26:09 +10:00
@@ -42,6 +42,7 @@
static Ndb_mgmclient* com;
+#ifndef NDB_WIN32
extern "C"
void
handler(int sig)
@@ -58,6 +59,7 @@
}
DBUG_VOID_RETURN;
}
+#endif
NDB_STD_OPTS_VARS;
@@ -152,7 +154,9 @@
prompt= 0;
}
+#ifndef NDB_WIN32
signal(SIGPIPE, handler);
+#endif
com = new Ndb_mgmclient(opt_connect_str,1);
int ret= 0;
if (!opt_execute_str)
--- 1.117/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-05-09 23:02:59 +10:00
+++ 1.118/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-08-09 18:26:09 +10:00
@@ -2890,7 +2890,7 @@
{
int r= 0;
m_local_mgm_handle= ndb_mgm_create_handle();
- snprintf(m_local_mgm_connect_string,sizeof(m_local_mgm_connect_string),
+ BaseString::snprintf(m_local_mgm_connect_string,sizeof(m_local_mgm_connect_string),
"localhost:%u",getPort());
ndb_mgm_set_connectstring(m_local_mgm_handle, m_local_mgm_connect_string);
--- 1.51/ndb/src/mgmsrv/main.cpp 2007-01-22 23:10:38 +11:00
+++ 1.52/ndb/src/mgmsrv/main.cpp 2007-08-09 18:26:09 +10:00
@@ -16,6 +16,11 @@
#include <ndb_global.h>
#include <ndb_opts.h>
+#ifdef NDB_WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#include "MgmtSrvr.hpp"
#include "EventLogger.hpp"
#include <Config.hpp>
@@ -235,8 +240,13 @@
if (opt_mycnf == 0 && opt_config_filename == 0)
{
+#ifndef NDB_WIN32
struct stat buf;
if (stat("config.ini", &buf) != -1)
+#else
+ struct _stat buf;
+ if (_stat("config.ini", &buf) != -1)
+#endif
opt_config_filename = "config.ini";
}
--- 1.314/sql/ha_ndbcluster.cc 2007-07-25 17:33:55 +10:00
+++ 1.315/sql/ha_ndbcluster.cc 2007-08-09 18:26:10 +10:00
@@ -666,7 +666,7 @@
int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
uint fieldnr, bool *set_blob_value)
{
- const byte* field_ptr= field->ptr;
+ const byte* field_ptr= (byte*) field->ptr;
uint32 pack_len= field->pack_length();
DBUG_ENTER("set_ndb_value");
DBUG_PRINT("enter", ("%d: %s, type: %u, len=%d, is_null=%s",
@@ -729,7 +729,7 @@
Field_blob *field_blob= (Field_blob*)field;
// Get length and pointer to data
- uint32 blob_len= field_blob->get_length(field_ptr);
+ uint32 blob_len= field_blob->get_length((char*) field_ptr);
char* blob_ptr= NULL;
field_blob->get_ptr(&blob_ptr);
@@ -861,15 +861,15 @@
{
byte *field_buf;
if (field->pack_length() != 0)
- field_buf= buf + (field->ptr - table->record[0]);
+ field_buf= buf + ((byte*) field->ptr - table->record[0]);
else
field_buf= (byte *)&dummy_buf;
- m_value[fieldnr].rec= ndb_op->getValue(fieldnr,
- field_buf);
+ m_value[fieldnr].rec= ndb_op->getValue((Uint32) fieldnr,
+ (char*) field_buf);
}
else // if (field->type() == MYSQL_TYPE_BIT)
{
- m_value[fieldnr].rec= ndb_op->getValue(fieldnr);
+ m_value[fieldnr].rec= ndb_op->getValue((Uint32) fieldnr);
}
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
@@ -888,7 +888,7 @@
}
// Used for hidden key only
- m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref);
+ m_value[fieldnr].rec= ndb_op->getValue((Uint32) fieldnr, (char*) m_ref);
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
@@ -1312,7 +1312,7 @@
buf[0]= 255;
}
memmove(buf + 1, ptr + 2, pack_len - 1);
- ptr= buf;
+ ptr= (byte*) buf;
}
}
}
@@ -1971,7 +1971,7 @@
p.part_ptr= &p.key->key[tot_len];
p.part_null= key_part->null_bit && *p.part_ptr;
p.bound_ptr= (const char *)
- p.part_null ? 0 : key_part->null_bit ? p.part_ptr + 1 : p.part_ptr;
+ (p.part_null ? 0 : key_part->null_bit ? p.part_ptr + 1 : p.part_ptr);
if (j == 0)
{
@@ -2067,7 +2067,7 @@
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
{
- const char* ptr= p.bound_ptr;
+ const byte* ptr= (const byte*) p.bound_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
if (op->setBound(i, p.bound_type, ptr))
@@ -2546,7 +2546,7 @@
// Require that the PK for this record has previously been
// read into m_ref
- DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ DBUG_DUMP("key", (char*) m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH);
if (set_hidden_key(op, table->s->fields, m_ref))
ERR_RETURN(op->getNdbError());
@@ -5372,7 +5372,7 @@
{
bool file_on_disk= false;
DBUG_PRINT("info", ("%s", file_name));
- if (hash_search(&ndb_tables, file_name, strlen(file_name)))
+ if (hash_search(&ndb_tables, (byte*) file_name, strlen(file_name)))
{
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name));
file_on_disk= true;
@@ -5389,9 +5389,9 @@
if (file_on_disk)
{
// Ignore this ndb table
- gptr record= hash_search(&ndb_tables, file_name, strlen(file_name));
+ gptr record= hash_search(&ndb_tables, (byte*) file_name, strlen(file_name));
DBUG_ASSERT(record);
- hash_delete(&ndb_tables, record);
+ hash_delete(&ndb_tables, (byte*) record);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_EXISTS_ERROR,
"Local table %s.%s shadows ndb table",
@@ -5422,8 +5422,8 @@
List<char> create_list;
for (i= 0 ; i < ndb_tables.records ; i++)
{
- file_name= hash_element(&ndb_tables, i);
- if (!hash_search(&ok_tables, file_name, strlen(file_name)))
+ file_name= (char*) hash_element(&ndb_tables, i);
+ if (!hash_search(&ok_tables, (byte*) file_name, strlen(file_name)))
{
DBUG_PRINT("info", ("%s must be discovered", file_name));
// File is in list of ndb tables and not in ok_tables
@@ -6210,7 +6210,7 @@
sql_print_error("unpackfrm: ver != 1");
DBUG_RETURN(1);
}
- if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME))))
+ if (!(data= (byte*) my_malloc(max(orglen, complen), MYF(MY_WME))))
{
sql_print_error("unpackfrm: my_malloc(%u)",
(unsigned int)max(orglen, complen));
@@ -6996,25 +6996,7 @@
}
next:
/* Calculate new time to wake up */
- int secs= 0;
- int msecs= ndb_cache_check_time;
-
- struct timeval tick_time;
- gettimeofday(&tick_time, 0);
- abstime.tv_sec= tick_time.tv_sec;
- abstime.tv_nsec= tick_time.tv_usec * 1000;
-
- if (msecs >= 1000){
- secs= msecs / 1000;
- msecs= msecs % 1000;
- }
-
- abstime.tv_sec+= secs;
- abstime.tv_nsec+= msecs * 1000000;
- if (abstime.tv_nsec >= 1000000000) {
- abstime.tv_sec+= 1;
- abstime.tv_nsec-= 1000000000;
- }
+ set_timespec_nsec(abstime, (ulonglong)(ndb_cache_check_time * ULL(1000000)));
}
if (share_list)
--- 1.12/ndb/src/common/util/SocketClient.cpp 2007-02-21 22:04:56 +11:00
+++ 1.13/ndb/src/common/util/SocketClient.cpp 2007-08-09 18:26:06 +10:00
@@ -136,15 +136,24 @@
return NDB_INVALID_SOCKET;
}
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+ flags= 1;
+ ioctlsocket(m_sockfd, FIONBIO, (unsigned long*) &flags);
+#else
flags= fcntl(m_sockfd, F_GETFL, 0);
fcntl(m_sockfd, F_SETFL, flags | O_NONBLOCK);
+#endif
r= ::connect(m_sockfd, (struct sockaddr*) &m_servaddr, sizeof(m_servaddr));
if (r == 0)
goto done; // connected immediately.
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+ if (r < 0 && (errno != WSAEINPROGRESS)) {
+#else
if (r < 0 && (errno != EINPROGRESS)) {
+#endif
NDB_CLOSE_SOCKET(m_sockfd);
m_sockfd= NDB_INVALID_SOCKET;
return NDB_INVALID_SOCKET;
@@ -168,7 +177,7 @@
if (FD_ISSET(m_sockfd, &rset) || FD_ISSET(m_sockfd, &wset))
{
len= sizeof(r);
- if (getsockopt(m_sockfd, SOL_SOCKET, SO_ERROR, &r, &len) < 0 || r)
+ if (getsockopt(m_sockfd, SOL_SOCKET, SO_ERROR, (char *)&r, &len) < 0 || r)
{
// Solaris got an error... different than others
NDB_CLOSE_SOCKET(m_sockfd);
@@ -185,7 +194,12 @@
}
done:
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+ flags= 0;
+ ioctlsocket(m_sockfd, FIONBIO, (unsigned long*) &flags);
+#else
fcntl(m_sockfd, F_SETFL, flags);
+#endif
if (m_auth) {
if (!m_auth->client_authenticate(m_sockfd))
--- 1.12/ndb/src/common/util/basestring_vsnprintf.c 2006-12-24 06:04:14 +11:00
+++ 1.13/ndb/src/common/util/basestring_vsnprintf.c 2007-08-09 18:26:06 +10:00
@@ -19,7 +19,11 @@
#endif
#include <stdio.h>
#include <basestring_vsnprintf.h>
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
+#include <config-win.h>
+#else
#include <my_config.h>
+#endif
#ifdef _WINDOWS
#define SNPRINTF_RETURN_TRUNC
--- 1.10/ndb/src/mgmapi/ndb_logevent.cpp 2006-12-24 06:04:17 +11:00
+++ 1.11/ndb/src/mgmapi/ndb_logevent.cpp 2007-08-09 18:26:09 +10:00
@@ -17,6 +17,10 @@
#include <my_sys.h>
#include <mgmapi.h>
+#ifdef NDB_WIN32
+#include <sys/timeb.h>
+#endif
+
#include <NdbOut.hpp>
#include <Properties.hpp>
#include <socket_io.h>
@@ -386,8 +390,13 @@
Properties p;
char buf[256];
+#ifdef NDB_WIN32
+ struct _timeb start_time;
+ _ftime(&start_time);
+#else
struct timeval start_time;
gettimeofday(&start_time, 0);
+#endif
/* header */
while (1) {
@@ -407,10 +416,17 @@
if ( strcmp("<PING>\n", buf) )
ndbout_c("skipped: %s", buf);
+#ifdef NDB_WIN32
+ struct _timeb now;
+ _ftime(&now);
+ unsigned elapsed_ms= (signed int)(now.time-start_time.time)*1000 +
+ ((signed int)now.millitm-(signed int)start_time.millitm);
+#else
struct timeval now;
gettimeofday(&now, 0);
unsigned elapsed_ms= (now.tv_sec-start_time.tv_sec)*1000 +
((signed int)now.tv_usec-(signed int)start_time.tv_usec)/1000;
+#endif
if (elapsed_ms >= timeout_in_milliseconds)
{
| Thread |
|---|
| • bk commit into 5.0 tree (stewart:1.2473) | Stewart Smith | 13 Aug |