diff options
author | unknown <stewart@mysql.com> | 2004-12-20 11:32:08 +1100 |
---|---|---|
committer | unknown <stewart@mysql.com> | 2004-12-20 11:32:08 +1100 |
commit | 7e5be0fefd7635878baf1788b47e59bdc559de5b (patch) | |
tree | 35ba78815f877a0b2d56fe2bfd518a1cf71830ff /ndb/src | |
parent | 9035f5cf79415335f83336fd623c09db58320618 (diff) | |
parent | 3863b25c7764388f9f584b1f1f1f3c7fc97cb3ae (diff) | |
download | mariadb-git-7e5be0fefd7635878baf1788b47e59bdc559de5b.tar.gz |
Merge 5.0-ndb into local, resolve conflicts
ndb/src/kernel/main.cpp:
Auto merged
ndb/src/kernel/vm/Configuration.hpp:
Auto merged
ndb/src/mgmapi/mgmapi.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
Auto merged
ndb/src/mgmsrv/MgmtSrvr.hpp:
Auto merged
ndb/src/mgmsrv/Services.cpp:
Auto merged
ndb/src/mgmsrv/Services.hpp:
Auto merged
ndb/include/transporter/TransporterRegistry.hpp:
Resolve merge conflict (change of parameter name)
ndb/src/common/transporter/TransporterRegistry.cpp:
Resolve merge conflict (change of parameter name)
Diffstat (limited to 'ndb/src')
118 files changed, 2422 insertions, 789 deletions
diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am index 36a4c3f247f..eb1cf1c6543 100644 --- a/ndb/src/Makefile.am +++ b/ndb/src/Makefile.am @@ -16,3 +16,18 @@ libndbclient_la_LIBADD = \ common/logger/liblogger.la \ common/portlib/libportlib.la \ common/util/libgeneral.la + +windoze-dsp: libndbclient.dsp + +libndbclient.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(ndblib_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ dummy.cpp + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(libndbclient_la_LIBADD) + @touch dummy.cpp diff --git a/ndb/src/common/Makefile.am b/ndb/src/common/Makefile.am index 8733205eca2..0059f3fb210 100644 --- a/ndb/src/common/Makefile.am +++ b/ndb/src/common/Makefile.am @@ -11,3 +11,5 @@ libcommon_la_LIBADD = \ portlib/libportlib.la \ logger/liblogger.la \ util/libgeneral.la + +windoze-dsp: diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp index 59be0affcb4..a9ca2433a33 100644 --- a/ndb/src/common/debugger/EventLogger.cpp +++ b/ndb/src/common/debugger/EventLogger.cpp @@ -1033,7 +1033,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, "Grep::SSCoord:Error code: %d Error message: %s" " (subId=%d,SubKey=%d)", err, - GrepError::getErrorDesc((GrepError::Code)err), + GrepError::getErrorDesc((GrepError::GE_Code)err), subId, subKey); break; @@ -1050,7 +1050,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepSS_SubStartMetaRef: @@ -1066,7 +1066,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepSS_SubStartDataRef: @@ -1081,7 +1081,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepSS_SubSyncMetaRef: @@ -1096,7 +1096,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepSS_SubSyncDataRef: @@ -1113,7 +1113,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subKey, gci, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepSS_SubRemoveRef: @@ -1128,7 +1128,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err) + GrepError::getErrorDesc((GrepError::GE_Code)err) ); break; } @@ -1142,7 +1142,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, "Grep::PSCoord: Error code: %d Error Message: %s" " (subId=%d,SubKey=%d)", err, - GrepError::getErrorDesc((GrepError::Code)err), + GrepError::getErrorDesc((GrepError::GE_Code)err), subId, subKey); break; @@ -1159,7 +1159,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepPS_SubStartMetaRef: @@ -1175,7 +1175,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepPS_SubStartDataRef: @@ -1190,7 +1190,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepPS_SubSyncMetaRef: @@ -1205,7 +1205,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepPS_SubSyncDataRef: @@ -1222,7 +1222,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subKey, gci, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::GrepPS_SubRemoveRef: @@ -1237,7 +1237,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, subId, subKey, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } case GrepEvent::Rep_Disconnect: @@ -1249,7 +1249,7 @@ EventLogger::getText(char * m_text, size_t m_text_len, " Error code: %d Error Message: %s", nodeId, err, - GrepError::getErrorDesc((GrepError::Code)err)); + GrepError::getErrorDesc((GrepError::GE_Code)err)); break; } diff --git a/ndb/src/common/debugger/GrepError.cpp b/ndb/src/common/debugger/GrepError.cpp index ec0c26a5855..20aeaa6dd77 100644 --- a/ndb/src/common/debugger/GrepError.cpp +++ b/ndb/src/common/debugger/GrepError.cpp @@ -21,7 +21,7 @@ */ const GrepError::ErrorDescription GrepError::errorDescriptions[] = { - { GrepError::NO_ERROR, + { GrepError::GE_NO_ERROR, "No error" }, { GrepError::SUBSCRIPTION_ID_NOMEM, "Not enough resources to allocate the subscription" }, @@ -119,7 +119,7 @@ GrepError::noOfErrorDescs = sizeof(GrepError::errorDescriptions) / * gets the corresponding error message to an err code */ const char * -GrepError::getErrorDesc(GrepError::Code err) { +GrepError::getErrorDesc(GrepError::GE_Code err) { for(Uint32 i = 0; i<noOfErrorDescs; i++){ if(err == errorDescriptions[i].errCode){ diff --git a/ndb/src/common/debugger/Makefile.am b/ndb/src/common/debugger/Makefile.am index d0fb30717cd..e25a11c9bee 100644 --- a/ndb/src/common/debugger/Makefile.am +++ b/ndb/src/common/debugger/Makefile.am @@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libtrace.dsp + +libtrace.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libtrace_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/debugger/signaldata/FsCloseReq.cpp b/ndb/src/common/debugger/signaldata/FsCloseReq.cpp index 143250b7db1..df9f3cc9fbc 100644 --- a/ndb/src/common/debugger/signaldata/FsCloseReq.cpp +++ b/ndb/src/common/debugger/signaldata/FsCloseReq.cpp @@ -31,7 +31,7 @@ printFSCLOSEREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv sig->userReference); fprintf(output, " Flags: H\'%.8x, ", sig->fileFlag); - if (sig->getRemoveFileFlag(sig->fileFlag) == true) + if (sig->getRemoveFileFlag(sig->fileFlag)) fprintf(output, "Remove file"); else fprintf(output, "Don't remove file"); diff --git a/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp b/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp index 9b32fab87ba..a9f240d3cb4 100644 --- a/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp +++ b/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp @@ -31,7 +31,7 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData, fprintf(output, " UserReference: H\'%.8x", sig->userReference); fprintf(output, " Operation flag: H\'%.8x (", sig->operationFlag); - if (sig->getSyncFlag(sig->operationFlag) == true) + if (sig->getSyncFlag(sig->operationFlag)) fprintf(output, "Sync,"); else fprintf(output, "No sync,"); diff --git a/ndb/src/common/debugger/signaldata/Makefile.am b/ndb/src/common/debugger/signaldata/Makefile.am index c855c5f8a18..9146d552568 100644 --- a/ndb/src/common/debugger/signaldata/Makefile.am +++ b/ndb/src/common/debugger/signaldata/Makefile.am @@ -32,3 +32,16 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am # Don't update the files from bitkeeper %::SCCS/s.% +windoze-dsp: libsignaldataprint.dsp + +libsignaldataprint.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/debugger/signaldata/ScanTab.cpp b/ndb/src/common/debugger/signaldata/ScanTab.cpp index 247ddbfe8e2..e9c5ba6cc52 100644 --- a/ndb/src/common/debugger/signaldata/ScanTab.cpp +++ b/ndb/src/common/debugger/signaldata/ScanTab.cpp @@ -30,13 +30,14 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv fprintf(output, " apiConnectPtr: H\'%.8x", sig->apiConnectPtr); fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo); - fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u, Keyinfo: %u Holdlock: %u, RangeScan: %u ReadCommitted: %u\n DistributionKeyFlag: %u", + fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u Keyinfo: %u Holdlock: %u RangeScan: %u Descending: %u ReadCommitted: %u\n DistributionKeyFlag: %u", sig->getParallelism(requestInfo), sig->getScanBatch(requestInfo), sig->getLockMode(requestInfo), sig->getKeyinfoFlag(requestInfo), sig->getHoldLockFlag(requestInfo), sig->getRangeScanFlag(requestInfo), + sig->getDescendingFlag(requestInfo), sig->getReadCommittedFlag(requestInfo), sig->getDistributionKeyFlag(requestInfo)); diff --git a/ndb/src/common/logger/FileLogHandler.cpp b/ndb/src/common/logger/FileLogHandler.cpp index 29172ff93ad..98b2848feba 100644 --- a/ndb/src/common/logger/FileLogHandler.cpp +++ b/ndb/src/common/logger/FileLogHandler.cpp @@ -206,9 +206,9 @@ FileLogHandler::setMaxSize(const BaseString &size) { long val = strtol(size.c_str(), &end, 0); /* XXX */ if(size.c_str() == end) return false; - if(strncasecmp("M", end, 1) == 0) + if(end[0] == 'M') val *= 1024*1024; - if(strncasecmp("k", end, 1) == 0) + if(end[0] == 'k') val *= 1024; m_maxFileSize = val; diff --git a/ndb/src/common/logger/LogHandlerList.hpp b/ndb/src/common/logger/LogHandlerList.hpp index 7c001a28a76..21344023560 100644 --- a/ndb/src/common/logger/LogHandlerList.hpp +++ b/ndb/src/common/logger/LogHandlerList.hpp @@ -18,6 +18,7 @@ #define LOGHANDLERLIST_H class LogHandler; +#include <ndb_global.h> /** * Provides a simple linked list of log handlers. diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp index f6f70fbeff7..3b686b24151 100644 --- a/ndb/src/common/logger/Logger.cpp +++ b/ndb/src/common/logger/Logger.cpp @@ -186,13 +186,17 @@ Logger::addHandler(const BaseString &logstring) { LogHandler *handler = NULL; - if(type == "SYSLOG") { +#ifndef NDB_WIN32 + if(type == "SYSLOG") + { handler = new SysLogHandler(); - } else if(type == "FILE") + } else +#endif + if(type == "FILE") handler = new FileLogHandler(); else if(type == "CONSOLE") handler = new ConsoleLogHandler(); - + if(handler == NULL) DBUG_RETURN(false); if(!handler->parseParams(params)) diff --git a/ndb/src/common/logger/Makefile.am b/ndb/src/common/logger/Makefile.am index 0a48214c37c..0af21f9fbde 100644 --- a/ndb/src/common/logger/Makefile.am +++ b/ndb/src/common/logger/Makefile.am @@ -1,11 +1,25 @@ noinst_LTLIBRARIES = liblogger.la -liblogger_la_SOURCES = Logger.cpp LogHandlerList.cpp LogHandler.cpp \ - ConsoleLogHandler.cpp FileLogHandler.cpp SysLogHandler.cpp +SOURCE_WIN = Logger.cpp LogHandlerList.cpp LogHandler.cpp \ + ConsoleLogHandler.cpp FileLogHandler.cpp +liblogger_la_SOURCES = $(SOURCE_WIN) SysLogHandler.cpp include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am # Don't update the files from bitkeeper %::SCCS/s.% +windoze-dsp: liblogger.dsp + +liblogger.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(SOURCE_WIN) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 744412870f5..db00cc1510f 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -141,9 +141,10 @@ ConfigRetriever::getConfig(NdbMgmHandle m_handle){ return conf; } - + ndb_mgm_configuration * ConfigRetriever::getConfig(const char * filename){ +#ifndef NDB_WIN32 struct stat sbuf; const int res = stat(filename, &sbuf); @@ -180,8 +181,10 @@ ConfigRetriever::getConfig(const char * filename){ return 0; } delete [] buf2; - return (ndb_mgm_configuration*)cvf.m_cfg; +#else + return 0; +#endif } void diff --git a/ndb/src/common/mgmcommon/Makefile.am b/ndb/src/common/mgmcommon/Makefile.am index a0aca3e68f1..104bf0b29f2 100644 --- a/ndb/src/common/mgmcommon/Makefile.am +++ b/ndb/src/common/mgmcommon/Makefile.am @@ -12,3 +12,17 @@ include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libmgmsrvcommon.dsp + +libmgmsrvcommon.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libmgmsrvcommon_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/portlib/Makefile.am b/ndb/src/common/portlib/Makefile.am index 73125ad918d..99138a7414e 100644 --- a/ndb/src/common/portlib/Makefile.am +++ b/ndb/src/common/portlib/Makefile.am @@ -17,3 +17,27 @@ PortLibTest_SOURCES = NdbPortLibTest.cpp munmaptest_SOURCES = munmaptest.cpp # Don't update the files from bitkeeper +WIN_src = win32/NdbCondition.c \ + win32/NdbDaemon.c \ + win32/NdbEnv.c \ + win32/NdbHost.c \ + win32/NdbMem.c \ + win32/NdbMutex.c \ + win32/NdbSleep.c \ + win32/NdbTCP.c \ + win32/NdbThread.c \ + win32/NdbTick.c + +windoze-dsp: libportlib.dsp + +libportlib.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(WIN_src) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/portlib/NdbConfig.c b/ndb/src/common/portlib/NdbConfig.c index 8adc4c20dff..b275143646f 100644 --- a/ndb/src/common/portlib/NdbConfig.c +++ b/ndb/src/common/portlib/NdbConfig.c @@ -18,6 +18,7 @@ #include <NdbConfig.h> #include <NdbEnv.h> #include <NdbMem.h> +#include <basestring_vsnprintf.h> static const char *datadir_path= 0; @@ -48,7 +49,7 @@ NdbConfig_AllocHomePath(int _len) const char *path= NdbConfig_get_path(&path_len); int len= _len+path_len; char *buf= NdbMem_Allocate(len); - snprintf(buf, len, "%s%s", path, DIR_SEPARATOR); + basestring_snprintf(buf, len, "%s%s", path, DIR_SEPARATOR); return buf; } @@ -67,7 +68,7 @@ NdbConfig_NdbCfgName(int with_ndb_home){ len= strlen(buf); } else buf= NdbMem_Allocate(128); - snprintf(buf+len, 128, "Ndb.cfg"); + basestring_snprintf(buf+len, 128, "Ndb.cfg"); return buf; } @@ -77,9 +78,9 @@ char *get_prefix_buf(int len, int node_id) char tmp_buf[sizeof("ndb_pid#############")+1]; char *buf; if (node_id > 0) - snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id); + basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id); else - snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid()); + basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid()); tmp_buf[sizeof(tmp_buf)-1]= 0; buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf)); @@ -91,7 +92,7 @@ char* NdbConfig_ErrorFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_error.log"); + basestring_snprintf(buf+len, 128, "_error.log"); return buf; } @@ -99,7 +100,7 @@ char* NdbConfig_ClusterLogFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_cluster.log"); + basestring_snprintf(buf+len, 128, "_cluster.log"); return buf; } @@ -107,7 +108,7 @@ char* NdbConfig_SignalLogFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_signal.log"); + basestring_snprintf(buf+len, 128, "_signal.log"); return buf; } @@ -115,7 +116,7 @@ char* NdbConfig_TraceFileName(int node_id, int file_no){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_trace.log.%u", file_no); + basestring_snprintf(buf+len, 128, "_trace.log.%u", file_no); return buf; } @@ -123,7 +124,7 @@ char* NdbConfig_NextTraceFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_trace.log.next"); + basestring_snprintf(buf+len, 128, "_trace.log.next"); return buf; } @@ -131,7 +132,7 @@ char* NdbConfig_PidFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, ".pid"); + basestring_snprintf(buf+len, 128, ".pid"); return buf; } @@ -139,6 +140,6 @@ char* NdbConfig_StdoutFileName(int node_id){ char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); - snprintf(buf+len, 128, "_out.log"); + basestring_snprintf(buf+len, 128, "_out.log"); return buf; } diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c new file mode 100644 index 00000000000..4046db1d60a --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbCondition.c @@ -0,0 +1,178 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <ndb_global.h> +#include "NdbCondition.h" +#include <NdbMutex.h> + +struct NdbCondition +{ + long nWaiters; + NdbMutex* pNdbMutexWaitersLock; + HANDLE hSemaphore; + HANDLE hEventWaitersDone; + int bWasBroadcast; +}; + + +struct NdbCondition* +NdbCondition_Create(void) +{ + int result = 0; + struct NdbCondition* pNdbCondition = (struct NdbCondition*)malloc(sizeof(struct NdbCondition)); + if(!pNdbCondition) + return 0; + + pNdbCondition->nWaiters = 0; + pNdbCondition->bWasBroadcast = 0; + if(!(pNdbCondition->hSemaphore = CreateSemaphore(0, 0, MAXLONG, 0))) + result = -1; + else if(!(pNdbCondition->pNdbMutexWaitersLock = NdbMutex_Create())) + result = -1; + else if(!(pNdbCondition->hEventWaitersDone = CreateEvent(0, 0, 0, 0))) + result = -1; + + assert(!result); + return pNdbCondition; +} + + +int +NdbCondition_Wait(struct NdbCondition* p_cond, + NdbMutex* p_mutex) +{ + int result; + int bLastWaiter; + if(!p_cond || !p_mutex) + return 1; + + 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); + return result; +} + + +int +NdbCondition_WaitTimeout(struct NdbCondition* p_cond, + NdbMutex* p_mutex, + int msecs) +{ + int result; + int bLastWaiter; + if (!p_cond || !p_mutex) + return 1; + + 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); + return result; +} + + +int +NdbCondition_Signal(struct NdbCondition* p_cond) +{ + int bHaveWaiters; + if(!p_cond) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + bHaveWaiters = (p_cond->nWaiters > 0); + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + + if(bHaveWaiters) + return (ReleaseSemaphore(p_cond->hSemaphore, 1, 0) ? 0 : -1); + else + return 0; +} + + +int NdbCondition_Broadcast(struct NdbCondition* p_cond) +{ + int bHaveWaiters; + int result = 0; + if(!p_cond) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + bHaveWaiters = 0; + if(p_cond->nWaiters > 0) + { + p_cond->bWasBroadcast = !0; + bHaveWaiters = 1; + } + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + if(bHaveWaiters) + { + 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; + } + return result; +} + + +int NdbCondition_Destroy(struct NdbCondition* p_cond) +{ + int result; + if(!p_cond) + return 1; + + CloseHandle(p_cond->hEventWaitersDone); + NdbMutex_Destroy(p_cond->pNdbMutexWaitersLock); + result = (CloseHandle(p_cond->hSemaphore) ? 0 : -1); + + free(p_cond); + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbDaemon.c b/ndb/src/common/portlib/win32/NdbDaemon.c new file mode 100644 index 00000000000..b96d4c20260 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbDaemon.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "NdbDaemon.h" + +#define NdbDaemon_ErrorSize 500 +long NdbDaemon_DaemonPid; +int NdbDaemon_ErrorCode; +char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; + +int +NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) +{ + // XXX do something + return 0; +} + +#ifdef NDB_DAEMON_TEST + +int +main() +{ + if (NdbDaemon_Make("test.pid", "test.log", 0) == -1) { + fprintf(stderr, "NdbDaemon_Make: %s\n", NdbDaemon_ErrorText); + return 1; + } + sleep(10); + return 0; +} + +#endif diff --git a/ndb/src/common/portlib/win32/NdbEnv.c b/ndb/src/common/portlib/win32/NdbEnv.c new file mode 100644 index 00000000000..f42e685fe15 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbEnv.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbEnv.h" + +const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) +{ + char* p = NULL; + p = getenv(name); + + if (p != NULL && buf != NULL){ + strncpy(buf, p, buflen); + buf[buflen-1] = 0; + } + return p; +} + diff --git a/ndb/src/common/portlib/win32/NdbHost.c b/ndb/src/common/portlib/win32/NdbHost.c new file mode 100644 index 00000000000..7df96c45991 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbHost.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <ndb_global.h> +#include "NdbHost.h" + + +int NdbHost_GetHostName(char* buf) +{ + /* 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; + } + return 0; +} + + +int NdbHost_GetProcessId(void) +{ + return _getpid(); +} + diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c new file mode 100644 index 00000000000..313ca9dff66 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbMem.c @@ -0,0 +1,283 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbMem.h" + +#if 0 +struct AWEINFO +{ + SIZE_T dwSizeInBytesRequested; + ULONG_PTR nNumberOfPagesRequested; + ULONG_PTR nNumberOfPagesActual; + ULONG_PTR nNumberOfPagesFreed; + ULONG_PTR* pnPhysicalMemoryPageArray; + void* pRegionReserved; +}; + +const size_t cNdbMem_nMaxAWEinfo = 256; +size_t gNdbMem_nAWEinfo = 0; + +struct AWEINFO* gNdbMem_pAWEinfo = 0; + + +void ShowLastError(const char* szContext, const char* szFunction) +{ + DWORD dwError = GetLastError(); + LPVOID lpMsgBuf; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dwError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR)&lpMsgBuf, + 0, + NULL + ); + printf("%s : %s failed : %lu : %s\n", szContext, szFunction, dwError, (char*)lpMsgBuf); + LocalFree(lpMsgBuf); +} + + + +void NdbMem_Create() +{ + // Address Windowing Extensions + struct PRIVINFO + { + DWORD Count; + LUID_AND_ATTRIBUTES Privilege[1]; + } Info; + + HANDLE hProcess = GetCurrentProcess(); + HANDLE hToken; + if(!OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken)) + { + ShowLastError("NdbMem_Create", "OpenProcessToken"); + } + + Info.Count = 1; + Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; + if(!LookupPrivilegeValue(0, SE_LOCK_MEMORY_NAME, &(Info.Privilege[0].Luid))) + { + ShowLastError("NdbMem_Create", "LookupPrivilegeValue"); + } + + if(!AdjustTokenPrivileges(hToken, FALSE, (PTOKEN_PRIVILEGES)&Info, 0, 0, 0)) + { + ShowLastError("NdbMem_Create", "AdjustTokenPrivileges"); + } + + if(!CloseHandle(hToken)) + { + ShowLastError("NdbMem_Create", "CloseHandle"); + } + + return; +} + +void NdbMem_Destroy() +{ + /* Do nothing */ + return; +} + +void* NdbMem_Allocate(size_t size) +{ + // Address Windowing Extensions + struct AWEINFO* pAWEinfo; + HANDLE hProcess; + SYSTEM_INFO sysinfo; + + if(!gNdbMem_pAWEinfo) + { + gNdbMem_pAWEinfo = VirtualAlloc(0, + sizeof(struct AWEINFO)*cNdbMem_nMaxAWEinfo, + MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + } + + assert(gNdbMem_nAWEinfo < cNdbMem_nMaxAWEinfo); + pAWEinfo = gNdbMem_pAWEinfo+gNdbMem_nAWEinfo++; + + hProcess = GetCurrentProcess(); + GetSystemInfo(&sysinfo); + pAWEinfo->nNumberOfPagesRequested = (size+sysinfo.dwPageSize-1)/sysinfo.dwPageSize; + pAWEinfo->pnPhysicalMemoryPageArray = VirtualAlloc(0, + sizeof(ULONG_PTR)*pAWEinfo->nNumberOfPagesRequested, + MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + pAWEinfo->nNumberOfPagesActual = pAWEinfo->nNumberOfPagesRequested; + if(!AllocateUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesActual), pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Allocate", "AllocateUserPhysicalPages"); + return 0; + } + if(pAWEinfo->nNumberOfPagesRequested != pAWEinfo->nNumberOfPagesActual) + { + ShowLastError("NdbMem_Allocate", "nNumberOfPagesRequested != nNumberOfPagesActual"); + return 0; + } + + pAWEinfo->dwSizeInBytesRequested = size; + pAWEinfo->pRegionReserved = VirtualAlloc(0, pAWEinfo->dwSizeInBytesRequested, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE); + if(!pAWEinfo->pRegionReserved) + { + ShowLastError("NdbMem_Allocate", "VirtualAlloc"); + return 0; + } + + if(!MapUserPhysicalPages(pAWEinfo->pRegionReserved, pAWEinfo->nNumberOfPagesActual, pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Allocate", "MapUserPhysicalPages"); + return 0; + } + + /* + printf("allocate AWE memory: %lu bytes, %lu pages, address %lx\n", + pAWEinfo->dwSizeInBytesRequested, + pAWEinfo->nNumberOfPagesActual, + pAWEinfo->pRegionReserved); + */ + return pAWEinfo->pRegionReserved; +} + + +void* NdbMem_AllocateAlign(size_t size, size_t alignment) +{ + /* + return (void*)memalign(alignment, size); + TEMP fix + */ + return NdbMem_Allocate(size); +} + + +void NdbMem_Free(void* ptr) +{ + // VirtualFree(ptr, 0, MEM_DECOMMIT|MEM_RELEASE); + + // Address Windowing Extensions + struct AWEINFO* pAWEinfo = 0; + size_t i; + HANDLE hProcess; + + for(i=0; i<gNdbMem_nAWEinfo; ++i) + { + if(ptr==gNdbMem_pAWEinfo[i].pRegionReserved) + { + pAWEinfo = gNdbMem_pAWEinfo+i; + } + } + if(!pAWEinfo) + { + ShowLastError("NdbMem_Free", "ptr is not AWE memory"); + } + + hProcess = GetCurrentProcess(); + if(!MapUserPhysicalPages(ptr, pAWEinfo->nNumberOfPagesActual, 0)) + { + ShowLastError("NdbMem_Free", "MapUserPhysicalPages"); + } + + if(!VirtualFree(ptr, 0, MEM_RELEASE)) + { + ShowLastError("NdbMem_Free", "VirtualFree"); + } + + pAWEinfo->nNumberOfPagesFreed = pAWEinfo->nNumberOfPagesActual; + if(!FreeUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesFreed), pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Free", "FreeUserPhysicalPages"); + } + + VirtualFree(pAWEinfo->pnPhysicalMemoryPageArray, 0, MEM_DECOMMIT|MEM_RELEASE); +} + + +int NdbMem_MemLockAll() +{ + /* + HANDLE hProcess = GetCurrentProcess(); + SIZE_T nMinimumWorkingSetSize; + SIZE_T nMaximumWorkingSetSize; + GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); + ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; + + SetProcessWorkingSetSize(hProcess, 50000000, 100000000); + + GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); + ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; + */ + return -1; +} + +int NdbMem_MemUnlockAll() +{ + //VirtualUnlock(); + return -1; +} + +#endif + +void NdbMem_Create() +{ + /* Do nothing */ + return; +} + +void NdbMem_Destroy() +{ + /* Do nothing */ + return; +} + + +void* NdbMem_Allocate(size_t size) +{ + void* mem_allocated; + assert(size > 0); + mem_allocated= (void*)malloc(size); + return mem_allocated; +} + +void* NdbMem_AllocateAlign(size_t size, size_t alignment) +{ + (void)alignment; /* remove warning for unused parameter */ + /* + return (void*)memalign(alignment, size); + TEMP fix + */ + return (void*)malloc(size); +} + + +void NdbMem_Free(void* ptr) +{ + free(ptr); +} + + +int NdbMem_MemLockAll() +{ + return 0; +} + +int NdbMem_MemUnlockAll() +{ + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c new file mode 100644 index 00000000000..e6d1f081e9a --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbMutex.c @@ -0,0 +1,73 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <ndb_global.h> +#include "NdbMutex.h" + +NdbMutex* NdbMutex_Create(void) +{ + NdbMutex* pNdbMutex = (NdbMutex*)malloc(sizeof(NdbMutex)); + if(!pNdbMutex) + return 0; + + InitializeCriticalSection(pNdbMutex); + return pNdbMutex; +} + + +int NdbMutex_Destroy(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + DeleteCriticalSection(p_mutex); + free(p_mutex); + return 0; +} + + +int NdbMutex_Lock(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + EnterCriticalSection (p_mutex); + return 0; +} + + +int NdbMutex_Unlock(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + LeaveCriticalSection(p_mutex); + return 0; +} + + +int NdbMutex_Trylock(NdbMutex* p_mutex) +{ + int result = -1; + if(p_mutex) + { + result = NdbMutex_Lock(p_mutex); + //(TryEnterCriticalSection(p_mutex) ? 0 : -1); + } + return result; +} + diff --git a/ndb/src/common/portlib/win32/NdbSleep.c b/ndb/src/common/portlib/win32/NdbSleep.c new file mode 100644 index 00000000000..8f5bdc49acd --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbSleep.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbSleep.h" + +int +NdbSleep_MilliSleep(int milliseconds) +{ + Sleep(milliseconds); + return 0; +} + +int +NdbSleep_SecSleep(int seconds) +{ + return NdbSleep_MilliSleep(seconds*1000); +} + diff --git a/ndb/src/common/portlib/win32/NdbTCP.c b/ndb/src/common/portlib/win32/NdbTCP.c new file mode 100644 index 00000000000..b936cd2db6c --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbTCP.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbTCP.h" + +int +Ndb_getInAddr(struct in_addr * dst, const char *address) +{ + struct hostent * hostPtr; + + /* Try it as aaa.bbb.ccc.ddd. */ + dst->s_addr = inet_addr(address); + if (dst->s_addr != -1) { + return 0; + } + + hostPtr = gethostbyname(address); + if (hostPtr != NULL) { + dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; + return 0; + } + + return -1; +} + diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c new file mode 100644 index 00000000000..98db0d5c287 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbThread.c @@ -0,0 +1,114 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbThread.h" +#include <process.h> + +#define MAX_THREAD_NAME 16 + +typedef unsigned (WINAPI* NDB_WIN32_THREAD_FUNC)(void*); + + +struct NdbThread +{ + HANDLE hThread; + unsigned nThreadId; + char thread_name[MAX_THREAD_NAME]; +}; + + +struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, + NDB_THREAD_ARG *p_thread_arg, + const NDB_THREAD_STACKSIZE thread_stack_size, + const char* p_thread_name, + NDB_THREAD_PRIO thread_prio) +{ + struct NdbThread* tmpThread; + unsigned initflag; + int nPriority = 0; + + if(!p_thread_func) + return 0; + + tmpThread = (struct NdbThread*)malloc(sizeof(struct NdbThread)); + if(!tmpThread) + return 0; + + strncpy((char*)&tmpThread->thread_name, p_thread_name, MAX_THREAD_NAME); + + 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_WIN32_THREAD_FUNC)p_thread_func, p_thread_arg, + initflag, &tmpThread->nThreadId); + + if(nPriority && tmpThread->hThread) + { + SetThreadPriority(tmpThread->hThread, nPriority); + ResumeThread (tmpThread->hThread); + } + + assert(tmpThread->hThread); + return tmpThread; +} + + +void NdbThread_Destroy(struct NdbThread** p_thread) +{ + CloseHandle((*p_thread)->hThread); + (*p_thread)->hThread = 0; + free(*p_thread); + *p_thread = 0; +} + + +int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) +{ + 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; +} + + +void NdbThread_Exit(int status) +{ + _endthreadex((DWORD) status); +} + + +int NdbThread_SetConcurrencyLevel(int level) +{ + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbTick.c b/ndb/src/common/portlib/win32/NdbTick.c new file mode 100644 index 00000000000..4430cbf419b --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbTick.c @@ -0,0 +1,64 @@ +/* Copyright (C) 2003 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> +#include "NdbTick.h" +//#include <windows.h> + +/* +#define FILETIME_PER_MICROSEC 10 +#define FILETIME_PER_MILLISEC 10000 +#define FILETIME_PER_SEC 10000000 + + +NDB_TICKS NdbTick_CurrentMillisecond(void) +{ + ULONGLONG ullTime; + GetSystemTimeAsFileTime((LPFILETIME)&ullTime); + return (ullTime / FILETIME_PER_MILLISEC); +} + +int +NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros) +{ + ULONGLONG ullTime; + GetSystemTimeAsFileTime((LPFILETIME)&ullTime); + *secs = (ullTime / FILETIME_PER_SEC); + *micros = (Uint32)((ullTime % FILETIME_PER_SEC) / FILETIME_PER_MICROSEC); + return 0; +} +*/ + + +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; +} diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am index 9d91a210d46..d76b1b6048b 100644 --- a/ndb/src/common/transporter/Makefile.am +++ b/ndb/src/common/transporter/Makefile.am @@ -20,3 +20,17 @@ include $(top_srcdir)/ndb/config/type_util.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libtransporter.dsp + +libtransporter.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libtransporter_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp index e68bc86718e..ee25d97feef 100644 --- a/ndb/src/common/transporter/Transporter.cpp +++ b/ndb/src/common/transporter/Transporter.cpp @@ -95,7 +95,7 @@ Transporter::connect_client() { return true; NDB_SOCKET_TYPE sockfd = m_socket_client->connect(); - if (sockfd < 0) + if (sockfd == NDB_INVALID_SOCKET) return false; // send info about own id diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index 37e443cc233..7f8f9d258be 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -1181,25 +1181,25 @@ TransporterRegistry::stop_clients() void TransporterRegistry::add_transporter_interface(NodeId remoteNodeId, - const char *interface, + const char *interf, unsigned short port) { DBUG_ENTER("TransporterRegistry::add_transporter_interface"); - DBUG_PRINT("enter",("interface=%s, port= %d", interface, port)); - if (interface && strlen(interface) == 0) - interface= 0; + DBUG_PRINT("enter",("interface=%s, port= %d", interf, port)); + if (interf && strlen(interf) == 0) + interf= 0; for (unsigned i= 0; i < m_transporter_interface.size(); i++) { Transporter_interface &tmp= m_transporter_interface[i]; if (port != tmp.m_service_port) continue; - if (interface != 0 && tmp.m_interface != 0 && - strcmp(interface, tmp.m_interface) == 0) + if (interf != 0 && tmp.m_interface != 0 && + strcmp(interf, tmp.m_interface) == 0) { DBUG_VOID_RETURN; // found match, no need to insert } - if (interface == 0 && tmp.m_interface == 0) + if (interf == 0 && tmp.m_interface == 0) { DBUG_VOID_RETURN; // found match, no need to insert } @@ -1207,7 +1207,7 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId, Transporter_interface t; t.m_remote_nodeId= remoteNodeId; t.m_service_port= port; - t.m_interface= interface; + t.m_interface= interf; m_transporter_interface.push_back(t); DBUG_PRINT("exit",("interface and port added")); DBUG_VOID_RETURN; @@ -1216,7 +1216,7 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId, bool TransporterRegistry::start_service(SocketServer& socket_server) { - if (m_transporter_interface.size() > 0 && nodeIdSpecified != true) + if (m_transporter_interface.size() > 0 && !nodeIdSpecified) { ndbout_c("TransporterRegistry::startReceiving: localNodeId not specified"); return false; diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index f3faa8c4f7f..937b8c0fa59 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -19,6 +19,7 @@ #include <File.hpp> #include <NdbOut.hpp> +#include <my_dir.h> // // PUBLIC @@ -28,9 +29,12 @@ bool File_class::exists(const char* aFileName) { bool rc = true; - +#ifdef USE_MY_STAT_STRUCT + struct my_stat stmp; +#else struct stat stmp; - if (::stat(aFileName, &stmp) != 0) +#endif + if (my_stat(aFileName, &stmp, MYF(0)) != 0) { rc = false; } diff --git a/ndb/src/common/util/Makefile.am b/ndb/src/common/util/Makefile.am index 1f62ca0d9d5..2719d14ee92 100644 --- a/ndb/src/common/util/Makefile.am +++ b/ndb/src/common/util/Makefile.am @@ -33,3 +33,17 @@ include $(top_srcdir)/ndb/config/type_util.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libgeneral.dsp + +libgeneral.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libgeneral_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp index 4443fd45bba..0edcda0e726 100644 --- a/ndb/src/common/util/Properties.cpp +++ b/ndb/src/common/util/Properties.cpp @@ -881,7 +881,7 @@ PropertiesImpl::unpack(const Uint32 * buf, Uint32 &bufLen, Properties * top, case PropertiesType_Properties: assert(0); } - if(res3 != true){ + if(!res3){ return false; } _items--; diff --git a/ndb/src/common/util/SocketClient.cpp b/ndb/src/common/util/SocketClient.cpp index 50e60956b94..38df1417eb8 100644 --- a/ndb/src/common/util/SocketClient.cpp +++ b/ndb/src/common/util/SocketClient.cpp @@ -26,14 +26,14 @@ SocketClient::SocketClient(const char *server_name, unsigned short port, SocketA m_auth= sa; m_port= port; m_server_name= strdup(server_name); - m_sockfd= -1; + m_sockfd= NDB_INVALID_SOCKET; } SocketClient::~SocketClient() { if (m_server_name) free(m_server_name); - if (m_sockfd >= 0) + if (m_sockfd != NDB_INVALID_SOCKET) NDB_CLOSE_SOCKET(m_sockfd); if (m_auth) delete m_auth; @@ -42,7 +42,7 @@ SocketClient::~SocketClient() bool SocketClient::init() { - if (m_sockfd >= 0) + if (m_sockfd != NDB_INVALID_SOCKET) NDB_CLOSE_SOCKET(m_sockfd); memset(&m_servaddr, 0, sizeof(m_servaddr)); @@ -63,32 +63,32 @@ SocketClient::init() NDB_SOCKET_TYPE SocketClient::connect() { - if (m_sockfd < 0) + if (m_sockfd == NDB_INVALID_SOCKET) { if (!init()) { #ifdef VM_TRACE ndbout << "SocketClient::connect() failed " << m_server_name << " " << m_port << endl; #endif - return -1; + return NDB_INVALID_SOCKET; } } const int r = ::connect(m_sockfd, (struct sockaddr*) &m_servaddr, sizeof(m_servaddr)); if (r == -1) { NDB_CLOSE_SOCKET(m_sockfd); - m_sockfd= -1; - return -1; + m_sockfd= NDB_INVALID_SOCKET; + return NDB_INVALID_SOCKET; } if (m_auth) { if (!m_auth->client_authenticate(m_sockfd)) { NDB_CLOSE_SOCKET(m_sockfd); - m_sockfd= -1; - return -1; + m_sockfd= NDB_INVALID_SOCKET; + return NDB_INVALID_SOCKET; } } NDB_SOCKET_TYPE sockfd= m_sockfd; - m_sockfd= -1; + m_sockfd= NDB_INVALID_SOCKET; return sockfd; } diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c index 8a58ca0fe5c..58203e33bd1 100644 --- a/ndb/src/common/util/basestring_vsnprintf.c +++ b/ndb/src/common/util/basestring_vsnprintf.c @@ -20,10 +20,12 @@ #include <basestring_vsnprintf.h> #include <my_config.h> +#ifdef _WINDOWS +#define SNPRINTF_RETURN_TRUNC +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif -/* - #define SNPRINTF_RETURN_TRUNC -*/ int basestring_snprintf(char *str, size_t size, const char *format, ...) { @@ -35,16 +37,6 @@ basestring_snprintf(char *str, size_t size, const char *format, ...) return(ret); } -#ifdef HAVE_SNPRINTF - #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d) -#else - #define SNPRINTF_RETURN_TRUNC - /* #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) my_vsnprintf(a,b,c,d) - * we would like to use my_vsnprintf but it does not have enough features - * Let's hope vsnprintf works anyways - */ - #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d) -#endif #ifdef SNPRINTF_RETURN_TRUNC static char basestring_vsnprintf_buf[16*1024]; #endif @@ -54,22 +46,22 @@ basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap) if (size == 0) { #ifdef SNPRINTF_RETURN_TRUNC - return BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, - sizeof(basestring_vsnprintf_buf), - format, ap); + return vsnprintf(basestring_vsnprintf_buf, + sizeof(basestring_vsnprintf_buf), + format, ap); #else char buf[1]; - return BASESTRING_VSNPRINTF_FUNC(buf, 1, format, ap); + return vsnprintf(buf, 1, format, ap); #endif } { - int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap); + int ret= vsnprintf(str, size, format, ap); #ifdef SNPRINTF_RETURN_TRUNC if (ret == size-1 || ret == -1) { - ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, - sizeof(basestring_vsnprintf_buf), - format, ap); + ret= vsnprintf(basestring_vsnprintf_buf, + sizeof(basestring_vsnprintf_buf), + format, ap); } #endif return ret; diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index 7a537297861..2a274be0662 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -17,6 +17,7 @@ #include <ndb_global.h> #include <ndb_version.h> #include <version.h> +#include <basestring_vsnprintf.h> Uint32 getMajor(Uint32 version) { return (version >> 16) & 0xFF; @@ -38,14 +39,14 @@ Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build) { const char * getVersionString(Uint32 version, const char * status) { char buff[100]; if (status && status[0] != 0) - snprintf(buff, sizeof(buff), + basestring_snprintf(buff, sizeof(buff), "Version %d.%d.%d (%s)", getMajor(version), getMinor(version), getBuild(version), status); else - snprintf(buff, sizeof(buff), + basestring_snprintf(buff, sizeof(buff), "Version %d.%d.%d", getMajor(version), getMinor(version), diff --git a/ndb/src/cw/Makefile.am b/ndb/src/cw/Makefile.am index b530922a3a7..7348fc9eab6 100644 --- a/ndb/src/cw/Makefile.am +++ b/ndb/src/cw/Makefile.am @@ -1 +1,4 @@ SUBDIRS = cpcd + +windoze-dsp: + diff --git a/ndb/src/cw/cpcd/Makefile.am b/ndb/src/cw/cpcd/Makefile.am index 6af44a359fc..75f557b2af7 100644 --- a/ndb/src/cw/cpcd/Makefile.am +++ b/ndb/src/cw/cpcd/Makefile.am @@ -16,3 +16,5 @@ ndb_cpcd_LDFLAGS = @ndb_bin_am_ldflags@ # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: diff --git a/ndb/src/kernel/Makefile.am b/ndb/src/kernel/Makefile.am index 493ab4f9982..55d3c5a578f 100644 --- a/ndb/src/kernel/Makefile.am +++ b/ndb/src/kernel/Makefile.am @@ -59,3 +59,17 @@ LDADD += \ # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: ndbd.dsp + +ndbd.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-prg.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-prg.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(ndbbin_PROGRAMS) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(ndbd_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) diff --git a/ndb/src/kernel/blocks/Makefile.am b/ndb/src/kernel/blocks/Makefile.am index 0b2bc3b8c88..7ee90e6239f 100644 --- a/ndb/src/kernel/blocks/Makefile.am +++ b/ndb/src/kernel/blocks/Makefile.am @@ -15,3 +15,5 @@ SUBDIRS = \ suma \ grep \ dbtux + +windoze-dsp: diff --git a/ndb/src/kernel/blocks/backup/Makefile.am b/ndb/src/kernel/blocks/backup/Makefile.am index e669febdc0d..c8f44f31292 100644 --- a/ndb/src/kernel/blocks/backup/Makefile.am +++ b/ndb/src/kernel/blocks/backup/Makefile.am @@ -8,3 +8,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libbackup.dsp + +libbackup.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libbackup_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index 234d832655c..c4127ba9283 100644 --- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -150,6 +150,7 @@ void Cmvmi::execNDB_TAMPER(Signal* signal) ndbrequire(false); } +#ifndef NDB_WIN32 if(ERROR_INSERTED(9996)){ simulate_error_during_shutdown= SIGSEGV; ndbrequire(false); @@ -159,6 +160,7 @@ void Cmvmi::execNDB_TAMPER(Signal* signal) simulate_error_during_shutdown= SIGSEGV; kill(getpid(), SIGABRT); } +#endif }//execNDB_TAMPER() void Cmvmi::execSET_LOGLEVELORD(Signal* signal) diff --git a/ndb/src/kernel/blocks/cmvmi/Makefile.am b/ndb/src/kernel/blocks/cmvmi/Makefile.am index fdd43932682..dc2e12746fd 100644 --- a/ndb/src/kernel/blocks/cmvmi/Makefile.am +++ b/ndb/src/kernel/blocks/cmvmi/Makefile.am @@ -8,3 +8,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libcmvmi.dsp + +libcmvmi.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libcmvmi_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp index eaf2176b390..0db74a0b709 100644 --- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp @@ -1088,7 +1088,7 @@ void Dbacc::execACCFRAGREQ(Signal* signal) // config mismatch - do not crash if release compiled if (tabptr.i >= ctablesize) { jam(); - addFragRefuse(signal, 800); + addFragRefuse(signal, 640); return; } #endif @@ -1837,7 +1837,7 @@ Dbacc::xfrmKeyData(Signal* signal) tabptr.i = fragrecptr.p->myTableId; ptrCheckGuard(tabptr, ctablesize, tabrec); - Uint32 dst[1024]; + Uint32 dst[1024 * MAX_XFRM_MULTIPLY]; Uint32 dstSize = (sizeof(dst) >> 2); Uint32* src = &signal->theData[7]; const Uint32 noOfKeyAttr = tabptr.p->noOfKeyAttr; diff --git a/ndb/src/kernel/blocks/dbacc/Makefile.am b/ndb/src/kernel/blocks/dbacc/Makefile.am index eeca061dead..ca1b1efac37 100644 --- a/ndb/src/kernel/blocks/dbacc/Makefile.am +++ b/ndb/src/kernel/blocks/dbacc/Makefile.am @@ -10,3 +10,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbacc.dsp + +libdbacc.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbacc_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 88920d54351..458d567ccf8 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -527,7 +527,7 @@ Dbdict::writeTableFile(Signal* signal, Uint32 tableId, Uint32 sz = tabInfoPtr.sz + ZPAGE_HEADER_SIZE; c_writeTableRecord.noOfPages = DIV(sz, ZSIZE_OF_PAGES_IN_WORDS); - c_writeTableRecord.tableWriteState = WriteTableRecord::CALLBACK; + c_writeTableRecord.tableWriteState = WriteTableRecord::TWR_CALLBACK; c_writeTableRecord.m_callback = * callback; c_writeTableRecord.pageId = 0; @@ -646,7 +646,7 @@ void Dbdict::closeWriteTableConf(Signal* signal, case WriteTableRecord::WRITE_RESTART_FROM_OWN : ndbrequire(false); break; - case WriteTableRecord::CALLBACK: + case WriteTableRecord::TWR_CALLBACK: jam(); execute(signal, c_writeTableRecord.m_callback, 0); return; @@ -2380,7 +2380,7 @@ Dbdict::restartCreateTab_readTableConf(Signal* signal, ndbrequire(c_writeTableRecord.tableWriteState == WriteTableRecord::IDLE); c_writeTableRecord.noOfPages = c_readTableRecord.noOfPages; c_writeTableRecord.pageId = c_readTableRecord.pageId; - c_writeTableRecord.tableWriteState = WriteTableRecord::CALLBACK; + c_writeTableRecord.tableWriteState = WriteTableRecord::TWR_CALLBACK; c_writeTableRecord.m_callback.m_callbackData = callbackData; c_writeTableRecord.m_callback.m_callbackFunction = safe_cast(&Dbdict::restartCreateTab_writeTableConf); @@ -4098,7 +4098,7 @@ Dbdict::execADD_FRAGREQ(Signal* signal) { req->lh3DistrBits = 0; //lhDistrBits; req->lh3PageBits = 0; //lhPageBits; req->noOfAttributes = tabPtr.p->noOfAttributes; - req->noOfNullAttributes = tabPtr.p->noOfNullAttr; + req->noOfNullAttributes = tabPtr.p->noOfNullBits; req->noOfPagesToPreAllocate = 0; req->schemaVersion = tabPtr.p->tableVersion; Uint32 keyLen = tabPtr.p->tupKeyLength; @@ -4739,6 +4739,7 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, Uint32 keyLength = 0; Uint32 attrCount = tablePtr.p->noOfAttributes; Uint32 nullCount = 0; + Uint32 nullBits = 0; Uint32 noOfCharsets = 0; Uint16 charsets[128]; Uint32 recordLength = 0; @@ -4867,9 +4868,9 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, else { sz = 0; - nullCount += attrDesc.AttributeArraySize; + nullBits += attrDesc.AttributeArraySize; } - + recordLength += sz; if(attrDesc.AttributeKeyFlag){ keyLength += sz; @@ -4897,6 +4898,7 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, tablePtr.p->noOfNullAttr = nullCount; tablePtr.p->noOfCharsets = noOfCharsets; tablePtr.p->tupKeyLength = keyLength; + tablePtr.p->noOfNullBits = nullCount + nullBits; tabRequire(recordLength<= MAX_TUPLE_SIZE_IN_WORDS, CreateTableRef::RecordTooBig); diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp index af80bcf5f94..622da5d45fd 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp @@ -213,7 +213,9 @@ public: IL_CREATED_TC = 1 << 0 // created in TC }; Uint32 indexLocal; - + + Uint32 noOfNullBits; + inline bool equal(TableRecord & rec) const { return strcmp(tableName, rec.tableName) == 0; } @@ -639,7 +641,7 @@ private: WRITE_ADD_TABLE_SLAVE = 2, WRITE_RESTART_FROM_MASTER = 3, WRITE_RESTART_FROM_OWN = 4, - CALLBACK = 5 + TWR_CALLBACK = 5 }; TableWriteState tableWriteState; Callback m_callback; diff --git a/ndb/src/kernel/blocks/dbdict/Makefile.am b/ndb/src/kernel/blocks/dbdict/Makefile.am index dc4c4fe4734..9a0d68f8148 100644 --- a/ndb/src/kernel/blocks/dbdict/Makefile.am +++ b/ndb/src/kernel/blocks/dbdict/Makefile.am @@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbdict.dsp + +libdbdict.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbdict_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbdih/Dbdih.hpp b/ndb/src/kernel/blocks/dbdih/Dbdih.hpp index 0a2d50cb876..ee67bf47d7b 100644 --- a/ndb/src/kernel/blocks/dbdih/Dbdih.hpp +++ b/ndb/src/kernel/blocks/dbdih/Dbdih.hpp @@ -1468,7 +1468,7 @@ private: Uint32 c_blockCommitNo; bool getBlockCommit() const { - return c_blockCommit == true || cgckptflag == true; + return c_blockCommit || cgckptflag; } /** diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index c84908848f2..de08449730f 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -12941,7 +12941,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) Uint32 nodeOrder[MAX_REPLICAS]; const Uint32 noOfReplicas = extractNodeInfo(fragPtr.p, nodeOrder); char buf[100]; - snprintf(buf, sizeof(buf), " Table %d Fragment %d - ", tabPtr.i, j); + BaseString::snprintf(buf, sizeof(buf), " Table %d Fragment %d - ", tabPtr.i, j); for(Uint32 k = 0; k < noOfReplicas; k++){ char tmp[100]; BaseString::snprintf(tmp, sizeof(tmp), "%d ", nodeOrder[k]); @@ -13152,7 +13152,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) getFragstore(tabPtr.p, fid, fragPtr); char buf[100], buf2[100]; - snprintf(buf, sizeof(buf), " Fragment %d: noLcpReplicas==%d ", + BaseString::snprintf(buf, sizeof(buf), " Fragment %d: noLcpReplicas==%d ", fid, fragPtr.p->noLcpReplicas); Uint32 num=0; diff --git a/ndb/src/kernel/blocks/dbdih/Makefile.am b/ndb/src/kernel/blocks/dbdih/Makefile.am index 2ee8017ec13..d6ad380b806 100644 --- a/ndb/src/kernel/blocks/dbdih/Makefile.am +++ b/ndb/src/kernel/blocks/dbdih/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbdih.dsp + +libdbdih.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbdih_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp index c233f25f6a3..e7debe1f978 100644 --- a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp +++ b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp @@ -572,6 +572,7 @@ public: Uint8 scanLockMode; Uint8 readCommitted; Uint8 rangeScan; + Uint8 descending; Uint8 scanTcWaiting; Uint8 scanKeyinfoFlag; Uint8 m_last_row; diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 9df7bda0e60..11075438fb1 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -7637,6 +7637,7 @@ void Dblqh::continueAfterReceivingAllAiLab(Signal* signal) req->requestInfo = 0; AccScanReq::setLockMode(req->requestInfo, scanptr.p->scanLockMode); AccScanReq::setReadCommittedFlag(req->requestInfo, scanptr.p->readCommitted); + AccScanReq::setDescendingFlag(req->requestInfo, scanptr.p->descending); req->transId1 = tcConnectptr.p->transid[0]; req->transId2 = tcConnectptr.p->transid[1]; req->savePointId = tcConnectptr.p->savePointId; @@ -8628,6 +8629,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) const Uint32 keyinfo = ScanFragReq::getKeyinfoFlag(reqinfo); const Uint32 readCommitted = ScanFragReq::getReadCommittedFlag(reqinfo); const Uint32 idx = ScanFragReq::getRangeScanFlag(reqinfo); + const Uint32 descending = ScanFragReq::getDescendingFlag(reqinfo); const Uint32 attrLen = ScanFragReq::getAttrLen(reqinfo); const Uint32 scanPrio = ScanFragReq::getScanPrio(reqinfo); @@ -8649,6 +8651,7 @@ Uint32 Dblqh::initScanrec(const ScanFragReq* scanFragReq) scanptr.p->scanLockMode = scanLockMode; scanptr.p->readCommitted = readCommitted; scanptr.p->rangeScan = idx; + scanptr.p->descending = descending; scanptr.p->scanState = ScanRecord::SCAN_FREE; scanptr.p->scanFlag = ZFALSE; scanptr.p->scanLocalref[0] = 0; diff --git a/ndb/src/kernel/blocks/dblqh/Makefile.am b/ndb/src/kernel/blocks/dblqh/Makefile.am index 3a58dba742e..854860b269c 100644 --- a/ndb/src/kernel/blocks/dblqh/Makefile.am +++ b/ndb/src/kernel/blocks/dblqh/Makefile.am @@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdblqh.dsp + +libdblqh.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdblqh_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index 9afe4a5da0e..60f57c60f1f 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -897,7 +897,7 @@ public: UintR hashValue; /* THE HASH VALUE USED TO LOCATE FRAGMENT */ Uint8 distributionKeyIndicator; - Uint8 unused1; + Uint8 m_special_hash; // collation or distribution key Uint8 unused2; Uint8 lenAiInTckeyreq; /* LENGTH OF ATTRIBUTE INFORMATION IN TCKEYREQ */ @@ -986,7 +986,8 @@ public: Uint8 noOfKeyAttr; Uint8 hasCharAttr; - + Uint8 noOfDistrKeys; + struct KeyAttr { Uint32 attributeDescriptor; CHARSET_INFO* charsetInfo; @@ -1445,7 +1446,10 @@ private: void gcpTcfinished(Signal* signal); void handleGcp(Signal* signal); void hash(Signal* signal); - Uint32 xfrmKeyData(Signal* signal, Uint32* dst, Uint32 dstSize, const Uint32* src); + Uint32 handle_special_hash(Uint32 dstHash[4], + Uint32* src, Uint32 srcLen, + Uint32 tabPtrI, bool distr); + void initApiConnect(Signal* signal); void initApiConnectRec(Signal* signal, ApiConnectRecord * const regApiPtr, diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 2c88c44a465..2f371458b73 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -330,7 +330,7 @@ void Dbtc::execTC_SCHVERREQ(Signal* signal) Uint32 noOfKeyAttr = signal->theData[6]; ndbrequire(noOfKeyAttr <= MAX_ATTRIBUTES_IN_INDEX); Uint32 hasCharAttr = 0; - + Uint32 noOfDistrKeys = 0; SegmentedSectionPtr s0Ptr; signal->getSection(s0Ptr, 0); SectionReader r0(s0Ptr, getSectionSegmentPool()); @@ -350,6 +350,8 @@ void Dbtc::execTC_SCHVERREQ(Signal* signal) ndbrequire(cs != 0); hasCharAttr = 1; } + + noOfDistrKeys += AttributeDescriptor::getDKey(attributeDescriptor); tabptr.p->keyAttr[i].attributeDescriptor = attributeDescriptor; tabptr.p->keyAttr[i].charsetInfo = cs; i++; @@ -362,6 +364,7 @@ void Dbtc::execTC_SCHVERREQ(Signal* signal) tabptr.p->dropping = false; tabptr.p->noOfKeyAttr = noOfKeyAttr; tabptr.p->hasCharAttr = hasCharAttr; + tabptr.p->noOfDistrKeys = noOfDistrKeys; signal->theData[0] = tabptr.i; signal->theData[1] = retPtr; @@ -2258,12 +2261,10 @@ void Dbtc::hash(Signal* signal) UintR Tdata2; UintR Tdata3; UintR* Tdata32; - Uint64 Tdata[512]; - Uint64 Txfrmdata[512 * MAX_XFRM_MULTIPLY]; - + CacheRecord * const regCachePtr = cachePtr.p; - Tdata32 = (UintR*)&Tdata[0]; - + Tdata32 = signal->theData; + Tdata0 = regCachePtr->keydata[0]; Tdata1 = regCachePtr->keydata[1]; Tdata2 = regCachePtr->keydata[2]; @@ -2291,22 +2292,20 @@ void Dbtc::hash(Signal* signal) }//if UintR keylen = (UintR)regCachePtr->keylen; - - TableRecordPtr tabptrSave = tabptr; - tabptr.i = regCachePtr->tableref; // table or hash index id - ptrCheckGuard(tabptr, ctabrecFilesize, tableRecord); - if (tabptr.p->hasCharAttr) { - jam(); - keylen = xfrmKeyData(signal, (Uint32*)Txfrmdata, sizeof(Txfrmdata) >> 2, Tdata32); - Tdata32 = (UintR*)&Txfrmdata[0]; - } - tabptr = tabptrSave; - + Uint32 distKey = regCachePtr->distributionKeyIndicator; + Uint32 tmp[4]; - md5_hash(tmp, (Uint64*)&Tdata32[0], keylen); - + if(!regCachePtr->m_special_hash) + { + md5_hash(tmp, (Uint64*)&Tdata32[0], keylen); + } + else + { + handle_special_hash(tmp, Tdata32, keylen, regCachePtr->tableref, !distKey); + } + thashValue = tmp[0]; - if (regCachePtr->distributionKeyIndicator == 1) { + if (distKey){ jam(); tdistrHashValue = regCachePtr->distributionKey; } else { @@ -2316,44 +2315,109 @@ void Dbtc::hash(Signal* signal) }//Dbtc::hash() Uint32 -Dbtc::xfrmKeyData(Signal* signal, Uint32* dst, Uint32 dstSize, const Uint32* src) -{ - const Uint32 noOfKeyAttr = tabptr.p->noOfKeyAttr; +Dbtc::handle_special_hash(Uint32 dstHash[4], Uint32* src, Uint32 srcLen, + Uint32 tabPtrI, + bool distr) +{ + Uint64 Tmp[MAX_KEY_SIZE_IN_WORDS * 4 * MAX_XFRM_MULTIPLY]; + const Uint32 dstSize = sizeof(Tmp) / 4; + const TableRecord* tabPtrP = &tableRecord[tabPtrI]; + const Uint32 noOfKeyAttr = tabPtrP->noOfKeyAttr; + Uint32 noOfDistrKeys = tabPtrP->noOfDistrKeys; + const bool hasCharAttr = tabPtrP->hasCharAttr; + + Uint32 *dst = (Uint32*)Tmp; Uint32 dstPos = 0; Uint32 srcPos = 0; - Uint32 i = 0; - while (i < noOfKeyAttr) { - const TableRecord::KeyAttr& keyAttr = tabptr.p->keyAttr[i]; - - Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor); - Uint32 srcWords = (srcBytes + 3) / 4; - Uint32 dstWords = ~0; - uchar* dstPtr = (uchar*)&dst[dstPos]; - const uchar* srcPtr = (const uchar*)&src[srcPos]; - CHARSET_INFO* cs = keyAttr.charsetInfo; - - if (cs == NULL) { - jam(); - memcpy(dstPtr, srcPtr, srcWords << 2); - dstWords = srcWords; - } else { - jam(); - Uint32 xmul = cs->strxfrm_multiply; - if (xmul == 0) - xmul = 1; - Uint32 dstLen = xmul * srcBytes; - ndbrequire(dstLen <= ((dstSize - dstPos) << 2)); - uint n = (*cs->coll->strnxfrm)(cs, dstPtr, dstLen, srcPtr, srcBytes); - while ((n & 3) != 0) { - dstPtr[n++] = 0; + Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX]; + if(hasCharAttr){ + Uint32 i = 0; + while (i < noOfKeyAttr) { + const TableRecord::KeyAttr& keyAttr = tabPtrP->keyAttr[i]; + + Uint32 srcBytes = + AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor); + Uint32 srcWords = (srcBytes + 3) / 4; + Uint32 dstWords = ~0; + uchar* dstPtr = (uchar*)&dst[dstPos]; + const uchar* srcPtr = (const uchar*)&src[srcPos]; + CHARSET_INFO* cs = keyAttr.charsetInfo; + + if (cs == NULL) { + jam(); + memcpy(dstPtr, srcPtr, srcWords << 2); + dstWords = srcWords; + } else { + jam(); + Uint32 xmul = cs->strxfrm_multiply; + if (xmul == 0) + xmul = 1; + Uint32 dstLen = xmul * srcBytes; + ndbrequire(dstLen <= ((dstSize - dstPos) << 2)); + uint n = (*cs->coll->strnxfrm)(cs, dstPtr, dstLen, srcPtr, srcBytes); + while ((n & 3) != 0) { + dstPtr[n++] = 0; + } + dstWords = (n >> 2); + } - dstWords = (n >> 2); + dstPos += dstWords; + srcPos += srcWords; + keyPartLen[i++] = dstWords; } - dstPos += dstWords; - srcPos += srcWords; - i++; + } + else + { + dst = src; + dstPos = srcLen; + } + + md5_hash(dstHash, (Uint64*)dst, dstPos); + + if(distr && noOfDistrKeys) + { + jam(); + src = dst; + dstPos = 0; + Uint32 i = 0; + if(hasCharAttr) + { + while (i < noOfKeyAttr && noOfDistrKeys) + { + const TableRecord::KeyAttr& keyAttr = tabPtrP->keyAttr[i]; + Uint32 len = keyPartLen[i]; + if(AttributeDescriptor::getDKey(keyAttr.attributeDescriptor)) + { + noOfDistrKeys--; + memmove(dst+dstPos, src, len << 2); + dstPos += len; + } + src += len; + i++; + } + } + else + { + while (i < noOfKeyAttr && noOfDistrKeys) + { + const TableRecord::KeyAttr& keyAttr = tabPtrP->keyAttr[i]; + Uint32 len = + AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor); + len = (len + 3) / 4; + if(AttributeDescriptor::getDKey(keyAttr.attributeDescriptor)) + { + noOfDistrKeys--; + memmove(dst+dstPos, src, len << 2); + dstPos += len; + } + src += len; + i++; + } + } + Uint32 tmp[4]; + md5_hash(tmp, (Uint64*)dst, dstPos); + dstHash[1] = tmp[1]; } - return dstPos; } /* @@ -2803,7 +2867,8 @@ void Dbtc::execTCKEYREQ(Signal* signal) regCachePtr->keylen = TkeyLength; regCachePtr->lenAiInTckeyreq = titcLenAiInTckeyreq; regCachePtr->currReclenAi = titcLenAiInTckeyreq; - + regCachePtr->m_special_hash = + localTabptr.p->hasCharAttr | (localTabptr.p->noOfDistrKeys > 0); Tdata1 = TAIDataPtr[0]; Tdata2 = TAIDataPtr[1]; Tdata3 = TAIDataPtr[2]; @@ -6433,7 +6498,7 @@ void Dbtc::sendAbortedAfterTimeout(Signal* signal, int Tcheck) *------------------------------------------------------------------*/ char buf[96]; buf[0] = 0; char buf2[96]; - snprintf(buf, sizeof(buf), "TC %d: %d ops:", + BaseString::snprintf(buf, sizeof(buf), "TC %d: %d ops:", __LINE__, apiConnectptr.i); for(Uint32 i = 0; i<TloopCount; i++){ BaseString::snprintf(buf2, sizeof(buf2), "%s %d", buf, tmp[i]); @@ -8726,6 +8791,7 @@ void Dbtc::initScanrec(ScanRecordPtr scanptr, ScanFragReq::setKeyinfoFlag(tmp, ScanTabReq::getKeyinfoFlag(ri)); ScanFragReq::setReadCommittedFlag(tmp,ScanTabReq::getReadCommittedFlag(ri)); ScanFragReq::setRangeScanFlag(tmp, ScanTabReq::getRangeScanFlag(ri)); + ScanFragReq::setDescendingFlag(tmp, ScanTabReq::getDescendingFlag(ri)); ScanFragReq::setAttrLen(tmp, scanTabReq->attrLenKeyLen & 0xFFFF); scanptr.p->scanRequestInfo = tmp; @@ -10070,6 +10136,7 @@ void Dbtc::initTable(Signal* signal) tabptr.p->dropping = false; tabptr.p->noOfKeyAttr = 0; tabptr.p->hasCharAttr = 0; + tabptr.p->noOfDistrKeys = 0; for (unsigned k = 0; k < MAX_ATTRIBUTES_IN_INDEX; k++) { tabptr.p->keyAttr[k].attributeDescriptor = 0; tabptr.p->keyAttr[k].charsetInfo = 0; diff --git a/ndb/src/kernel/blocks/dbtc/Makefile.am b/ndb/src/kernel/blocks/dbtc/Makefile.am index 4aa514c0aba..98ee2639bac 100644 --- a/ndb/src/kernel/blocks/dbtc/Makefile.am +++ b/ndb/src/kernel/blocks/dbtc/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbtc.dsp + +libdbtc.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtc_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtup/Makefile.am b/ndb/src/kernel/blocks/dbtup/Makefile.am index 7e94a01d43b..e51410e6be3 100644 --- a/ndb/src/kernel/blocks/dbtup/Makefile.am +++ b/ndb/src/kernel/blocks/dbtup/Makefile.am @@ -25,3 +25,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbtup.dsp + +libdbtup.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtup_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index cd7a97d4b17..f6c405feb1c 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -406,6 +406,7 @@ private: Uint32 m_accLockOp; Uint8 m_readCommitted; // no locking Uint8 m_lockMode; + Uint8 m_descending; ScanBound m_boundMin; ScanBound m_boundMax; ScanBound* m_bound[2]; // pointers to above 2 @@ -638,7 +639,7 @@ private: void execACCKEYREF(Signal* signal); void execACC_ABORTCONF(Signal* signal); void scanFirst(ScanOpPtr scanPtr); - void scanNext(ScanOpPtr scanPtr); + void scanNext(ScanOpPtr scanPtr, bool fromMaintReq); bool scanVisible(ScanOpPtr scanPtr, TreeEnt ent); void scanClose(Signal* signal, ScanOpPtr scanPtr); void addAccLockOp(ScanOp& scan, Uint32 accLockOp); @@ -650,7 +651,9 @@ private: */ void searchToAdd(Frag& frag, ConstData searchKey, TreeEnt searchEnt, TreePos& treePos); void searchToRemove(Frag& frag, ConstData searchKey, TreeEnt searchEnt, TreePos& treePos); - void searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos); + void searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, bool descending, TreePos& treePos); + void searchToScanAscending(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos); + void searchToScanDescending(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos); /* * DbtuxCmp.cpp @@ -1029,6 +1032,7 @@ Dbtux::ScanOp::ScanOp(ScanBoundPool& scanBoundPool) : m_accLockOp(RNIL), m_readCommitted(0), m_lockMode(0), + m_descending(0), m_boundMin(scanBoundPool), m_boundMax(scanBoundPool), m_scanPos(), diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp index ffce9969074..cf815b14c1a 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp @@ -103,7 +103,7 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, ConstData searchKey, Cons * * Following example illustrates this. We are at (a=2, b=3). * - * dir bounds strict return + * idir bounds strict return * 0 a >= 2 and b >= 3 no -1 * 0 a >= 2 and b > 3 yes +1 * 1 a <= 2 and b <= 3 no +1 @@ -112,11 +112,11 @@ Dbtux::cmpSearchKey(const Frag& frag, unsigned& start, ConstData searchKey, Cons * The attributes are normalized and have variable size given in words. */ int -Dbtux::cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigned boundCount, ConstData entryData, unsigned maxlen) +Dbtux::cmpScanBound(const Frag& frag, unsigned idir, ConstData boundInfo, unsigned boundCount, ConstData entryData, unsigned maxlen) { const DescEnt& descEnt = getDescEnt(frag.m_descPage, frag.m_descOff); // direction 0-lower 1-upper - ndbrequire(dir <= 1); + ndbrequire(idir <= 1); // number of words of data left unsigned len2 = maxlen; // in case of no bounds, init last type to something non-strict @@ -171,5 +171,5 @@ Dbtux::cmpScanBound(const Frag& frag, unsigned dir, ConstData boundInfo, unsigne } // all attributes were equal const int strict = (type & 0x1); - return (dir == 0 ? (strict == 0 ? -1 : +1) : (strict == 0 ? +1 : -1)); + return (idir == 0 ? (strict == 0 ? -1 : +1) : (strict == 0 ? +1 : -1)); } diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp index 0efcc950e02..ed29dc57915 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp @@ -347,6 +347,7 @@ operator<<(NdbOut& out, const Dbtux::ScanOp& scan) out << "]"; out << " [readCommitted " << dec << scan.m_readCommitted << "]"; out << " [lockMode " << dec << scan.m_lockMode << "]"; + out << " [descending " << dec << scan.m_descending << "]"; out << " [pos " << scan.m_scanPos << "]"; out << " [ent " << scan.m_scanEnt << "]"; for (unsigned i = 0; i <= 1; i++) { diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp index 389192fd0cf..855a8ed1c29 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp @@ -491,7 +491,7 @@ Dbtux::moveScanList(NodeHandle& node, unsigned pos) debugOut << "At pos=" << pos << " " << node << endl; } #endif - scanNext(scanPtr); + scanNext(scanPtr, true); ndbrequire(! (scanPos.m_loc == node.m_loc && scanPos.m_pos == pos)); } scanPtr.i = nextPtrI; diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp index 34f2ab3c525..84081e76a8c 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp @@ -74,17 +74,18 @@ Dbtux::execACC_SCANREQ(Signal* signal) scanPtr.p->m_savePointId = req->savePointId; scanPtr.p->m_readCommitted = AccScanReq::getReadCommittedFlag(req->requestInfo); scanPtr.p->m_lockMode = AccScanReq::getLockMode(req->requestInfo); -#ifdef VM_TRACE - if (debugFlags & DebugScan) { - debugOut << "Seize scan " << scanPtr.i << " " << *scanPtr.p << endl; - } -#endif + scanPtr.p->m_descending = AccScanReq::getDescendingFlag(req->requestInfo); /* * readCommitted lockMode keyInfo * 1 0 0 - read committed (no lock) * 0 0 0 - read latest (read lock) * 0 1 1 - read exclusive (write lock) */ +#ifdef VM_TRACE + if (debugFlags & DebugScan) { + debugOut << "Seize scan " << scanPtr.i << " " << *scanPtr.p << endl; + } +#endif // conf AccScanConf* const conf = (AccScanConf*)signal->getDataPtrSend(); conf->scanPtr = req->senderData; @@ -418,7 +419,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal) if (scan.m_state == ScanOp::Next) { jam(); // look for next - scanNext(scanPtr); + scanNext(scanPtr, false); } // for reading tuple key in Current or Locked state Data pkData = c_dataBuffer; @@ -697,8 +698,10 @@ Dbtux::scanFirst(ScanOpPtr scanPtr) TreeHead& tree = frag.m_tree; // set up index keys for this operation setKeyAttrs(frag); - // unpack lower bound into c_dataBuffer - const ScanBound& bound = *scan.m_bound[0]; + // scan direction 0, 1 + const unsigned idir = scan.m_descending; + // unpack start key into c_dataBuffer + const ScanBound& bound = *scan.m_bound[idir]; ScanBoundIterator iter; bound.first(iter); for (unsigned j = 0; j < bound.getSize(); j++) { @@ -706,11 +709,10 @@ Dbtux::scanFirst(ScanOpPtr scanPtr) c_dataBuffer[j] = *iter.data; bound.next(iter); } - // search for scan start position TreePos treePos; - searchToScan(frag, c_dataBuffer, scan.m_boundCnt[0], treePos); + searchToScan(frag, c_dataBuffer, scan.m_boundCnt[idir], scan.m_descending, treePos); if (treePos.m_loc == NullTupLoc) { - // empty tree + // empty result set jam(); scan.m_state = ScanOp::Last; return; @@ -728,7 +730,8 @@ Dbtux::scanFirst(ScanOpPtr scanPtr) * Move to next entry. The scan is already linked to some node. When * we leave, if an entry was found, it will be linked to a possibly * different node. The scan has a position, and a direction which tells - * from where we came to this position. This is one of: + * from where we came to this position. This is one of (all comments + * are in terms of ascending scan): * * 0 - up from left child (scan this node next) * 1 - up from right child (proceed to parent) @@ -740,7 +743,7 @@ Dbtux::scanFirst(ScanOpPtr scanPtr) * re-organizations need not worry about scan direction. */ void -Dbtux::scanNext(ScanOpPtr scanPtr) +Dbtux::scanNext(ScanOpPtr scanPtr, bool fromMaintReq) { ScanOp& scan = *scanPtr.p; Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI); @@ -753,8 +756,11 @@ Dbtux::scanNext(ScanOpPtr scanPtr) ndbrequire(scan.m_state != ScanOp::Locked); // set up index keys for this operation setKeyAttrs(frag); - // unpack upper bound into c_dataBuffer - const ScanBound& bound = *scan.m_bound[1]; + // scan direction + const unsigned idir = scan.m_descending; // 0, 1 + const int jdir = 1 - 2 * (int)idir; // 1, -1 + // unpack end key into c_dataBuffer + const ScanBound& bound = *scan.m_bound[1 - idir]; ScanBoundIterator iter; bound.first(iter); for (unsigned j = 0; j < bound.getSize(); j++) { @@ -774,6 +780,11 @@ Dbtux::scanNext(ScanOpPtr scanPtr) TreeEnt ent; while (true) { jam(); +#ifdef VM_TRACE + if (debugFlags & DebugScan) { + debugOut << "Scan next pos " << pos << " " << node << endl; + } +#endif if (pos.m_dir == 2) { // coming up from root ends the scan jam(); @@ -788,7 +799,7 @@ Dbtux::scanNext(ScanOpPtr scanPtr) if (pos.m_dir == 4) { // coming down from parent proceed to left child jam(); - TupLoc loc = node.getLink(0); + TupLoc loc = node.getLink(idir); if (loc != NullTupLoc) { jam(); pos.m_loc = loc; @@ -796,34 +807,42 @@ Dbtux::scanNext(ScanOpPtr scanPtr) continue; } // pretend we came from left child - pos.m_dir = 0; + pos.m_dir = idir; + } + const unsigned occup = node.getOccup(); + if (occup == 0) { + jam(); + ndbrequire(fromMaintReq); + // move back to parent - see comment in treeRemoveInner + pos.m_loc = node.getLink(2); + pos.m_dir = node.getSide(); + continue; } - if (pos.m_dir == 0) { + if (pos.m_dir == idir) { // coming up from left child scan current node jam(); - pos.m_pos = 0; + pos.m_pos = idir == 0 ? 0 : occup - 1; pos.m_match = false; pos.m_dir = 3; } if (pos.m_dir == 3) { // within node jam(); - unsigned occup = node.getOccup(); - ndbrequire(occup >= 1); // advance position if (! pos.m_match) pos.m_match = true; else - pos.m_pos++; + // becomes ZNIL (which is > occup) if 0 and scan descending + pos.m_pos += jdir; if (pos.m_pos < occup) { jam(); ent = node.getEnt(pos.m_pos); pos.m_dir = 3; // unchanged // read and compare all attributes readKeyAttrs(frag, ent, 0, c_entryKey); - int ret = cmpScanBound(frag, 1, c_dataBuffer, scan.m_boundCnt[1], c_entryKey); + int ret = cmpScanBound(frag, 1 - idir, c_dataBuffer, scan.m_boundCnt[1 - idir], c_entryKey); ndbrequire(ret != NdbSqlUtil::CmpUnknown); - if (ret < 0) { + if (jdir * ret < 0) { jam(); // hit upper bound of single range scan pos.m_loc = NullTupLoc; @@ -840,7 +859,7 @@ Dbtux::scanNext(ScanOpPtr scanPtr) break; } // after node proceed to right child - TupLoc loc = node.getLink(1); + TupLoc loc = node.getLink(1 - idir); if (loc != NullTupLoc) { jam(); pos.m_loc = loc; @@ -848,9 +867,9 @@ Dbtux::scanNext(ScanOpPtr scanPtr) continue; } // pretend we came from right child - pos.m_dir = 1; + pos.m_dir = 1 - idir; } - if (pos.m_dir == 1) { + if (pos.m_dir == 1 - idir) { // coming up from right child proceed to parent jam(); pos.m_loc = node.getLink(2); diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp index 7057d74c3ad..b0e2a664bfd 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp @@ -253,22 +253,33 @@ Dbtux::searchToRemove(Frag& frag, ConstData searchKey, TreeEnt searchEnt, TreePo /* * Search for scan start position. * - * Similar to searchToAdd. + * Similar to searchToAdd. The routines differ somewhat depending on + * scan direction and are done by separate methods. */ void -Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos) +Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, bool descending, TreePos& treePos) { const TreeHead& tree = frag.m_tree; - NodeHandle currNode(frag); - currNode.m_loc = tree.m_root; - if (currNode.m_loc == NullTupLoc) { - // empty tree - jam(); - treePos.m_match = false; + if (tree.m_root != NullTupLoc) { + if (! descending) + searchToScanAscending(frag, boundInfo, boundCount, treePos); + else + searchToScanDescending(frag, boundInfo, boundCount, treePos); return; } + // empty tree +} + +void +Dbtux::searchToScanAscending(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos) +{ + const TreeHead& tree = frag.m_tree; + NodeHandle currNode(frag); + currNode.m_loc = tree.m_root; NodeHandle glbNode(frag); // potential g.l.b of final node NodeHandle bottomNode(frag); + // always before entry + treePos.m_match = false; while (true) { jam(); selectNode(currNode, currNode.m_loc); @@ -283,6 +294,7 @@ Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePo ndbrequire(ret != NdbSqlUtil::CmpUnknown); } if (ret < 0) { + // bound is left of this node jam(); const TupLoc loc = currNode.getLink(0); if (loc != NullTupLoc) { @@ -300,11 +312,11 @@ Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePo // start scanning this node treePos.m_loc = currNode.m_loc; treePos.m_pos = 0; - treePos.m_match = false; treePos.m_dir = 3; return; } } else if (ret > 0) { + // bound is at or right of this node jam(); const TupLoc loc = currNode.getLink(1); if (loc != NullTupLoc) { @@ -316,7 +328,7 @@ Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePo continue; } } else { - ndbassert(false); + ndbrequire(false); } break; } @@ -328,20 +340,19 @@ Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePo ret = cmpScanBound(frag, 0, boundInfo, boundCount, c_entryKey); ndbrequire(ret != NdbSqlUtil::CmpUnknown); if (ret < 0) { - // start scanning from current entry + // found first entry satisfying the bound treePos.m_loc = currNode.m_loc; treePos.m_pos = j; - treePos.m_match = false; treePos.m_dir = 3; return; } } + // bound is to right of this node if (! bottomNode.isNull()) { jam(); // start scanning the l.u.b treePos.m_loc = bottomNode.m_loc; treePos.m_pos = 0; - treePos.m_match = false; treePos.m_dir = 3; return; } @@ -349,3 +360,90 @@ Dbtux::searchToScan(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePo treePos.m_loc = currNode.m_loc; treePos.m_dir = 1; } + +void +Dbtux::searchToScanDescending(Frag& frag, ConstData boundInfo, unsigned boundCount, TreePos& treePos) +{ + const TreeHead& tree = frag.m_tree; + NodeHandle currNode(frag); + currNode.m_loc = tree.m_root; + NodeHandle glbNode(frag); // potential g.l.b of final node + NodeHandle bottomNode(frag); + // always before entry + treePos.m_match = false; + while (true) { + jam(); + selectNode(currNode, currNode.m_loc); + int ret; + // compare prefix + ret = cmpScanBound(frag, 1, boundInfo, boundCount, currNode.getPref(), tree.m_prefSize); + if (ret == NdbSqlUtil::CmpUnknown) { + jam(); + // read and compare all attributes + readKeyAttrs(frag, currNode.getMinMax(0), 0, c_entryKey); + ret = cmpScanBound(frag, 1, boundInfo, boundCount, c_entryKey); + ndbrequire(ret != NdbSqlUtil::CmpUnknown); + } + if (ret < 0) { + // bound is left of this node + jam(); + const TupLoc loc = currNode.getLink(0); + if (loc != NullTupLoc) { + jam(); + // continue to left subtree + currNode.m_loc = loc; + continue; + } + if (! glbNode.isNull()) { + jam(); + // move up to the g.l.b but remember the bottom node + bottomNode = currNode; + currNode = glbNode; + } else { + // empty result set + return; + } + } else if (ret > 0) { + // bound is at or right of this node + jam(); + const TupLoc loc = currNode.getLink(1); + if (loc != NullTupLoc) { + jam(); + // save potential g.l.b + glbNode = currNode; + // continue to right subtree + currNode.m_loc = loc; + continue; + } + } else { + ndbrequire(false); + } + break; + } + for (unsigned j = 0, occup = currNode.getOccup(); j < occup; j++) { + jam(); + int ret; + // read and compare attributes + readKeyAttrs(frag, currNode.getEnt(j), 0, c_entryKey); + ret = cmpScanBound(frag, 1, boundInfo, boundCount, c_entryKey); + ndbrequire(ret != NdbSqlUtil::CmpUnknown); + if (ret < 0) { + if (j > 0) { + // start scanning from previous entry + treePos.m_loc = currNode.m_loc; + treePos.m_pos = j - 1; + treePos.m_dir = 3; + return; + } + // start scanning upwards (pretend we came from left child) + treePos.m_loc = currNode.m_loc; + treePos.m_pos = 0; + treePos.m_dir = 0; + return; + } + } + // start scanning this node + treePos.m_loc = currNode.m_loc; + treePos.m_pos = currNode.getOccup() - 1; + treePos.m_dir = 3; +} diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp index b9e3b593a00..5107a8d8e31 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp @@ -226,6 +226,9 @@ Dbtux::treeRemoveInner(Frag& frag, NodeHandle lubNode, unsigned pos) // borrow max entry from semi/leaf Uint32 scanList = RNIL; nodePopDown(glbNode, glbNode.getOccup() - 1, ent, &scanList); + // g.l.b may be empty now + // a descending scan may try to enter the empty g.l.b + // we prevent this in scanNext nodePopUp(lubNode, pos, ent, scanList); if (glbNode.getLink(0) != NullTupLoc) { jam(); diff --git a/ndb/src/kernel/blocks/dbtux/Makefile.am b/ndb/src/kernel/blocks/dbtux/Makefile.am index 7d012924522..b5951e8ed37 100644 --- a/ndb/src/kernel/blocks/dbtux/Makefile.am +++ b/ndb/src/kernel/blocks/dbtux/Makefile.am @@ -18,3 +18,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbtux.dsp + +libdbtux.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtux_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbutil/Makefile.am b/ndb/src/kernel/blocks/dbutil/Makefile.am index 763875d578f..925356c2f76 100644 --- a/ndb/src/kernel/blocks/dbutil/Makefile.am +++ b/ndb/src/kernel/blocks/dbutil/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libdbutil.dsp + +libdbutil.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbutil_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/grep/Grep.cpp b/ndb/src/kernel/blocks/grep/Grep.cpp index 0e41182348f..e89361dab06 100644 --- a/ndb/src/kernel/blocks/grep/Grep.cpp +++ b/ndb/src/kernel/blocks/grep/Grep.cpp @@ -603,7 +603,7 @@ Grep::PSCoord::execCREATE_SUBID_CONF(Signal* signal) GrepEvent::GrepPS_CreateSubIdConf, subId, subKey, - (Uint32)GrepError::NO_ERROR); + (Uint32)GrepError::GE_NO_ERROR); } void @@ -612,7 +612,7 @@ Grep::PSCoord::execCREATE_SUBID_REF(Signal* signal) { CreateSubscriptionIdRef const * ref = (CreateSubscriptionIdRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err; + GrepError::GE_Code err; Uint32 sendersBlockRef = signal->getSendersBlockRef(); if(sendersBlockRef == SUMA_REF) @@ -624,7 +624,7 @@ Grep::PSCoord::execCREATE_SUBID_REF(Signal* signal) { ndbrequire(false); /* Added since errorcode err unhandled * TODO: fix correct errorcode */ - err= GrepError::NO_ERROR; // remove compiler warning + err= GrepError::GE_NO_ERROR; // remove compiler warning } SubCoordinatorPtr subPtr; @@ -824,7 +824,7 @@ Grep::PSPart::execSUB_CREATE_REF(Signal* signal) jamEntry(); SubCreateRef * const ref = (SubCreateRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err = (GrepError::Code)ref->err; + GrepError::GE_Code err = (GrepError::GE_Code)ref->err; SubscriptionPtr subPtr; c_subscriptions.getPtr(subPtr, subData); sendRefToPSCoord(signal, *subPtr.p, err /*error*/); @@ -867,7 +867,7 @@ Grep::PSCoord::execGREP_CREATE_CONF(Signal* signal) GrepEvent::GrepPS_SubCreateConf, subId, subKey, - (Uint32)GrepError::NO_ERROR); + (Uint32)GrepError::GE_NO_ERROR); c_subCoordinatorPool.release(subPtr); @@ -889,7 +889,7 @@ Grep::PSCoord::execGREP_CREATE_REF(Signal* signal) SubCoordinatorPtr subPtr; c_runningSubscriptions.getPtr(subPtr, subData); - sendRefToSS(signal, *subPtr.p, (GrepError::Code)err /*error*/); + sendRefToSS(signal, *subPtr.p, (GrepError::GE_Code)err /*error*/); } @@ -1046,7 +1046,7 @@ Grep::PSPart::execSUB_START_REF(Signal* signal) { SubStartRef * const ref = (SubStartRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err = (GrepError::Code)ref->err; + GrepError::GE_Code err = (GrepError::GE_Code)ref->err; SubscriptionData::Part part = (SubscriptionData::Part)ref->part; SubscriptionPtr subPtr; c_subscriptions.getPtr(subPtr, subData); @@ -1102,7 +1102,7 @@ Grep::PSCoord::execGREP_START_CONF(Signal* signal) EventReport::GrepSubscriptionInfo, GrepEvent::GrepPS_SubStartMetaConf, subId, subKey, - (Uint32)GrepError::NO_ERROR); + (Uint32)GrepError::GE_NO_ERROR); c_subCoordinatorPool.release(subPtr); break; @@ -1118,7 +1118,7 @@ Grep::PSCoord::execGREP_START_CONF(Signal* signal) EventReport::GrepSubscriptionInfo, GrepEvent::GrepPS_SubStartDataConf, subId, subKey, - (Uint32)GrepError::NO_ERROR); + (Uint32)GrepError::GE_NO_ERROR); c_subCoordinatorPool.release(subPtr); @@ -1145,7 +1145,7 @@ Grep::PSCoord::execGREP_START_REF(Signal* signal) jamEntry(); GrepStartRef * const ref = (GrepStartRef *)signal->getDataPtr(); Uint32 subData = ref->senderData; - GrepError::Code err = (GrepError::Code)ref->err; + GrepError::GE_Code err = (GrepError::GE_Code)ref->err; SubscriptionData::Part part = (SubscriptionData::Part)ref->part; SubCoordinatorPtr subPtr; @@ -1301,7 +1301,7 @@ Grep::PSPart::execSUB_REMOVE_REF(Signal* signal) jamEntry(); SubRemoveRef * const ref = (SubRemoveRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - /* GrepError::Code err = (GrepError::Code)ref->err;*/ + /* GrepError::GE_Code err = (GrepError::GE_Code)ref->err;*/ SubscriptionPtr subPtr; c_subscriptions.getPtr(subPtr, subData); @@ -1342,7 +1342,7 @@ Grep::PSCoord::execGREP_REMOVE_CONF(Signal* signal) EventReport::GrepSubscriptionInfo, GrepEvent::GrepPS_SubRemoveConf, subId, subKey, - GrepError::NO_ERROR); + GrepError::GE_NO_ERROR); GrepSubRemoveConf * grepConf = (GrepSubRemoveConf *) conf; grepConf->subscriptionId = subId; @@ -1375,7 +1375,7 @@ Grep::PSCoord::execGREP_REMOVE_REF(Signal* signal) subPtr.p = c_runningSubscriptions.getPtr(subPtr.i); if(subData == subPtr.i) { - sendRefToSS(signal, *subPtr.p, (GrepError::Code)err /*error*/); + sendRefToSS(signal, *subPtr.p, (GrepError::GE_Code)err /*error*/); c_runningSubscriptions.release(subPtr); return; } @@ -1633,7 +1633,7 @@ Grep::PSPart::execSUB_SYNC_REF(Signal* signal) { jamEntry(); SubSyncRef * const ref = (SubSyncRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err = (GrepError::Code)ref->err; + GrepError::GE_Code err = (GrepError::GE_Code)ref->err; SubscriptionData::Part part = (SubscriptionData::Part)ref->part; SubscriptionPtr subPtr; @@ -1677,7 +1677,7 @@ Grep::PSCoord::execGREP_SYNC_CONF(Signal* signal) /* @todo Johan: Add firstGCI here. /Lars */ m_grep->sendEventRep(signal, EventReport::GrepSubscriptionInfo, event, subId, subKey, - (Uint32)GrepError::NO_ERROR, + (Uint32)GrepError::GE_NO_ERROR, lastGCI); /************************* @@ -1707,7 +1707,7 @@ Grep::PSCoord::execGREP_SYNC_REF(Signal* signal) { GrepSyncRef * const ref = (GrepSyncRef *)signal->getDataPtr(); Uint32 subData = ref->senderData; SubscriptionData::Part part = (SubscriptionData::Part)ref->part; - GrepError::Code err = (GrepError::Code)ref->err; + GrepError::GE_Code err = (GrepError::GE_Code)ref->err; SubCoordinatorPtr subPtr; c_runningSubscriptions.getPtr(subPtr, subData); sendRefToSS(signal, *subPtr.p, err /*error*/, part); @@ -1718,7 +1718,7 @@ Grep::PSCoord::execGREP_SYNC_REF(Signal* signal) { void Grep::PSCoord::sendRefToSS(Signal * signal, SubCoordinator sub, - GrepError::Code err, + GrepError::GE_Code err, SubscriptionData::Part part) { /** @@ -1843,7 +1843,7 @@ Grep::PSCoord::sendRefToSS(Signal * signal, void Grep::PSPart::sendRefToPSCoord(Signal * signal, Subscription sub, - GrepError::Code err, + GrepError::GE_Code err, SubscriptionData::Part part) { jam(); diff --git a/ndb/src/kernel/blocks/grep/Grep.hpp b/ndb/src/kernel/blocks/grep/Grep.hpp index eeabac36966..7d3dd916ecc 100644 --- a/ndb/src/kernel/blocks/grep/Grep.hpp +++ b/ndb/src/kernel/blocks/grep/Grep.hpp @@ -380,16 +380,16 @@ public: Uint32 subId, Uint32 subKey, BlockReference to, - GrepError::Code err); + GrepError::GE_Code err); void sendSubRemoveRef_SS(Signal * signal, SubCoordinator sub, - GrepError::Code err); + GrepError::GE_Code err); void sendRefToSS(Signal * signal, SubCoordinator sub, - GrepError::Code err, + GrepError::GE_Code err, SubscriptionData::Part part = (SubscriptionData::Part)0); void setRepRef(BlockReference rr) { m_repRef = rr; }; @@ -496,7 +496,7 @@ public: void sendRefToPSCoord(Signal * signal, Subscription sub, - GrepError::Code err, + GrepError::GE_Code err, SubscriptionData::Part part = (SubscriptionData::Part)0); //protected: diff --git a/ndb/src/kernel/blocks/grep/Makefile.am b/ndb/src/kernel/blocks/grep/Makefile.am index 31081c7b6a0..6d2b422784b 100644 --- a/ndb/src/kernel/blocks/grep/Makefile.am +++ b/ndb/src/kernel/blocks/grep/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libgrep.dsp + +libgrep.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libgrep_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/ndbcntr/Makefile.am b/ndb/src/kernel/blocks/ndbcntr/Makefile.am index 9230b55b374..3f24675b2b3 100644 --- a/ndb/src/kernel/blocks/ndbcntr/Makefile.am +++ b/ndb/src/kernel/blocks/ndbcntr/Makefile.am @@ -10,3 +10,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libndbcntr.dsp + +libndbcntr.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libndbcntr_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/ndbfs/Makefile.am b/ndb/src/kernel/blocks/ndbfs/Makefile.am index c2b663c5042..a22386f8612 100644 --- a/ndb/src/kernel/blocks/ndbfs/Makefile.am +++ b/ndb/src/kernel/blocks/ndbfs/Makefile.am @@ -11,3 +11,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libndbfs.dsp + +libndbfs.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libndbfs_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index 56e3d3abbed..21b0a2cb54f 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -730,7 +730,7 @@ Ndbfs::scanIPC(Signal* signal) jam(); report(request, signal); theRequestPool->put(request); - return &request; + return true; } return false; } diff --git a/ndb/src/kernel/blocks/qmgr/Makefile.am b/ndb/src/kernel/blocks/qmgr/Makefile.am index 52cadb3bd3d..278af2a7865 100644 --- a/ndb/src/kernel/blocks/qmgr/Makefile.am +++ b/ndb/src/kernel/blocks/qmgr/Makefile.am @@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libqmgr.dsp + +libqmgr.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libqmgr_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/suma/Makefile.am b/ndb/src/kernel/blocks/suma/Makefile.am index 4dacb22af51..5a74dbb74eb 100644 --- a/ndb/src/kernel/blocks/suma/Makefile.am +++ b/ndb/src/kernel/blocks/suma/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libsuma.dsp + +libsuma.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libsuma_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/trix/Makefile.am b/ndb/src/kernel/blocks/trix/Makefile.am index 803da815cf0..343063a6283 100644 --- a/ndb/src/kernel/blocks/trix/Makefile.am +++ b/ndb/src/kernel/blocks/trix/Makefile.am @@ -7,3 +7,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libtrix.dsp + +libtrix.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libtrix_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/error/Makefile.am b/ndb/src/kernel/error/Makefile.am index 4514d2d105c..54f3de2d76d 100644 --- a/ndb/src/kernel/error/Makefile.am +++ b/ndb/src/kernel/error/Makefile.am @@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: liberror.dsp + +liberror.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(liberror_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index cd4b698bbf2..b9b4ff2c115 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -72,11 +72,13 @@ int main(int argc, char** argv) } { // Do configuration - signal(SIGPIPE, SIG_IGN); +#ifndef NDB_WIN32 + signal(SIGPIPE, SIG_IGN); +#endif theConfig->fetch_configuration(); } - - chdir(NdbConfig_get_path(0)); + + my_setwd(NdbConfig_get_path(0), MYF(0)); if (theConfig->getDaemonMode()) { // Become a daemon @@ -90,6 +92,7 @@ int main(int argc, char** argv) } } +#ifndef NDB_WIN32 for(pid_t child = fork(); child != 0; child = fork()){ /** * Parent @@ -140,6 +143,9 @@ int main(int argc, char** argv) } g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid()); +#else + g_eventLogger.info("Ndb started"); +#endif theConfig->setupConfiguration(); systemInfo(* theConfig, * theConfig->m_logLevel); @@ -282,7 +288,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ void catchsigs(bool ignore){ -#if ! defined NDB_SOFTOSE && !defined NDB_OSE +#if !defined NDB_WIN32 && !defined NDB_SOFTOSE && !defined NDB_OSE static const int signals_shutdown[] = { #ifdef SIGBREAK @@ -324,7 +330,6 @@ catchsigs(bool ignore){ SIGTRAP #endif }; -#endif static const int signals_ignore[] = { SIGPIPE @@ -337,6 +342,7 @@ catchsigs(bool ignore){ handler_register(signals_error[i], handler_error, ignore); for(i = 0; i < sizeof(signals_ignore)/sizeof(signals_ignore[0]); i++) handler_register(signals_ignore[i], SIG_IGN, ignore); +#endif } extern "C" @@ -355,8 +361,10 @@ handler_error(int signum){ if (thread_id != 0 && thread_id == my_thread_id()) { // Shutdown thread received signal - signal(signum, SIG_DFL); +#ifndef NDB_WIN32 + signal(signum, SIG_DFL); kill(getpid(), signum); +#endif while(true) NdbSleep_MilliSleep(10); } diff --git a/ndb/src/kernel/vm/Callback.hpp b/ndb/src/kernel/vm/Callback.hpp index bf1ae5968d3..6a619ba7859 100644 --- a/ndb/src/kernel/vm/Callback.hpp +++ b/ndb/src/kernel/vm/Callback.hpp @@ -20,12 +20,5 @@ /** * Block callbacks */ -typedef void (SimulatedBlock::* CallbackFunction)(class Signal*, - Uint32 callbackData, - Uint32 returnCode); -struct Callback { - CallbackFunction m_callbackFunction; - Uint32 m_callbackData; -}; #endif diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 931b4da5a17..7c31490959b 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -281,19 +281,19 @@ static char * get_and_validate_path(ndb_mgm_configuration_iterator &iter, memset(buf2, 0,sizeof(buf2)); #ifdef NDB_WIN32 char* szFilePart; - if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) - || (::GetFileAttributes(alloc_path)&FILE_ATTRIBUTE_READONLY)) + if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) || + (GetFileAttributes(buf2) & FILE_ATTRIBUTE_READONLY)) #else - if((::realpath(path, buf2) == NULL)|| + if((::realpath(path, buf2) == NULL)|| (::access(buf2, W_OK) != 0)) #endif - { - ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, path, " Filename::init()"); - } - + { + ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, path, " Filename::init()"); + } + if (strcmp(&buf2[strlen(buf2) - 1], DIR_SEPARATOR)) strcat(buf2, DIR_SEPARATOR); - + return strdup(buf2); } @@ -561,7 +561,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){ noOfDBNodes++; // No of NDB processes if(nodeId > MAX_NDB_NODES){ - snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", + BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", MAX_NDB_NODES); ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf); } diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index a5897cd4064..adf3c438945 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -179,12 +179,14 @@ NdbShutdown(NdbShutdownType type, exit(-1); #endif } - + +#ifndef NDB_WIN32 if (simulate_error_during_shutdown) { kill(getpid(), simulate_error_during_shutdown); while(true) NdbSleep_MilliSleep(10); } +#endif globalEmulatorData.theWatchDog->doStop(); diff --git a/ndb/src/kernel/vm/Makefile.am b/ndb/src/kernel/vm/Makefile.am index 4e9dbe36c78..0dce9285ae3 100644 --- a/ndb/src/kernel/vm/Makefile.am +++ b/ndb/src/kernel/vm/Makefile.am @@ -27,3 +27,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libkernel.dsp + +libkernel.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libkernel_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/vm/Mutex.cpp b/ndb/src/kernel/vm/Mutex.cpp index 1dbc6e7ec4a..aab9e74312b 100644 --- a/ndb/src/kernel/vm/Mutex.cpp +++ b/ndb/src/kernel/vm/Mutex.cpp @@ -19,48 +19,51 @@ #include "Mutex.hpp" #include <signaldata/UtilLock.hpp> -MutexManager::MutexManager(class SimulatedBlock & block) +SimulatedBlock::MutexManager::MutexManager(class SimulatedBlock & block) : m_block(block), m_activeMutexes(m_mutexPool) { } bool -MutexManager::setSize(Uint32 maxNoOfActiveMutexes){ +SimulatedBlock::MutexManager::setSize(Uint32 maxNoOfActiveMutexes){ return m_mutexPool.setSize(maxNoOfActiveMutexes); } Uint32 -MutexManager::getSize() const { +SimulatedBlock::MutexManager::getSize() const { return m_mutexPool.getSize(); } bool -MutexManager::seize(ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::seize(ActiveMutexPtr& ptr){ return m_activeMutexes.seize(ptr); } void -MutexManager::release(Uint32 activeMutexPtrI){ +SimulatedBlock::MutexManager::release(Uint32 activeMutexPtrI){ m_activeMutexes.release(activeMutexPtrI); } void -MutexManager::getPtr(ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::getPtr(ActiveMutexPtr& ptr){ m_activeMutexes.getPtr(ptr); } BlockReference -MutexManager::reference() const { +SimulatedBlock::MutexManager::reference() const { return m_block.reference(); } void -MutexManager::progError(int line, int err_code, const char* extra) { +SimulatedBlock::MutexManager::progError(int line, + int err_code, + const char* extra) +{ m_block.progError(line, err_code, extra); } void -MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ UtilCreateLockReq * req = (UtilCreateLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -78,7 +81,7 @@ MutexManager::create(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ UtilCreateLockRef * ref = (UtilCreateLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; @@ -91,7 +94,7 @@ MutexManager::execUTIL_CREATE_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ UtilCreateLockConf * conf = (UtilCreateLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; @@ -105,7 +108,7 @@ MutexManager::execUTIL_CREATE_LOCK_CONF(Signal* signal){ void -MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ UtilDestroyLockReq * req = (UtilDestroyLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -123,7 +126,7 @@ MutexManager::destroy(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ UtilDestroyLockRef * ref = (UtilDestroyLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -135,7 +138,7 @@ MutexManager::execUTIL_DESTORY_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ UtilDestroyLockConf * conf = (UtilDestroyLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -148,7 +151,7 @@ MutexManager::execUTIL_DESTORY_LOCK_CONF(Signal* signal){ void -MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ UtilLockReq * req = (UtilLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -166,7 +169,7 @@ MutexManager::lock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ UtilLockReq * req = (UtilLockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; @@ -184,7 +187,7 @@ MutexManager::trylock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_LOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_LOCK_REF(Signal* signal){ UtilLockRef * ref = (UtilLockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -196,7 +199,7 @@ MutexManager::execUTIL_LOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_LOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_LOCK_CONF(Signal* signal){ UtilLockConf * conf = (UtilLockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -210,7 +213,7 @@ MutexManager::execUTIL_LOCK_CONF(Signal* signal){ } void -MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ +SimulatedBlock::MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ UtilUnlockReq * req = (UtilUnlockReq*)signal->getDataPtrSend(); req->senderData = ptr.i; req->senderRef = m_block.reference(); @@ -227,7 +230,7 @@ MutexManager::unlock(Signal* signal, ActiveMutexPtr& ptr){ } void -MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ UtilUnlockRef * ref = (UtilUnlockRef*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, ref->senderData); @@ -239,7 +242,7 @@ MutexManager::execUTIL_UNLOCK_REF(Signal* signal){ } void -MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ +SimulatedBlock::MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ UtilUnlockConf * conf = (UtilUnlockConf*)signal->getDataPtr(); ActiveMutexPtr ptr; m_activeMutexes.getPtr(ptr, conf->senderData); @@ -251,8 +254,9 @@ MutexManager::execUTIL_UNLOCK_CONF(Signal* signal){ } void -Mutex::release(MutexManager& mgr, Uint32 activePtrI, Uint32 mutexId){ - MutexManager::ActiveMutexPtr ptr; +Mutex::release(SimulatedBlock::MutexManager& mgr, + Uint32 activePtrI, Uint32 mutexId){ + SimulatedBlock::MutexManager::ActiveMutexPtr ptr; ptr.i = activePtrI; mgr.getPtr(ptr); if(ptr.p->m_gsn == 0 && ptr.p->m_mutexId == mutexId){ @@ -272,7 +276,8 @@ Mutex::unlock(){ if(!m_ptr.isNull()){ m_mgr.getPtr(m_ptr); if(m_ptr.p->m_mutexId == m_mutexId){ - Callback c = { &SimulatedBlock::ignoreMutexUnlockCallback, m_ptr.i }; + SimulatedBlock::Callback c = + { &SimulatedBlock::ignoreMutexUnlockCallback, m_ptr.i }; m_ptr.p->m_callback = c; m_mgr.unlock(m_signal, m_ptr); m_ptr.setNull(); // Remove reference diff --git a/ndb/src/kernel/vm/Mutex.hpp b/ndb/src/kernel/vm/Mutex.hpp index 40e3fb56b4f..7a16046188c 100644 --- a/ndb/src/kernel/vm/Mutex.hpp +++ b/ndb/src/kernel/vm/Mutex.hpp @@ -22,63 +22,6 @@ class Mutex; -class MutexManager { - friend class Mutex; - friend class SimulatedBlock; - friend class DbUtil; -public: - MutexManager(class SimulatedBlock &); - - bool setSize(Uint32 maxNoOfActiveMutexes); - Uint32 getSize() const ; // Get maxNoOfActiveMutexes - -private: - /** - * core interface - */ - struct ActiveMutex { - Uint32 m_gsn; // state - Uint32 m_mutexId; - Uint32 m_mutexKey; - Callback m_callback; - union { - Uint32 nextPool; - Uint32 nextList; - }; - Uint32 prevList; - }; - typedef Ptr<ActiveMutex> ActiveMutexPtr; - - bool seize(ActiveMutexPtr& ptr); - void release(Uint32 activeMutexPtrI); - - void getPtr(ActiveMutexPtr& ptr); - - void create(Signal*, ActiveMutexPtr&); - void destroy(Signal*, ActiveMutexPtr&); - void lock(Signal*, ActiveMutexPtr&); - void trylock(Signal*, ActiveMutexPtr&); - void unlock(Signal*, ActiveMutexPtr&); - -private: - void execUTIL_CREATE_LOCK_REF(Signal* signal); - void execUTIL_CREATE_LOCK_CONF(Signal* signal); - void execUTIL_DESTORY_LOCK_REF(Signal* signal); - void execUTIL_DESTORY_LOCK_CONF(Signal* signal); - void execUTIL_LOCK_REF(Signal* signal); - void execUTIL_LOCK_CONF(Signal* signal); - void execUTIL_UNLOCK_REF(Signal* signal); - void execUTIL_UNLOCK_CONF(Signal* signal); - - SimulatedBlock & m_block; - ArrayPool<ActiveMutex> m_mutexPool; - DLList<ActiveMutex> m_activeMutexes; - - BlockReference reference() const; - void progError(int line, int err_code, const char* extra = 0); -}; - - /** * MutexHandle - A "reference" to a mutex * - Should be used together with Mutex @@ -89,7 +32,7 @@ public: MutexHandle(Uint32 id); bool isNull() const; - void release(MutexManager & mgr); + void release(SimulatedBlock::MutexManager & mgr); private: const Uint32 m_mutexId; @@ -106,7 +49,7 @@ public: MutexHandle2(); bool isNull() const; - void release(MutexManager & mgr); + void release(SimulatedBlock::MutexManager & mgr); private: Uint32 m_activeMutexPtrI; @@ -117,33 +60,34 @@ private: */ class Mutex { public: - Mutex(Signal*, MutexManager & mgr, MutexHandle &); + Mutex(Signal*, SimulatedBlock::MutexManager & mgr, MutexHandle &); template<Uint32 MutexId> - Mutex(Signal*, MutexManager & mgr, MutexHandle2<MutexId> &); + Mutex(Signal*, SimulatedBlock::MutexManager & mgr, MutexHandle2<MutexId> &); ~Mutex(); void release(); bool isNull() const ; - bool lock(Callback & callback); - bool trylock(Callback & callback); - void unlock(Callback & callback); + bool lock(SimulatedBlock::Callback & callback); + bool trylock(SimulatedBlock::Callback & callback); + void unlock(SimulatedBlock::Callback & callback); void unlock(); // Ignore callback - bool create(Callback & callback); - bool destroy(Callback & callback); + bool create(SimulatedBlock::Callback & callback); + bool destroy(SimulatedBlock::Callback & callback); private: Signal* m_signal; - MutexManager & m_mgr; + SimulatedBlock::MutexManager & m_mgr; const Uint32 m_mutexId; Uint32 & m_srcPtrI; - MutexManager::ActiveMutexPtr m_ptr; + SimulatedBlock::MutexManager::ActiveMutexPtr m_ptr; public: - static void release(MutexManager&, Uint32 activePtrI, Uint32 mutexId); + static void release(SimulatedBlock::MutexManager&, + Uint32 activePtrI, Uint32 mutexId); }; inline @@ -159,7 +103,7 @@ MutexHandle::isNull() const { inline void -MutexHandle::release(MutexManager & mgr){ +MutexHandle::release(SimulatedBlock::MutexManager & mgr){ if(!isNull()){ Mutex::release(mgr, m_activeMutexPtrI, m_mutexId); m_activeMutexPtrI = RNIL; @@ -183,7 +127,7 @@ MutexHandle2<MutexId>::isNull() const { template<Uint32 MutexId> inline void -MutexHandle2<MutexId>::release(MutexManager & mgr){ +MutexHandle2<MutexId>::release(SimulatedBlock::MutexManager & mgr){ if(!isNull()){ Mutex::release(mgr, m_activeMutexPtrI, MutexId); m_activeMutexPtrI = RNIL; @@ -192,7 +136,8 @@ MutexHandle2<MutexId>::release(MutexManager & mgr){ inline -Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle & mh) +Mutex::Mutex(Signal* signal, SimulatedBlock::MutexManager & mgr, + MutexHandle & mh) : m_signal(signal), m_mgr(mgr), m_mutexId(mh.m_mutexId), @@ -204,7 +149,8 @@ Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle & mh) template<Uint32 MutexId> inline -Mutex::Mutex(Signal* signal, MutexManager & mgr, MutexHandle2<MutexId> & mh) +Mutex::Mutex(Signal* signal, SimulatedBlock::MutexManager & mgr, + MutexHandle2<MutexId> & mh) : m_signal(signal), m_mgr(mgr), m_mutexId(MutexId), @@ -236,7 +182,7 @@ Mutex::isNull() const { inline bool -Mutex::lock(Callback & callback){ +Mutex::lock(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -253,7 +199,7 @@ Mutex::lock(Callback & callback){ inline bool -Mutex::trylock(Callback & callback){ +Mutex::trylock(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -270,7 +216,7 @@ Mutex::trylock(Callback & callback){ inline void -Mutex::unlock(Callback & callback){ +Mutex::unlock(SimulatedBlock::Callback & callback){ if(!m_ptr.isNull()){ m_mgr.getPtr(m_ptr); if(m_ptr.p->m_mutexId == m_mutexId){ @@ -285,7 +231,7 @@ Mutex::unlock(Callback & callback){ inline bool -Mutex::create(Callback & callback){ +Mutex::create(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; @@ -302,7 +248,7 @@ Mutex::create(Callback & callback){ inline bool -Mutex::destroy(Callback & callback){ +Mutex::destroy(SimulatedBlock::Callback & callback){ if(m_ptr.isNull()){ if(m_mgr.seize(m_ptr)){ m_ptr.p->m_mutexId = m_mutexId; diff --git a/ndb/src/kernel/vm/SectionReader.cpp b/ndb/src/kernel/vm/SectionReader.cpp index 9e1cbc855e6..dd474a49e50 100644 --- a/ndb/src/kernel/vm/SectionReader.cpp +++ b/ndb/src/kernel/vm/SectionReader.cpp @@ -26,7 +26,7 @@ #endif SectionReader::SectionReader -(class SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) +(struct SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) : m_pool(pool) { if(ptr.p == 0){ diff --git a/ndb/src/kernel/vm/SectionReader.hpp b/ndb/src/kernel/vm/SectionReader.hpp index 17eade24a66..b51006b6128 100644 --- a/ndb/src/kernel/vm/SectionReader.hpp +++ b/ndb/src/kernel/vm/SectionReader.hpp @@ -21,7 +21,7 @@ class SectionReader { public: - SectionReader(class SegmentedSectionPtr &, + SectionReader(struct SegmentedSectionPtr &, class SectionSegmentPool &); void reset(); diff --git a/ndb/src/kernel/vm/SimplePropertiesSection.cpp b/ndb/src/kernel/vm/SimplePropertiesSection.cpp index d442ff2e698..070563be36b 100644 --- a/ndb/src/kernel/vm/SimplePropertiesSection.cpp +++ b/ndb/src/kernel/vm/SimplePropertiesSection.cpp @@ -19,7 +19,7 @@ #include "LongSignal.hpp" SimplePropertiesSectionReader::SimplePropertiesSectionReader -(class SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) +(struct SegmentedSectionPtr & ptr, class SectionSegmentPool & pool) : m_pool(pool) { if(ptr.p == 0){ @@ -190,7 +190,7 @@ SimplePropertiesSectionWriter::putWords(const Uint32 * src, Uint32 len){ } void -SimplePropertiesSectionWriter::getPtr(class SegmentedSectionPtr & dst){ +SimplePropertiesSectionWriter::getPtr(struct SegmentedSectionPtr & dst){ // Set last ptr and size if(m_pos >= 0){ dst.p = m_head; diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index e6b97771d36..94fd5769406 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -1598,7 +1598,7 @@ SimulatedBlock::sendFragmentedSignal(NodeReceiverGroup rg, } } -Callback SimulatedBlock::TheEmptyCallback = {0, 0}; +SimulatedBlock::Callback SimulatedBlock::TheEmptyCallback = {0, 0}; void SimulatedBlock::sendFragmentedSignal(BlockReference ref, diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp index 7972cb39746..cff19734368 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.hpp +++ b/ndb/src/kernel/vm/SimulatedBlock.hpp @@ -41,7 +41,6 @@ #include "ArrayPool.hpp" #include "DLHashTable.hpp" #include "Callback.hpp" -#include "Mutex.hpp" #include "SafeCounter.hpp" #include "MetaData.hpp" @@ -77,7 +76,6 @@ typedef struct NewVar } NewVARIABLE; /* 128 bits */ class SimulatedBlock { - friend class MutexManager; friend class SafeCounter; friend class SafeCounterManager; friend struct UpgradeStartup; @@ -104,6 +102,14 @@ public: * */ inline void executeFunction(GlobalSignalNumber gsn, Signal* signal); +public: + typedef void (SimulatedBlock::* CallbackFunction)(class Signal*, + Uint32 callbackData, + Uint32 returnCode); + struct Callback { + CallbackFunction m_callbackFunction; + Uint32 m_callbackData; + }; protected: static Callback TheEmptyCallback; void execute(Signal* signal, Callback & c, Uint32 returnCode); @@ -405,7 +411,64 @@ private: DLList<FragmentSendInfo> c_linearFragmentSendList; DLList<FragmentSendInfo> c_segmentedFragmentSendList; -public: +public: + class MutexManager { + friend class Mutex; + friend class SimulatedBlock; + friend class DbUtil; + public: + MutexManager(class SimulatedBlock &); + + bool setSize(Uint32 maxNoOfActiveMutexes); + Uint32 getSize() const ; // Get maxNoOfActiveMutexes + + private: + /** + * core interface + */ + struct ActiveMutex { + Uint32 m_gsn; // state + Uint32 m_mutexId; + Uint32 m_mutexKey; + Callback m_callback; + union { + Uint32 nextPool; + Uint32 nextList; + }; + Uint32 prevList; + }; + typedef Ptr<ActiveMutex> ActiveMutexPtr; + + bool seize(ActiveMutexPtr& ptr); + void release(Uint32 activeMutexPtrI); + + void getPtr(ActiveMutexPtr& ptr); + + void create(Signal*, ActiveMutexPtr&); + void destroy(Signal*, ActiveMutexPtr&); + void lock(Signal*, ActiveMutexPtr&); + void trylock(Signal*, ActiveMutexPtr&); + void unlock(Signal*, ActiveMutexPtr&); + + private: + void execUTIL_CREATE_LOCK_REF(Signal* signal); + void execUTIL_CREATE_LOCK_CONF(Signal* signal); + void execUTIL_DESTORY_LOCK_REF(Signal* signal); + void execUTIL_DESTORY_LOCK_CONF(Signal* signal); + void execUTIL_LOCK_REF(Signal* signal); + void execUTIL_LOCK_CONF(Signal* signal); + void execUTIL_UNLOCK_REF(Signal* signal); + void execUTIL_UNLOCK_CONF(Signal* signal); + + SimulatedBlock & m_block; + ArrayPool<ActiveMutex> m_mutexPool; + DLList<ActiveMutex> m_activeMutexes; + + BlockReference reference() const; + void progError(int line, int err_code, const char* extra = 0); + }; + + friend class MutexManager; MutexManager c_mutexMgr; void ignoreMutexUnlockCallback(Signal* signal, Uint32 ptrI, Uint32 retVal); @@ -688,5 +751,7 @@ BLOCK::addRecSignal(GlobalSignalNumber gsn, ExecSignalLocal f, bool force){ \ addRecSignalImpl(gsn, (ExecFunction)f, force);\ } +#include "Mutex.hpp" + #endif diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp index 9111ee7949c..45543c5d174 100644 --- a/ndb/src/kernel/vm/VMSignal.hpp +++ b/ndb/src/kernel/vm/VMSignal.hpp @@ -78,10 +78,16 @@ public: #define VMS_DATA_SIZE \ (MAX_ATTRIBUTES_IN_TABLE + MAX_TUPLE_SIZE_IN_WORDS + MAX_KEY_SIZE_IN_WORDS) +#if VMS_DATA_SIZE > 8192 +#error "VMSignal buffer is too small" +#endif + SignalHeader header; // 28 bytes SegmentedSectionPtr m_sectionPtr[3]; - Uint32 theData[25+VMS_DATA_SIZE]; // 2048 32-bit words -> 8K Bytes - + union { + Uint32 theData[8192]; // 8192 32-bit words -> 32K Bytes + Uint64 dummyAlign; + }; void garbage_register(); }; diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am index d64216b56c0..2f2fb407e46 100644 --- a/ndb/src/mgmapi/Makefile.am +++ b/ndb/src/mgmapi/Makefile.am @@ -14,3 +14,17 @@ include $(top_srcdir)/ndb/config/type_util.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libmgmapi.dsp + +libmgmapi.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libmgmapi_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 9206b3e0a58..92132f12543 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -1120,7 +1120,7 @@ ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]) int port= ndb_mgm_get_connected_port(handle); SocketClient s(hostname, port); const NDB_SOCKET_TYPE sockfd = s.connect(); - if (sockfd < 0) { + if (sockfd == NDB_INVALID_SOCKET) { setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__, "Unable to connect to"); return -1; diff --git a/ndb/src/mgmapi/mgmapi_configuration.cpp b/ndb/src/mgmapi/mgmapi_configuration.cpp index ae7fe2c294c..7bac2d10b92 100644 --- a/ndb/src/mgmapi/mgmapi_configuration.cpp +++ b/ndb/src/mgmapi/mgmapi_configuration.cpp @@ -1,3 +1,4 @@ +#include <ndb_types.h> #include <mgmapi.h> #include "mgmapi_configuration.hpp" #include <new> @@ -138,7 +139,7 @@ ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator* iter, extern "C" int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator* iter, - int param, unsigned long long * value){ + int param, Uint64 * value){ return iter->get(param, value); } diff --git a/ndb/src/mgmapi/mgmapi_configuration.hpp b/ndb/src/mgmapi/mgmapi_configuration.hpp index c7feffd3a4e..9e94b3311bf 100644 --- a/ndb/src/mgmapi/mgmapi_configuration.hpp +++ b/ndb/src/mgmapi/mgmapi_configuration.hpp @@ -21,7 +21,7 @@ struct ndb_mgm_configuration_iterator { int find(int param, unsigned value); int get(int param, unsigned * value) const ; - int get(int param, unsigned long long * value) const ; + int get(int param, Uint64 * value) const ; int get(int param, const char ** value) const ; // diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am index b8f9f82e501..c63e8d1bff8 100644 --- a/ndb/src/mgmclient/Makefile.am +++ b/ndb/src/mgmclient/Makefile.am @@ -30,3 +30,29 @@ ndb_mgm_LDFLAGS = @ndb_bin_am_ldflags@ # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: ndb_mgm.dsp libndbmgmclient.dsp + +ndb_mgm.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-prg.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-prg.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(ndbtools_PROGRAMS) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(ndb_mgm_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) + +libndbmgmclient.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libndbmgmclient_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index 02bf24f1d9c..0ce24cc81d2 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -28,7 +28,7 @@ #include "ConfigInfo.hpp" #include <version.h> - +#include <m_string.h> static const char* helpTexts[] = { "HELP Print help text", @@ -497,7 +497,7 @@ void CommandInterpreter::executeClusterLog(char* parameters) { noArgs = true; } while (item != NULL) { - snprintf(name, 12, item); + BaseString::snprintf(name, 12, item); if (strcmp(item, "ALL") == 0) { severity = 7; @@ -747,9 +747,10 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters, char * tmpString = strdup(parameters); char * tmpPtr = 0; char * item = strtok_r(tmpString, " ", &tmpPtr); + int error; while(item != NULL){ - if (0x0 <= strtoll(item, NULL, 0) && strtoll(item, NULL, 0) <= 0xffffffff) { - pars[no] = strtoll(item, NULL, 0); + if (0x0 <= my_strtoll10(item, NULL, &error) && my_strtoll10(item, NULL, &error) <= 0xffffffff) { + pars[no] = my_strtoll10(item, NULL, &error); } else { ndbout << "Illegal value in argument to signal." << endl << "(Value must be between 0 and 0xffffffff.)" diff --git a/ndb/src/mgmsrv/Config.cpp b/ndb/src/mgmsrv/Config.cpp index f9c6a23f909..5ff9cbe04ad 100644 --- a/ndb/src/mgmsrv/Config.cpp +++ b/ndb/src/mgmsrv/Config.cpp @@ -53,27 +53,27 @@ Config::printAllNameValuePairs(NdbOut &out, if(!section->contains(n)) continue; - if (m_info.getStatus(section, n) == ConfigInfo::INTERNAL) + if (m_info.getStatus(section, n) == ConfigInfo::CI_INTERNAL) continue; - if (m_info.getStatus(section, n) == ConfigInfo::DEPRICATED) + if (m_info.getStatus(section, n) == ConfigInfo::CI_DEPRICATED) continue; - if (m_info.getStatus(section, n) == ConfigInfo::NOTIMPLEMENTED) + if (m_info.getStatus(section, n) == ConfigInfo::CI_NOTIMPLEMENTED) continue; out << n << ": "; switch (m_info.getType(section, n)) { - case ConfigInfo::INT: + case ConfigInfo::CI_INT: MGM_REQUIRE(prop->get(n, &int_value)); out << int_value; break; - case ConfigInfo::INT64: + case ConfigInfo::CI_INT64: MGM_REQUIRE(prop->get(n, &int_64)); out << int_64; break; - case ConfigInfo::BOOL: + case ConfigInfo::CI_BOOL: MGM_REQUIRE(prop->get(n, &int_value)); if (int_value) { out << "Y"; @@ -81,11 +81,11 @@ Config::printAllNameValuePairs(NdbOut &out, out << "N"; } break; - case ConfigInfo::STRING: + case ConfigInfo::CI_STRING: MGM_REQUIRE(prop->get(n, &str_value)); out << str_value; break; - case ConfigInfo::SECTION: + case ConfigInfo::CI_SECTION: out << "SECTION"; break; } diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index 7417bef5619..ab2e34f6d3a 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -21,6 +21,7 @@ #include <mgmapi_config_parameters.h> #include <ndb_limits.h> #include "InitConfigFileParser.hpp" +#include <m_string.h> #define MAX_LINE_LENGTH 255 #define KEY_INTERNAL 0 @@ -260,9 +261,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "COMPUTER", "COMPUTER", "Computer section", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, 0, 0, 0 }, @@ -271,9 +272,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Id", "COMPUTER", "Name of computer", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -282,9 +283,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName", "COMPUTER", "Hostname of computer (e.g. mysql.com)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -293,9 +294,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ByteOrder", "COMPUTER", 0, - ConfigInfo::DEPRICATED, + ConfigInfo::CI_DEPRICATED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -308,9 +309,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SYSTEM", "SYSTEM", "System section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)CFG_SECTION_SYSTEM, 0, 0 }, @@ -319,9 +320,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Name", "SYSTEM", "Name of system (NDB Cluster)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -330,9 +331,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ReplicationRole", "SYSTEM", "Role in Global Replication (None, Primary, or Standby)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -341,9 +342,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PrimaryMGMNode", "SYSTEM", "Node id of Primary "MGM_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -353,9 +354,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ConfigGenerationNumber", "SYSTEM", "Configuration generation number", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -368,9 +369,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { DB_TOKEN, DB_TOKEN, "Node section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)NODE_TYPE_DB, 0, 0 }, @@ -380,9 +381,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName", DB_TOKEN, "Name of computer for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -391,9 +392,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "System", DB_TOKEN, "Name of system for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -402,9 +403,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Id", DB_TOKEN, "Number identifying the database node ("DB_TOKEN_PRINT")", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "1", STR_VALUE(MAX_NODES) }, @@ -414,9 +415,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ServerPort", DB_TOKEN, "Port used to setup transporter", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, UNDEFINED, "1", STR_VALUE(MAX_INT_RNIL) }, @@ -426,9 +427,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfReplicas", DB_TOKEN, "Number of copies of all data in the database (1-4)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "1", "4" }, @@ -438,9 +439,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfAttributes", DB_TOKEN, "Total number of attributes stored in database. I.e. sum over all tables", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1000", "32", STR_VALUE(MAX_INT_RNIL) }, @@ -450,9 +451,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfTables", DB_TOKEN, "Total number of tables stored in the database", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "128", "8", STR_VALUE(MAX_INT_RNIL) }, @@ -462,9 +463,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfOrderedIndexes", DB_TOKEN, "Total number of ordered indexes that can be defined in the system", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "128", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -474,9 +475,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfUniqueHashIndexes", DB_TOKEN, "Total number of unique hash indexes that can be defined in the system", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "64", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -486,9 +487,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfIndexes", DB_TOKEN, "Total number of indexes that can be defined in the system", - ConfigInfo::DEPRICATED, + ConfigInfo::CI_DEPRICATED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "128", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -498,9 +499,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfConcurrentIndexOperations", DB_TOKEN, "Total number of index operations that can execute simultaneously on one "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "8K", "0", STR_VALUE(MAX_INT_RNIL) @@ -511,9 +512,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfTriggers", DB_TOKEN, "Total number of triggers that can be defined in the system", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "768", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -523,9 +524,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfFiredTriggers", DB_TOKEN, "Total number of triggers that can fire simultaneously in one "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "4000", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -535,9 +536,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ExecuteOnComputer", DB_TOKEN, "String referencing an earlier defined COMPUTER", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -546,9 +547,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfSavedMessages", DB_TOKEN, "Max number of error messages in error log and max number of trace files", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "25", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -558,9 +559,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LockPagesInMainMemory", DB_TOKEN, "If set to yes, then NDB Cluster data will not be swapped out to disk", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true" }, @@ -570,9 +571,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TimeBetweenWatchDogCheck", DB_TOKEN, "Time between execution checks inside a database node", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "6000", "70", STR_VALUE(MAX_INT_RNIL) }, @@ -582,9 +583,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "StopOnError", DB_TOKEN, "If set to N, "DB_TOKEN_PRINT" automatically restarts/recovers in case of node failure", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "true", "false", "true" }, @@ -594,9 +595,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "RestartOnErrorInsert", DB_TOKEN, "See src/kernel/vm/Emulator.hpp NdbRestartType for details", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "2", "0", "4" }, @@ -606,9 +607,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfConcurrentOperations", DB_TOKEN, "Max number of operation records in transaction coordinator", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "32k", "32", STR_VALUE(MAX_INT_RNIL) }, @@ -618,9 +619,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfLocalOperations", DB_TOKEN, "Max number of operation records defined in the local storage node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, UNDEFINED, "32", STR_VALUE(MAX_INT_RNIL) }, @@ -630,9 +631,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfLocalScans", DB_TOKEN, "Max number of fragment scans in parallel in the local storage node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, UNDEFINED, "32", STR_VALUE(MAX_INT_RNIL) }, @@ -642,9 +643,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BatchSizePerLocalScan", DB_TOKEN, "Used to calculate the number of lock records for scan with hold lock", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, STR_VALUE(DEF_BATCH_SIZE), "1", STR_VALUE(MAX_PARALLEL_OP_PER_SCAN) }, @@ -654,9 +655,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfConcurrentTransactions", DB_TOKEN, "Max number of transaction executing concurrently on the "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "4096", "32", STR_VALUE(MAX_INT_RNIL) }, @@ -666,9 +667,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfConcurrentScans", DB_TOKEN, "Max number of scans executing concurrently on the "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "256", "2", "500" }, @@ -678,9 +679,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TransactionBufferMemory", DB_TOKEN, "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1M", "1K", STR_VALUE(MAX_INT_RNIL) }, @@ -690,9 +691,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "IndexMemory", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing indexes", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT64, + ConfigInfo::CI_INT64, "18M", "1M", "1024G" }, @@ -702,9 +703,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "DataMemory", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing data", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT64, + ConfigInfo::CI_INT64, "80M", "1M", "1024G" }, @@ -714,9 +715,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "UndoIndexBuffer", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for index part", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "2M", "1M", STR_VALUE(MAX_INT_RNIL)}, @@ -726,9 +727,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "UndoDataBuffer", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for data part", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "16M", "1M", STR_VALUE(MAX_INT_RNIL)}, @@ -738,9 +739,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "RedoBuffer", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing REDO logs", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "8M", "1M", STR_VALUE(MAX_INT_RNIL)}, @@ -750,9 +751,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LongMessageBuffer", DB_TOKEN, "Number bytes on each "DB_TOKEN_PRINT" node allocated for internal long messages", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1M", "512k", STR_VALUE(MAX_INT_RNIL)}, @@ -762,9 +763,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "StartPartialTimeout", DB_TOKEN, "Time to wait before trying to start wo/ all nodes. 0=Wait forever", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "30000", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -774,9 +775,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "StartPartitionedTimeout", DB_TOKEN, "Time to wait before trying to start partitioned. 0=Wait forever", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "60000", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -786,9 +787,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "StartFailureTimeout", DB_TOKEN, "Time to wait before terminating. 0=Wait forever", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -798,9 +799,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HeartbeatIntervalDbDb", DB_TOKEN, "Time between "DB_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "DB_TOKEN_PRINT" considered dead after 3 missed HBs", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1500", "10", STR_VALUE(MAX_INT_RNIL) }, @@ -810,9 +811,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HeartbeatIntervalDbApi", DB_TOKEN, "Time between "API_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "API_TOKEN_PRINT" connection closed after 3 missed HBs", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1500", "100", STR_VALUE(MAX_INT_RNIL) }, @@ -822,9 +823,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TimeBetweenLocalCheckpoints", DB_TOKEN, "Time between taking snapshots of the database (expressed in 2log of bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "20", "0", "31" }, @@ -834,9 +835,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TimeBetweenGlobalCheckpoints", DB_TOKEN, "Time between doing group commit of transactions to disk", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "2000", "10", "32000" }, @@ -846,9 +847,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfFragmentLogFiles", DB_TOKEN, "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN_PRINT" node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "8", "1", STR_VALUE(MAX_INT_RNIL) }, @@ -858,9 +859,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfOpenFiles", DB_TOKEN, "Max number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "40", "20", "256" }, @@ -871,9 +872,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TimeBetweenInactiveTransactionAbortCheck", DB_TOKEN, "Time between inactive transaction checks", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1000", "1000", STR_VALUE(MAX_INT_RNIL) }, @@ -887,9 +888,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "to execute or send another part (query, statement) of the transaction.\n" "If the application takes too long time, the transaction gets aborted.\n" "Timeout set to 0 means that we don't timeout at all on application wait.", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, STR_VALUE(MAX_INT_RNIL), "0", STR_VALUE(MAX_INT_RNIL) }, @@ -902,9 +903,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "This is the time the transaction coordinator waits for each database node\n" "of the transaction to execute a request. If the database node takes too\n" "long time, the transaction gets aborted.", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1200", "50", STR_VALUE(MAX_INT_RNIL) }, @@ -914,9 +915,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfDiskPagesToDiskDuringRestartTUP", DB_TOKEN, "?", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "40", "1", STR_VALUE(MAX_INT_RNIL) }, @@ -926,9 +927,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfDiskPagesToDiskAfterRestartTUP", DB_TOKEN, "?", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "40", "1", STR_VALUE(MAX_INT_RNIL) }, @@ -938,9 +939,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfDiskPagesToDiskDuringRestartACC", DB_TOKEN, "?", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "20", "1", STR_VALUE(MAX_INT_RNIL) }, @@ -950,9 +951,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NoOfDiskPagesToDiskAfterRestartACC", DB_TOKEN, "?", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "20", "1", STR_VALUE(MAX_INT_RNIL) }, @@ -963,9 +964,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Diskless", DB_TOKEN, "Run wo/ disk", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true"}, @@ -975,9 +976,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Discless", DB_TOKEN, "Diskless", - ConfigInfo::DEPRICATED, + ConfigInfo::CI_DEPRICATED, true, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true"}, @@ -989,9 +990,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ArbitrationTimeout", DB_TOKEN, "Max time (milliseconds) database partion waits for arbitration signal", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "3000", "10", STR_VALUE(MAX_INT_RNIL) }, @@ -1001,9 +1002,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "DataDir", DB_TOKEN, "Data directory for this node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MYSQLCLUSTERDIR, 0, 0 }, @@ -1012,9 +1013,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "FileSystemPath", DB_TOKEN, "Path to directory where the "DB_TOKEN_PRINT" node stores its data (directory must exist)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1023,9 +1024,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelStartup", DB_TOKEN, "Node startup info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1", "0", "15" }, @@ -1035,9 +1036,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelShutdown", DB_TOKEN, "Node shutdown info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1047,9 +1048,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelStatistic", DB_TOKEN, "Transaction, operation, transporter info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1059,9 +1060,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelCheckpoint", DB_TOKEN, "Local and Global checkpoint info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1071,9 +1072,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelNodeRestart", DB_TOKEN, "Node restart, node failure info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1083,9 +1084,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelConnection", DB_TOKEN, "Node connect/disconnect info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1095,9 +1096,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelError", DB_TOKEN, "Transporter, heartbeat errors printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1107,9 +1108,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogLevelInfo", DB_TOKEN, "Heartbeat and log info printed on stdout", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "15" }, @@ -1122,9 +1123,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ParallelBackups", DB_TOKEN, "Maximum number of parallel backups", - ConfigInfo::NOTIMPLEMENTED, + ConfigInfo::CI_NOTIMPLEMENTED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1", "1", "1" }, @@ -1134,9 +1135,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BackupDataDir", DB_TOKEN, "Path to where to store backups", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1145,9 +1146,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BackupMemory", DB_TOKEN, "Total memory allocated for backups per node (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "4M", // sum of BackupDataBufferSize and BackupLogBufferSize "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1157,9 +1158,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BackupDataBufferSize", DB_TOKEN, "Default size of databuffer for a backup (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "2M", // remember to change BackupMemory "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1169,9 +1170,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BackupLogBufferSize", DB_TOKEN, "Default size of logbuffer for a backup (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "2M", // remember to change BackupMemory "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1181,9 +1182,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BackupWriteSize", DB_TOKEN, "Default size of filesystem writes made by backup (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "32K", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1196,9 +1197,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "REP", "REP", "Node section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)NODE_TYPE_REP, 0, 0 }, @@ -1208,9 +1209,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName", "REP", "Name of computer for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1219,9 +1220,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "System", "REP", "Name of system for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1230,9 +1231,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Id", "REP", "Number identifying replication node (REP)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "1", STR_VALUE(MAX_NODES) }, @@ -1242,9 +1243,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ExecuteOnComputer", "REP", "String referencing an earlier defined COMPUTER", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -1253,9 +1254,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HeartbeatIntervalRepRep", "REP", "Time between REP-REP heartbeats. Connection closed after 3 missed HBs", - ConfigInfo::USED, + ConfigInfo::CI_USED, true, - ConfigInfo::INT, + ConfigInfo::CI_INT, "3000", "100", STR_VALUE(MAX_INT_RNIL) }, @@ -1268,9 +1269,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { API_TOKEN, API_TOKEN, "Node section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)NODE_TYPE_API, 0, 0 }, @@ -1280,9 +1281,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName", API_TOKEN, "Name of computer for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1291,9 +1292,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "System", API_TOKEN, "Name of system for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1302,9 +1303,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Id", API_TOKEN, "Number identifying application node ("API_TOKEN_PRINT")", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "1", STR_VALUE(MAX_NODES) }, @@ -1314,9 +1315,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ExecuteOnComputer", API_TOKEN, "String referencing an earlier defined COMPUTER", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1325,9 +1326,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ArbitrationRank", API_TOKEN, "If 0, then "API_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", "2" }, @@ -1337,9 +1338,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ArbitrationDelay", API_TOKEN, "When asked to arbitrate, arbitrator waits this long before voting (msec)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1349,9 +1350,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxScanBatchSize", "API", "The maximum collective batch size for one scan", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, STR_VALUE(MAX_SCAN_BATCH_SIZE), "32k", "16M" }, @@ -1361,9 +1362,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BatchByteSize", "API", "The default batch size in bytes", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, STR_VALUE(SCAN_BATCH_SIZE), "1k", "1M" }, @@ -1373,9 +1374,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "BatchSize", "API", "The default batch size in number of records", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, STR_VALUE(DEF_BATCH_SIZE), "1", STR_VALUE(MAX_PARALLEL_OP_PER_SCAN) }, @@ -1388,9 +1389,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { MGM_TOKEN, MGM_TOKEN, "Node section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)NODE_TYPE_MGM, 0, 0 }, @@ -1400,9 +1401,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName", MGM_TOKEN, "Name of computer for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1411,9 +1412,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "DataDir", MGM_TOKEN, "Data directory for this node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MYSQLCLUSTERDIR, 0, 0 }, @@ -1422,9 +1423,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "System", MGM_TOKEN, "Name of system for this node", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1433,9 +1434,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Id", MGM_TOKEN, "Number identifying the management server node ("MGM_TOKEN_PRINT")", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "1", STR_VALUE(MAX_NODES) }, @@ -1445,9 +1446,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "LogDestination", MGM_TOKEN, "String describing where logmessages are sent", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, 0, 0, 0 }, @@ -1456,9 +1457,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ExecuteOnComputer", MGM_TOKEN, "String referencing an earlier defined COMPUTER", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, 0, 0, 0 }, @@ -1467,9 +1468,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "MaxNoOfSavedEvents", MGM_TOKEN, "", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "100", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1479,9 +1480,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PortNumber", MGM_TOKEN, "Port number to give commands to/fetch configurations from management server", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, NDB_PORT, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1491,9 +1492,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PortNumberStats", MGM_TOKEN, "Port number used to get statistical information from a management server", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, UNDEFINED, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1503,9 +1504,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ArbitrationRank", MGM_TOKEN, "If 0, then "MGM_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1", "0", "2" }, @@ -1515,9 +1516,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ArbitrationDelay", MGM_TOKEN, "", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1530,9 +1531,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "TCP", "TCP", "Connection section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)CONNECTION_TYPE_TCP, 0, 0 }, @@ -1542,9 +1543,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName1", "TCP", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1553,9 +1554,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName2", "TCP", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1564,9 +1565,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1", "TCP", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -1575,9 +1576,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2", "TCP", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -1586,9 +1587,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendSignalId", "TCP", "Sends id in each signal. Used in trace files.", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "true", "false", "true" }, @@ -1599,9 +1600,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Checksum", "TCP", "If checksum is enabled, all signals between nodes are checked for errors", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true" }, @@ -1611,9 +1612,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PortNumber", "TCP", "Port used for this transporter", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1623,9 +1624,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendBufferMemory", "TCP", "Bytes of buffer for signals sent from this node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "256K", "16K", STR_VALUE(MAX_INT_RNIL) }, @@ -1635,9 +1636,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ReceiveBufferMemory", "TCP", "Bytes of buffer for signals received by this node", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "64K", "16K", STR_VALUE(MAX_INT_RNIL) }, @@ -1647,9 +1648,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Proxy", "TCP", "", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1658,9 +1659,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1_System", "TCP", "System for node 1 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1669,9 +1670,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2_System", "TCP", "System for node 2 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1684,9 +1685,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SHM", "SHM", "Connection section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)CONNECTION_TYPE_SHM, 0, 0 }, @@ -1695,9 +1696,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName1", "SHM", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1706,9 +1707,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName2", "SHM", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1717,9 +1718,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PortNumber", "SHM", "Port used for this transporter", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1729,9 +1730,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1", "SHM", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -1740,9 +1741,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2", "SHM", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, 0, 0 }, @@ -1751,9 +1752,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendSignalId", "SHM", "Sends id in each signal. Used in trace files.", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true" }, @@ -1764,9 +1765,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Checksum", "SHM", "If checksum is enabled, all signals between nodes are checked for errors", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "true", "false", "true" }, @@ -1776,9 +1777,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ShmKey", "SHM", "A shared memory key", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1788,9 +1789,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ShmSize", "SHM", "Size of shared memory segment", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1M", "4K", STR_VALUE(MAX_INT_RNIL) }, @@ -1800,9 +1801,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1_System", "SHM", "System for node 1 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1811,9 +1812,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2_System", "SHM", "System for node 2 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1825,9 +1826,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SCI", "SCI", "Connection section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)CONNECTION_TYPE_SCI, 0, 0 }, @@ -1837,9 +1838,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1", "SCI", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1849,9 +1850,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2", "SCI", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1861,9 +1862,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName1", "SCI", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1872,9 +1873,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName2", "SCI", "Name/IP of computer on one side of the connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -1883,9 +1884,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PortNumber", "SCI", "Port used for this transporter", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1895,9 +1896,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Host1SciId0", "SCI", "SCI-node id for adapter 0 on Host1 (a computer can have two adapters)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1907,9 +1908,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Host1SciId1", "SCI", "SCI-node id for adapter 1 on Host1 (a computer can have two adapters)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1919,9 +1920,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Host2SciId0", "SCI", "SCI-node id for adapter 0 on Host2 (a computer can have two adapters)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1931,9 +1932,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Host2SciId1", "SCI", "SCI-node id for adapter 1 on Host2 (a computer can have two adapters)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1943,9 +1944,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendSignalId", "SCI", "Sends id in each signal. Used in trace files.", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "true", "false", "true" }, @@ -1955,9 +1956,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Checksum", "SCI", "If checksum is enabled, all signals between nodes are checked for errors", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true" }, @@ -1967,9 +1968,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendLimit", "SCI", "Transporter send buffer contents are sent when this no of bytes is buffered", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "8K", "128", "32K" }, @@ -1979,9 +1980,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SharedBufferSize", "SCI", "Size of shared memory segment", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1M", "64K", STR_VALUE(MAX_INT_RNIL) }, @@ -1991,9 +1992,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1_System", "SCI", "System for node 1 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -2002,9 +2003,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2_System", "SCI", "System for node 2 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -2016,9 +2017,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "OSE", "OSE", "Connection section", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::SECTION, + ConfigInfo::CI_SECTION, (const char *)CONNECTION_TYPE_OSE, 0, 0 }, @@ -2028,9 +2029,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName1", "OSE", "Name of computer on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -2039,9 +2040,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "HostName2", "OSE", "Name of computer on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -2050,9 +2051,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1", "OSE", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, MANDATORY, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -2062,9 +2063,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2", "OSE", "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, UNDEFINED, "0", STR_VALUE(MAX_INT_RNIL) }, @@ -2074,9 +2075,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "SendSignalId", "OSE", "Sends id in each signal. Used in trace files.", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "true", "false", "true" }, @@ -2086,9 +2087,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "Checksum", "OSE", "If checksum is enabled, all signals between nodes are checked for errors", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::BOOL, + ConfigInfo::CI_BOOL, "false", "false", "true" }, @@ -2098,9 +2099,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PrioASignalSize", "OSE", "Size of priority A signals (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1000", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -2110,9 +2111,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "PrioBSignalSize", "OSE", "Size of priority B signals (in bytes)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "1000", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -2122,9 +2123,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "ReceiveArraySize", "OSE", "Number of OSE signals checked for correct ordering (in no of OSE signals)", - ConfigInfo::USED, + ConfigInfo::CI_USED, false, - ConfigInfo::INT, + ConfigInfo::CI_INT, "10", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -2134,9 +2135,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId1_System", "OSE", "System for node 1 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, @@ -2145,9 +2146,9 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "NodeId2_System", "OSE", "System for node 2 in connection", - ConfigInfo::INTERNAL, + ConfigInfo::CI_INTERNAL, false, - ConfigInfo::STRING, + ConfigInfo::CI_STRING, UNDEFINED, 0, 0 }, }; @@ -2195,7 +2196,7 @@ ConfigInfo::ConfigInfo() } switch (param._type) { - case BOOL: + case CI_BOOL: { bool tmp_bool; require(InitConfigFileParser::convertStringToBool(param._min, tmp_bool)); @@ -2204,8 +2205,8 @@ ConfigInfo::ConfigInfo() pinfo.put64("Max", tmp_bool); break; } - case INT: - case INT64: + case CI_INT: + case CI_INT64: { Uint64 tmp_uint64; require(InitConfigFileParser::convertStringToUint64(param._min, tmp_uint64)); @@ -2214,10 +2215,10 @@ ConfigInfo::ConfigInfo() pinfo.put64("Max", tmp_uint64); break; } - case SECTION: + case CI_SECTION: pinfo.put("SectionType", (Uint32)UintPtr(param._default)); break; - case STRING: + case CI_STRING: break; } @@ -2235,7 +2236,7 @@ ConfigInfo::ConfigInfo() // Replace section with modified section m_info.put(param._section, section, true); - if(param._type != ConfigInfo::SECTION){ + if(param._type != ConfigInfo::CI_SECTION){ Properties * p; if(!m_systemDefaults.getCopy(param._section, &p)){ p = new Properties(true); @@ -2244,20 +2245,20 @@ ConfigInfo::ConfigInfo() param._default != MANDATORY){ switch (param._type) { - case SECTION: + case CI_SECTION: break; - case STRING: + case CI_STRING: require(p->put(param._fname, param._default)); break; - case BOOL: + case CI_BOOL: { bool tmp_bool; require(InitConfigFileParser::convertStringToBool(param._default, default_bool)); require(p->put(param._fname, default_bool)); break; } - case INT: - case INT64: + case CI_INT: + case CI_INT64: { Uint64 tmp_uint64; require(InitConfigFileParser::convertStringToUint64(param._default, default_uint64)); @@ -2279,7 +2280,7 @@ ConfigInfo::ConfigInfo() exit(-1); } - if(m_ParamInfo[i]._type == ConfigInfo::SECTION) + if(m_ParamInfo[i]._type == ConfigInfo::CI_SECTION) continue; const Properties * p = getInfo(m_ParamInfo[i]._section); @@ -2439,9 +2440,9 @@ void ConfigInfo::print(const char* section) const { Properties::Iterator it(sec); for (const char* n = it.first(); n != NULL; n = it.next()) { // Skip entries with different F- and P-names - if (getStatus(sec, n) == ConfigInfo::INTERNAL) continue; - if (getStatus(sec, n) == ConfigInfo::DEPRICATED) continue; - if (getStatus(sec, n) == ConfigInfo::NOTIMPLEMENTED) continue; + if (getStatus(sec, n) == ConfigInfo::CI_INTERNAL) continue; + if (getStatus(sec, n) == ConfigInfo::CI_DEPRICATED) continue; + if (getStatus(sec, n) == ConfigInfo::CI_NOTIMPLEMENTED) continue; print(sec, n); } } @@ -2451,7 +2452,7 @@ void ConfigInfo::print(const Properties * section, ndbout << parameter; // ndbout << getDescription(section, parameter) << endl; switch (getType(section, parameter)) { - case ConfigInfo::BOOL: + case ConfigInfo::CI_BOOL: ndbout << " (Boolean value)" << endl; ndbout << getDescription(section, parameter) << endl; if (getDefault(section, parameter) == false) { @@ -2466,8 +2467,8 @@ void ConfigInfo::print(const Properties * section, ndbout << endl; break; - case ConfigInfo::INT: - case ConfigInfo::INT64: + case ConfigInfo::CI_INT: + case ConfigInfo::CI_INT64: ndbout << " (Non-negative Integer)" << endl; ndbout << getDescription(section, parameter) << endl; if (getDefault(section, parameter) == (UintPtr)MANDATORY) { @@ -2482,7 +2483,7 @@ void ConfigInfo::print(const Properties * section, ndbout << endl; break; - case ConfigInfo::STRING: + case ConfigInfo::CI_STRING: ndbout << " (String)" << endl; ndbout << getDescription(section, parameter) << endl; if (getDefault(section, parameter) == (UintPtr)MANDATORY) { @@ -2492,7 +2493,7 @@ void ConfigInfo::print(const Properties * section, } ndbout << endl; break; - case ConfigInfo::SECTION: + case ConfigInfo::CI_SECTION: break; } } @@ -2772,26 +2773,26 @@ applyDefaultValues(InitConfigFileParser::Context & ctx, ConfigInfo::Status st = ctx.m_info->getStatus(ctx.m_currentInfo, name); if(!ctx.m_currentSection->contains(name)){ switch (ctx.m_info->getType(ctx.m_currentInfo, name)){ - case ConfigInfo::INT: - case ConfigInfo::BOOL:{ + case ConfigInfo::CI_INT: + case ConfigInfo::CI_BOOL:{ Uint32 val = 0; ::require(defaults->get(name, &val)); ctx.m_currentSection->put(name, val); break; } - case ConfigInfo::INT64:{ + case ConfigInfo::CI_INT64:{ Uint64 val = 0; ::require(defaults->get(name, &val)); ctx.m_currentSection->put64(name, val); break; } - case ConfigInfo::STRING:{ + case ConfigInfo::CI_STRING:{ const char * val; ::require(defaults->get(name, &val)); ctx.m_currentSection->put(name, val); break; } - case ConfigInfo::SECTION: + case ConfigInfo::CI_SECTION: break; } } @@ -3042,7 +3043,7 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) && !ctx.m_systemDefaults->get("PortNumber", &base)) { - base= strtoll(NDB_BASE_PORT,0,0); + base= strtoll(NDB_TCP_BASE_PORT,0,0); // ctx.reportError("Cannot retrieve base port number"); // return false; } @@ -3214,7 +3215,7 @@ transform(InitConfigFileParser::Context & ctx, require(ctx.m_currentSection->getTypeOf(oldName, &oldType)); ConfigInfo::Type newType = ctx.m_info->getType(ctx.m_currentInfo, newName); if(!((oldType == PropertiesType_Uint32 || oldType == PropertiesType_Uint64) - && (newType == ConfigInfo::INT || newType == ConfigInfo::INT64 || newType == ConfigInfo::BOOL))){ + && (newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_INT64 || newType == ConfigInfo::CI_BOOL))){ ndbout << "oldType: " << (int)oldType << ", newType: " << (int)newType << endl; ctx.reportError("Unable to handle type conversion w.r.t deprication %s %s" "- [%s] starting at line: %d", @@ -3225,7 +3226,7 @@ transform(InitConfigFileParser::Context & ctx, Uint64 oldVal; require(ctx.m_currentSection->get(oldName, &oldVal)); - Uint64 newVal = (Uint64)(oldVal * mul + add); + Uint64 newVal = (Uint64)((Int64)oldVal * mul + add); if(!ctx.m_info->verify(ctx.m_currentInfo, newName, newVal)){ ctx.reportError("Unable to handle deprication, new value not within bounds" "%s %s - [%s] starting at line: %d", @@ -3234,9 +3235,9 @@ transform(InitConfigFileParser::Context & ctx, return false; } - if(newType == ConfigInfo::INT || newType == ConfigInfo::BOOL){ + if(newType == ConfigInfo::CI_INT || newType == ConfigInfo::CI_BOOL){ require(dst.put(newName, (Uint32)newVal)); - } else if(newType == ConfigInfo::INT64) { + } else if(newType == ConfigInfo::CI_INT64) { require(dst.put64(newName, newVal)); } return true; @@ -3318,7 +3319,7 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ require(sec->get("Status", &status)); require(sec->get("SectionType", &typeVal)); - if(id == KEY_INTERNAL || status == ConfigInfo::INTERNAL){ + if(id == KEY_INTERNAL || status == ConfigInfo::CI_INTERNAL){ ndbout_c("skipping section %s", ctx.fname); break; } @@ -3491,7 +3492,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, #if 0 Properties * props= ctx.m_config; Properties computers(true); - Uint32 port_base = NDB_BASE_PORT; + Uint32 port_base = NDB_TCP_BASE_PORT; Uint32 nNodes; ctx.m_userProperties.get("NoOfNodes", &nNodes); diff --git a/ndb/src/mgmsrv/ConfigInfo.hpp b/ndb/src/mgmsrv/ConfigInfo.hpp index 512505cbd30..dff8b34bf4a 100644 --- a/ndb/src/mgmsrv/ConfigInfo.hpp +++ b/ndb/src/mgmsrv/ConfigInfo.hpp @@ -38,11 +38,11 @@ static const char* UNDEFINED = 0; // Default value for undefined */ class ConfigInfo { public: - enum Type { BOOL, INT, INT64, STRING, SECTION }; - enum Status { USED, ///< Active - DEPRICATED, ///< Can be, but shouldn't - NOTIMPLEMENTED, ///< Is ignored. - INTERNAL ///< Not configurable by the user + enum Type { CI_BOOL, CI_INT, CI_INT64, CI_STRING, CI_SECTION }; + enum Status { CI_USED, ///< Active + CI_DEPRICATED, ///< Can be, but shouldn't + CI_NOTIMPLEMENTED, ///< Is ignored. + CI_INTERNAL ///< Not configurable by the user }; /** diff --git a/ndb/src/mgmsrv/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp index 05102255eaa..5cc5c3e9b32 100644 --- a/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -21,6 +21,7 @@ #include "MgmtErrorReporter.hpp" #include <NdbOut.hpp> #include "ConfigInfo.hpp" +#include <m_string.h> const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file static void trim(char *); @@ -253,10 +254,10 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) return false; } ConfigInfo::Status status = m_info->getStatus(ctx.m_currentInfo, fname); - if (status == ConfigInfo::NOTIMPLEMENTED) { + if (status == ConfigInfo::CI_NOTIMPLEMENTED) { ctx.reportWarning("[%s] %s not yet implemented", ctx.fname, fname); } - if (status == ConfigInfo::DEPRICATED) { + if (status == ConfigInfo::CI_DEPRICATED) { const char * desc = m_info->getDescription(ctx.m_currentInfo, fname); if(desc){ ctx.reportWarning("[%s] %s is depricated, use %s instead", @@ -296,7 +297,7 @@ InitConfigFileParser::storeNameValuePair(Context& ctx, const ConfigInfo::Type type = m_info->getType(ctx.m_currentInfo, fname); switch(type){ - case ConfigInfo::BOOL: { + case ConfigInfo::CI_BOOL: { bool value_bool; if (!convertStringToBool(value, value_bool)) { ctx.reportError("Illegal boolean value for parameter %s", fname); @@ -305,8 +306,8 @@ InitConfigFileParser::storeNameValuePair(Context& ctx, MGM_REQUIRE(ctx.m_currentSection->put(pname, value_bool)); break; } - case ConfigInfo::INT: - case ConfigInfo::INT64:{ + case ConfigInfo::CI_INT: + case ConfigInfo::CI_INT64:{ Uint64 value_int; if (!convertStringToUint64(value, value_int)) { ctx.reportError("Illegal integer value for parameter %s", fname); @@ -319,17 +320,17 @@ InitConfigFileParser::storeNameValuePair(Context& ctx, m_info->getMax(ctx.m_currentInfo, fname)); return false; } - if(type == ConfigInfo::INT){ + if(type == ConfigInfo::CI_INT){ MGM_REQUIRE(ctx.m_currentSection->put(pname, (Uint32)value_int)); } else { MGM_REQUIRE(ctx.m_currentSection->put64(pname, value_int)); } break; } - case ConfigInfo::STRING: + case ConfigInfo::CI_STRING: MGM_REQUIRE(ctx.m_currentSection->put(pname, value)); break; - case ConfigInfo::SECTION: + case ConfigInfo::CI_SECTION: abort(); } return true; @@ -365,7 +366,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s, errno = 0; char* p; - long long v = strtoll(s, &p, log10base); + Int64 v = strtoll(s, &p, log10base); if (errno != 0) return false; diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index ee5220ef9f8..50e0b6023ad 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -32,9 +32,7 @@ LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \ DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ - -DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \ - -DNDB_PORT="\"@ndb_port@\"" \ - -DNDB_BASE_PORT="\"@ndb_port_base@\"" + -DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am @@ -43,3 +41,17 @@ ndb_mgmd_LDFLAGS = @ndb_bin_am_ldflags@ # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: ndb_mgmd.dsp + +ndb_mgmd.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-prg.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-prg.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(ndbbin_PROGRAMS) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(ndb_mgmd_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index c74dcc54037..bcb5866e835 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -54,6 +54,7 @@ #include <mgmapi.h> #include <mgmapi_configuration.hpp> #include <mgmapi_config_parameters.h> +#include <m_string.h> //#define MGM_SRV_DEBUG #ifdef MGM_SRV_DEBUG @@ -125,7 +126,7 @@ MgmtSrvr::signalRecvThreadRun() while(!_isStopThread) { SigMatch *handler = NULL; NdbApiSignal *signal = NULL; - if(m_signalRecvQueue.waitFor(siglist, handler, signal, DEFAULT_TIMEOUT)) { + if(m_signalRecvQueue.waitFor(siglist, &handler, &signal, DEFAULT_TIMEOUT)) { if(handler->function != 0) (this->*handler->function)(signal); } @@ -547,7 +548,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server, { MgmStatService::StatListener se; - se.m_socket = -1; + se.m_socket = NDB_INVALID_SOCKET; for(size_t t = 0; t<LogLevel::LOGLEVEL_CATEGORIES; t++){ se.m_logLevel.setLogLevel((LogLevel::EventCategory)t, 7); } @@ -2672,7 +2673,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, int p_type; unsigned val_32; - unsigned long long val_64; + Uint64 val_64; const char * val_char; do { p_type = 0; @@ -2788,7 +2789,7 @@ MgmtSrvr::setConnectionDbParameter(int node1, template class Vector<SigMatch>; #if __SUNPRO_CC != 0x560 -template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch*&, NdbApiSignal*&, unsigned); +template bool SignalQueue::waitFor<SigMatch>(Vector<SigMatch>&, SigMatch**, NdbApiSignal**, unsigned); #endif template class MutexVector<unsigned short>; diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 5978ca76fd2..ae2be487b57 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -664,7 +664,7 @@ private: */ static void signalReceivedNotification(void* mgmtSrvr, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); + struct LinearSectionPtr ptr[3]); /** * Called from "outside" of MgmtSrvr when a DB process has died. diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 199f28308f2..ad8cebd434f 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -29,7 +29,7 @@ #include <ConfigValues.hpp> #include <mgmapi_configuration.hpp> - +#include <Vector.hpp> #include "Services.hpp" extern bool g_StopServer; @@ -291,8 +291,8 @@ MgmApiSession::runSession() { /* Backwards compatibility for old NDBs that still use * the old "GET CONFIG" command. */ - - for(size_t i=0; i<strlen(ctx.m_currentToken); i++) + size_t i; + for(i=0; i<strlen(ctx.m_currentToken); i++) ctx.m_currentToken[i] = toupper(ctx.m_currentToken[i]); if(strncmp("GET CONFIG ", @@ -1277,7 +1277,7 @@ MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){ m_clients.lock(); for(i = m_clients.size() - 1; i >= 0; i--){ if(threshold <= m_clients[i].m_logLevel.getLogLevel(cat)){ - if(m_clients[i].m_socket >= 0 && + if(m_clients[i].m_socket != NDB_INVALID_SOCKET && println_socket(m_clients[i].m_socket, MAX_WRITE_TIMEOUT, m_text) == -1){ copy.push_back(m_clients[i].m_socket); @@ -1327,7 +1327,7 @@ MgmStatService::add_listener(const StatListener& client){ void MgmStatService::stopSessions(){ for(int i = m_clients.size() - 1; i >= 0; i--){ - if(m_clients[i].m_socket >= 0){ + if(m_clients[i].m_socket != NDB_INVALID_SOCKET){ NDB_CLOSE_SOCKET(m_clients[i].m_socket); m_clients.erase(i); } @@ -1436,7 +1436,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx, m_mgmsrv.m_statisticsListner.add_listener(le); m_stop = true; - m_socket = -1; + m_socket = NDB_INVALID_SOCKET; done: m_output->println("listen event"); diff --git a/ndb/src/mgmsrv/Services.hpp b/ndb/src/mgmsrv/Services.hpp index 6e1e887cf38..bea869d6540 100644 --- a/ndb/src/mgmsrv/Services.hpp +++ b/ndb/src/mgmsrv/Services.hpp @@ -110,7 +110,7 @@ public: m_mgmsrv = mgmsrv; } - MgmApiSession * newSession(NDB_SOCKET_TYPE socket){ + SocketServer::Session * newSession(NDB_SOCKET_TYPE socket){ return new MgmApiSession(* m_mgmsrv, socket); } }; diff --git a/ndb/src/mgmsrv/SignalQueue.hpp b/ndb/src/mgmsrv/SignalQueue.hpp index 76acaf2289a..bacbad53415 100644 --- a/ndb/src/mgmsrv/SignalQueue.hpp +++ b/ndb/src/mgmsrv/SignalQueue.hpp @@ -47,8 +47,8 @@ public: NodeId nodeid = 0, Uint32 timeout = DEFAULT_TIMEOUT); template<class T> bool waitFor(Vector<T> &t, - T *&handler, - NdbApiSignal *&signal, + T **handler, + NdbApiSignal **signal, Uint32 timeout = DEFAULT_TIMEOUT); private: NdbMutex *m_mutex; /* Locks all data in SignalQueue */ @@ -75,8 +75,8 @@ private: template<class T> bool SignalQueue::waitFor(Vector<T> &t, - T *&handler, - NdbApiSignal *&signal, + T **handler, + NdbApiSignal **signal, Uint32 timeout) { Guard g(m_mutex); @@ -88,8 +88,8 @@ SignalQueue::waitFor(Vector<T> &t, for(size_t i = 0; i < t.size(); i++) { if(t[i].check(m_signalQueueHead->signal)) { - handler = &t[i]; - signal = pop(); + * handler = &t[i]; + * signal = pop(); return true; } } diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index 64a2cb35c1f..50f60d793cd 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -200,7 +200,7 @@ int main(int argc, char** argv) if (glob.mgmObject->init()) goto error_end; - chdir(NdbConfig_get_path(0)); + my_setwd(NdbConfig_get_path(0), MYF(0)); glob.localNodeId= glob.mgmObject->getOwnNodeId(); if (glob.localNodeId == 0) { @@ -261,7 +261,9 @@ int main(int argc, char** argv) } } +#ifndef NDB_WIN32 signal(SIGPIPE, SIG_IGN); +#endif { BaseString error_string; if(!glob.mgmObject->start(error_string)){ diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am index 57552cd6ce1..9044812beec 100644 --- a/ndb/src/ndbapi/Makefile.am +++ b/ndb/src/ndbapi/Makefile.am @@ -46,3 +46,17 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am # Don't update the files from bitkeeper %::SCCS/s.% + +windoze-dsp: libndbapi.dsp + +libndbapi.dsp: Makefile \ + $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-name \ + $(top_srcdir)/ndb/config/win-includes \ + $(top_srcdir)/ndb/config/win-sources \ + $(top_srcdir)/ndb/config/win-libraries + cat $(top_srcdir)/ndb/config/win-lib.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) + @$(top_srcdir)/ndb/config/win-sources $@ $(libndbapi_la_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 75ae539fc8b..06aa7365179 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -22,7 +22,7 @@ Name: Ndb.cpp ******************************************************************************/ #include <ndb_global.h> -#include <pthread.h> + #include "NdbApiSignal.hpp" #include "NdbImpl.hpp" diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp index b75af260105..0a1433c71f3 100644 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ b/ndb/src/ndbapi/NdbBlob.cpp @@ -975,7 +975,7 @@ NdbBlob::deletePartsUnknown(Uint32 part) setErrorCode(tOp); return -1; } - tOp->m_abortOption = IgnoreError; + tOp->m_abortOption = AO_IgnoreError; n++; } DBG("deletePartsUnknown: executeNoBlobs [in] bat=" << bat); @@ -1223,7 +1223,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) return -1; } if (isWriteOp()) { - tOp->m_abortOption = IgnoreError; + tOp->m_abortOption = AO_IgnoreError; } theHeadInlineReadOp = tOp; // execute immediately @@ -1269,7 +1269,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) return -1; } if (isWriteOp()) { - tOp->m_abortOption = IgnoreError; + tOp->m_abortOption = AO_IgnoreError; } theHeadInlineReadOp = tOp; // execute immediately diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp index f809647a725..3c1657b892e 100644 --- a/ndb/src/ndbapi/NdbConnection.cpp +++ b/ndb/src/ndbapi/NdbConnection.cpp @@ -1601,7 +1601,7 @@ from other transactions. (theLastExecOpInList->theCommitIndicator == 1)){ - if (m_abortOption == IgnoreError && theError.code != 0){ + if (m_abortOption == AO_IgnoreError && theError.code != 0){ /** * There's always a TCKEYCONF when using IgnoreError */ @@ -1852,7 +1852,7 @@ NdbConnection::OpCompleteFailure(Uint8 abortOption, bool setFailure) //decide the success of the whole transaction since a simple //operation is not really part of that transaction. //------------------------------------------------------------------------ - if (abortOption == IgnoreError){ + if (abortOption == AO_IgnoreError){ /** * There's always a TCKEYCONF when using IgnoreError */ diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 84006ae399e..d677301468b 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1724,7 +1724,7 @@ NdbDictionaryImpl::dropTable(const char * name) DBUG_PRINT("enter",("name: %s", name)); NdbTableImpl * tab = getTable(name); if(tab == 0){ - return -1; + DBUG_RETURN(-1); } int ret = dropTable(* tab); // If table stored in cache is incompatible with the one in the kernel diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index 3ea20e2af16..2820ec3d642 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -317,7 +317,7 @@ private: friend class Ndb; static void execSignal(void* dictImpl, class NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); + struct LinearSectionPtr ptr[3]); static void execNodeStatus(void* dictImpl, Uint32, bool alive, bool nfCompleted); diff --git a/ndb/src/ndbapi/NdbImpl.hpp b/ndb/src/ndbapi/NdbImpl.hpp index 1fb1969b589..baac0ee2846 100644 --- a/ndb/src/ndbapi/NdbImpl.hpp +++ b/ndb/src/ndbapi/NdbImpl.hpp @@ -107,7 +107,7 @@ Uint32 convertEndian(Uint32 Data); enum WaitSignalType { NO_WAIT = 0, WAIT_NODE_FAILURE = 1, // Node failure during wait - WAIT_TIMEOUT = 2, // Timeout during wait + WST_WAIT_TIMEOUT = 2, // Timeout during wait WAIT_TC_SEIZE = 3, WAIT_TC_RELEASE = 4, @@ -146,7 +146,7 @@ NdbWaiter::wait(int waitTime) NdbCondition_Wait(m_condition, (NdbMutex*)m_mutex); } else { if (waitTime <= 0) { - m_state = WAIT_TIMEOUT; + m_state = WST_WAIT_TIMEOUT; break; } NdbCondition_WaitTimeout(m_condition, (NdbMutex*)m_mutex, waitTime); diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp index 9258ce618e8..738977a0920 100644 --- a/ndb/src/ndbapi/NdbOperationExec.cpp +++ b/ndb/src/ndbapi/NdbOperationExec.cpp @@ -199,7 +199,7 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId) tcKeyReq->setKeyLength(tReqInfo, tTupKeyLen); // A simple read is always ignore error - abortOption = tSimpleIndicator ? IgnoreError : abortOption; + abortOption = tSimpleIndicator ? AO_IgnoreError : abortOption; tcKeyReq->setAbortOption(tReqInfo, abortOption); Uint8 tDistrKeyIndicator = theDistrKeyIndicator_; @@ -542,7 +542,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) theStatus = Finished; // blobs want this - if (m_abortOption != IgnoreError) + if (m_abortOption != AO_IgnoreError) { theNdbCon->theReturnStatus = NdbConnection::ReturnFailure; } @@ -550,7 +550,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao); if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read - return theNdbCon->OpCompleteFailure(ao, m_abortOption != IgnoreError); + return theNdbCon->OpCompleteFailure(ao, m_abortOption != AO_IgnoreError); /** * If TCKEYCONF has arrived diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index b8b89278548..ccc2278e049 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -116,7 +116,7 @@ NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, Uint32 batch, Uint32 parallel) { - m_ordered = 0; + m_ordered = m_descending = false; Uint32 fragCount = m_currentTable->m_fragmentCount; if (parallel > fragCount || parallel == 0) { @@ -1191,9 +1191,10 @@ NdbIndexScanOperation::readTuples(LockMode lm, Uint32 batch, Uint32 parallel, bool order_by, + bool order_desc, bool read_range_no){ int res = NdbScanOperation::readTuples(lm, batch, 0); - if(read_range_no) + if(!res && read_range_no) { m_read_range_no = 1; Uint32 word = 0; @@ -1202,7 +1203,12 @@ NdbIndexScanOperation::readTuples(LockMode lm, res = -1; } if(!res && order_by){ - m_ordered = 1; + m_ordered = true; + if (order_desc) { + m_descending = true; + ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend()); + ScanTabReq::setDescendingFlag(req->requestInfo, true); + } Uint32 cnt = m_accessTable->getNoOfColumns() - 1; m_sort_columns = cnt; // -1 for NDB$NODE m_current_api_receiver = m_sent_receivers_count; @@ -1266,12 +1272,14 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols, r1 = (skip ? r1->next() : r1); r2 = (skip ? r2->next() : r2); + const int jdir = 1 - 2 * (int)m_descending; + assert(jdir == 1 || jdir == -1); while(cols > 0){ Uint32 * d1 = (Uint32*)r1->aRef(); Uint32 * d2 = (Uint32*)r2->aRef(); unsigned r1_null = r1->isNULL(); if((r1_null ^ (unsigned)r2->isNULL())){ - return (r1_null ? -1 : 1); + return (r1_null ? -1 : 1) * jdir; } const NdbColumnImpl & col = NdbColumnImpl::getImpl(* r1->m_column); Uint32 len = r1->theAttrSize * r1->theArraySize; @@ -1280,7 +1288,7 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols, int r = (*sqlType.m_cmp)(col.m_cs, d1, len, d2, len, true); if(r){ assert(r != NdbSqlUtil::CmpUnknown); - return r; + return r * jdir; } } cols--; diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp index 12bede3aa3f..21407279f0b 100644 --- a/ndb/src/ndbapi/ObjectMap.hpp +++ b/ndb/src/ndbapi/ObjectMap.hpp @@ -29,7 +29,7 @@ class NdbObjectIdMap //: NdbLockable { public: - STATIC_CONST( InvalidId = ~0 ); + STATIC_CONST( InvalidId = ~(Uint32)0 ); NdbObjectIdMap(Uint32 initalSize = 128, Uint32 expandSize = 10); ~NdbObjectIdMap(); diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 9762eb85de1..7e4243d56fb 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -17,6 +17,7 @@ #include <ndb_global.h> #include <ndberror.h> +#include <m_string.h> typedef struct ErrorBundle { int code; @@ -68,6 +69,7 @@ static const char* empty_string = ""; * 600 - ACC * 700 - DICT * 800 - TUP + * 900 - TUX * 1200 - LQH * 1300 - BACKUP * 4000 - API @@ -175,10 +177,13 @@ ErrorBundle ErrorCodes[] = { { 623, IS, "623" }, { 624, IS, "624" }, { 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" }, - { 800, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, + { 640, IS, "Too many hash indexes (should not happen)" }, { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" }, { 827, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" }, - { 832, IS, "832" }, + { 902, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" }, + { 903, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, + { 904, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" }, + { 905, IS, "Out of attribute records (increase MaxNoOfAttributes)" }, /** * TimeoutExpired @@ -204,8 +209,8 @@ ErrorBundle ErrorCodes[] = { * Internal errors */ { 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" }, - { 895, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" }, { 896, IE, "Tuple corrupted - wrong checksum or column data in invalid format" }, + { 901, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" }, { 202, IE, "202" }, { 203, IE, "203" }, { 207, IE, "207" }, @@ -309,7 +314,6 @@ ErrorBundle ErrorCodes[] = { { 739, SE, "Unsupported primary key length" }, { 740, SE, "Nullable primary key not supported" }, { 741, SE, "Unsupported alter table" }, - { 742, SE, "Unsupported attribute type in index" }, { 743, SE, "Unsupported character set in table or index" }, { 744, SE, "Character string is invalid for given character set" }, { 745, SE, "Distribution key not supported for char attribute (use binary attribute)" }, @@ -318,6 +322,9 @@ ErrorBundle ErrorCodes[] = { { 284, SE, "Table not defined in transaction coordinator" }, { 285, SE, "Unknown table error in transaction coordinator" }, { 881, SE, "Unable to create table, out of data pages (increase DataMemory) " }, + { 906, SE, "Unsupported attribute type in index" }, + { 907, SE, "Unsupported character set in table or index" }, + { 908, IS, "Invalid ordered index tree node size" }, { 1225, SE, "Table not defined in local query handler" }, { 1226, SE, "Table is being dropped" }, { 1228, SE, "Cannot use drop table for drop index" }, @@ -481,8 +488,8 @@ ErrorBundle ErrorCodes[] = { { 4266, AE, "Invalid blob seek position" }, { 4267, IE, "Corrupted blob value" }, { 4268, IE, "Error in blob head update forced rollback of transaction" }, - { 4268, IE, "Unknown blob error" }, { 4269, IE, "No connection to ndb management server" }, + { 4270, IE, "Unknown blob error" }, { 4335, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" } }; @@ -649,10 +656,10 @@ int ndb_error_string(int err_no, char *str, unsigned int size) ndberror_update(&error); len = - snprintf(str, size-1, "%s: %s: %s", error.message, - ndberror_status_message(error.status), - ndberror_classification_message(error.classification)); + my_snprintf(str, size-1, "%s: %s: %s", error.message, + ndberror_status_message(error.status), + ndberror_classification_message(error.classification)); str[size-1]= '\0'; - + return len; } |