summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@mc05.(none)>2004-06-18 02:16:08 +0200
committerunknown <tomas@mc05.(none)>2004-06-18 02:16:08 +0200
commitfb89fac462d5f8d3c5a7e2663d30f65a0623fc0d (patch)
tree098d454b0d14040776d00ef5d656ee88f2a1680f /ndb
parent3d2949e5b801557d7f222c202dbabac3545b92f8 (diff)
parent25749c968604adc68a00055abb73e6d8ec3d5505 (diff)
downloadmariadb-git-fb89fac462d5f8d3c5a7e2663d30f65a0623fc0d.tar.gz
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mc05.(none):/space2/tomas/mysql-4.1-ndb-test
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/ndb_global.h8
-rw-r--r--ndb/include/ndb_types.h2
-rw-r--r--ndb/include/util/BaseString.hpp4
-rw-r--r--ndb/include/util/NdbSqlUtil.hpp14
-rw-r--r--ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp6
-rw-r--r--ndb/src/common/mgmcommon/ConfigInfo.cpp111
-rw-r--r--ndb/src/common/mgmcommon/ConfigInfo.hpp16
-rw-r--r--ndb/src/common/mgmcommon/InitConfigFileParser.cpp36
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp4
9 files changed, 162 insertions, 39 deletions
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h
index bd1e4954f14..f871acbc075 100644
--- a/ndb/include/ndb_global.h
+++ b/ndb/include/ndb_global.h
@@ -25,7 +25,13 @@
#endif
#include <sys/param.h>
#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
+ #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE)
+ #undef _INCLUDE_AES_SOURCE
+ #include <sys/stat.h>
+ #define _INCLUDE_AES_SOURCE
+ #else
+ #include <sys/stat.h>
+ #endif
#endif
#include <sys/resource.h>
#ifdef HAVE_SYS_WAIT_H
diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h
index 5e7b952cfc5..87ebd3d6c6b 100644
--- a/ndb/include/ndb_types.h
+++ b/ndb/include/ndb_types.h
@@ -33,7 +33,7 @@ typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#else
-#include <my_config.h>
+#include <my_global.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp
index 75a1c291594..8755c13e9bb 100644
--- a/ndb/include/util/BaseString.hpp
+++ b/ndb/include/util/BaseString.hpp
@@ -203,13 +203,13 @@ BaseString::empty() const
inline void
BaseString::ndb_toupper() {
for(unsigned i = 0; i < length(); i++)
- m_chr[i] = ::toupper(m_chr[i]);
+ m_chr[i] = toupper(m_chr[i]);
}
inline void
BaseString::ndb_tolower() {
for(unsigned i = 0; i < length(); i++)
- m_chr[i] = ::tolower(m_chr[i]);
+ m_chr[i] = tolower(m_chr[i]);
}
inline bool
diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp
index dae12bd11a0..841da513d4a 100644
--- a/ndb/include/util/NdbSqlUtil.hpp
+++ b/ndb/include/util/NdbSqlUtil.hpp
@@ -150,7 +150,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Tinyunsigned:
{
if (size >= 1) {
@@ -165,7 +164,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Smallint:
{
if (size >= 1) {
@@ -180,7 +178,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Smallunsigned:
{
if (size >= 1) {
@@ -195,7 +192,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Mediumint: // XXX fix these
break;
case Type::Mediumunsigned:
@@ -214,7 +210,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Unsigned:
{
if (size >= 1) {
@@ -229,7 +224,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Bigint:
{
if (size >= 2) {
@@ -246,7 +240,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Bigunsigned:
{
if (size >= 2) {
@@ -263,7 +256,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Float:
{
if (size >= 1) {
@@ -278,7 +270,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Double:
{
if (size >= 2) {
@@ -295,7 +286,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Decimal:
break;
case Type::Char:
@@ -310,7 +300,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
int k = memcmp(u1.v, u2.v, size << 2);
return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown;
}
- break;
case Type::Varchar:
{
/*
@@ -328,7 +317,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Binary: // XXX fix these
break;
case Type::Varbinary:
@@ -352,7 +340,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
case Type::Timespec: // XXX fix this
break;
case Type::Blob: // XXX fix
@@ -371,7 +358,6 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
}
return CmpUnknown;
}
- break;
}
return CmpError;
}
diff --git a/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp b/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp
index ad9cb623c17..9b32fab87ba 100644
--- a/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp
+++ b/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp
@@ -59,10 +59,10 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
sig->numberOfPages);
fprintf(output, " pageData: ");
-
+ unsigned int i;
switch(sig->getFormatFlag(sig->operationFlag)){
case FsReadWriteReq::fsFormatListOfPairs:
- for (unsigned int i = 0; i < sig->numberOfPages*2; i += 2){
+ for (i= 0; i < sig->numberOfPages*2; i += 2){
fprintf(output, " H\'%.8x, H\'%.8x\n", sig->data.pageData[i],
sig->data.pageData[i + 1]);
}
@@ -72,7 +72,7 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
sig->data.pageData[1]);
break;
case FsReadWriteReq::fsFormatListOfMemPages:
- for (unsigned int i = 0; i < (sig->numberOfPages + 1); i++){
+ for (i= 0; i < (sig->numberOfPages + 1); i++){
fprintf(output, " H\'%.8x, ", sig->data.pageData[i]);
}
break;
diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp
index c3e10dd3448..c2b5fdabf01 100644
--- a/ndb/src/common/mgmcommon/ConfigInfo.cpp
+++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp
@@ -143,6 +143,19 @@ ConfigInfo::m_SectionRules[] = {
};
const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
+/****************************************************************************
+ * Config Rules declarations
+ ****************************************************************************/
+bool addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>&sections,
+ struct InitConfigFileParser::Context &ctx,
+ const char * ruleData);
+
+const ConfigInfo::ConfigRule
+ConfigInfo::m_ConfigRules[] = {
+ { addNodeConnections, 0 },
+ { 0, 0 }
+};
+
struct DepricationTransform {
const char * m_section;
const char * m_oldName;
@@ -1525,7 +1538,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED,
false,
ConfigInfo::INT,
- MANDATORY,
+ 2202,
0,
0x7FFFFFFF },
@@ -2712,13 +2725,13 @@ checkMandatory(InitConfigFileParser::Context & ctx, const char * data){
* Transform a string "NodeidX" (e.g. "uppsala.32")
* into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala").
*/
-bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){
-
+bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data)
+{
char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")];
char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")];
const char* nodeId;
require(ctx.m_currentSection->get(buf, &nodeId));
-
+
char tmpLine[MAX_LINE_LENGTH];
strncpy(tmpLine, nodeId, MAX_LINE_LENGTH);
char* token1 = strtok(tmpLine, ".");
@@ -2739,7 +2752,6 @@ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){
require(ctx.m_currentSection->put(buf, id, true));
require(ctx.m_currentSection->put(sysbuf, token1));
}
-
return true;
}
@@ -2862,9 +2874,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
Uint32 adder = 0;
ctx.m_userProperties.get("PortNumberAdder", &adder);
Uint32 base = 0;
- if(!ctx.m_userDefaults->get("PortNumber", &base) &&
+ if(!(ctx.m_userDefaults && ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)){
- return true;
+ return false;
}
ctx.m_currentSection->put("PortNumber", base + adder);
adder++;
@@ -3144,3 +3156,88 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
} while(0);
return true;
}
+
+bool
+addNodeConnections(Vector<ConfigInfo::ConfigRuleSection>&sections,
+ struct InitConfigFileParser::Context &ctx,
+ const char * ruleData)
+{
+ Properties * props= ctx.m_config;
+ Properties p_connections;
+ Properties p_connections2;
+
+ for (Uint32 i = 0;; i++){
+ const Properties * tmp;
+ Uint32 nodeId1, nodeId2;
+
+ if(!props->get("Connection", i, &tmp)) break;
+
+ if(!tmp->get("NodeId1", &nodeId1)) continue;
+ p_connections.put("", nodeId1, nodeId1);
+ if(!tmp->get("NodeId2", &nodeId2)) continue;
+ p_connections.put("", nodeId2, nodeId2);
+
+ p_connections2.put("", nodeId1 + nodeId2<<16, nodeId1);
+ p_connections2.put("", nodeId2 + nodeId1<<16, nodeId2);
+ }
+
+ Uint32 nNodes;
+ ctx.m_userProperties.get("NoOfNodes", &nNodes);
+
+ Properties p_db_nodes;
+ Properties p_api_mgm_nodes;
+
+ Uint32 i_db= 0, i_api_mgm= 0;
+ for (Uint32 i= 0, n= 0; n < nNodes; i++){
+ const Properties * tmp;
+ if(!props->get("Node", i, &tmp)) continue;
+ n++;
+
+ const char * type;
+ if(!tmp->get("Type", &type)) continue;
+
+ if (strcmp(type,"DB") == 0)
+ p_db_nodes.put("", i_db++, i);
+ else if (strcmp(type,"API") == 0 ||
+ strcmp(type,"MGM") == 0)
+ p_api_mgm_nodes.put("", i_api_mgm++, i);
+ }
+
+ Uint32 nodeId1, nodeId2, dummy;
+
+ for (Uint32 i= 0; p_db_nodes.get("", i, &nodeId1); i++){
+ for (Uint32 j= i+1;; j++){
+ if(!p_db_nodes.get("", j, &nodeId2)) break;
+ if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) {
+ ConfigInfo::ConfigRuleSection s;
+ s.m_sectionType= BaseString("TCP");
+ s.m_sectionData= new Properties;
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", nodeId1);
+ s.m_sectionData->put("NodeId1", buf);
+ snprintf(buf, sizeof(buf), "%u", nodeId2);
+ s.m_sectionData->put("NodeId2", buf);
+ sections.push_back(s);
+ }
+ }
+ }
+
+ for (Uint32 i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){
+ if(!p_connections.get("", nodeId1, &dummy)) {
+ for (Uint32 j= 0;; j++){
+ if(!p_db_nodes.get("", j, &nodeId2)) break;
+ ConfigInfo::ConfigRuleSection s;
+ s.m_sectionType= BaseString("TCP");
+ s.m_sectionData= new Properties;
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", nodeId1);
+ s.m_sectionData->put("NodeId1", buf);
+ snprintf(buf, sizeof(buf), "%u", nodeId2);
+ s.m_sectionData->put("NodeId2", buf);
+ sections.push_back(s);
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/ndb/src/common/mgmcommon/ConfigInfo.hpp b/ndb/src/common/mgmcommon/ConfigInfo.hpp
index b5e011ed398..79c17b436fe 100644
--- a/ndb/src/common/mgmcommon/ConfigInfo.hpp
+++ b/ndb/src/common/mgmcommon/ConfigInfo.hpp
@@ -71,6 +71,21 @@ public:
const char * m_ruleData;
};
+ /**
+ * Entry for config rule
+ */
+ struct ConfigRuleSection {
+ BaseString m_sectionType;
+ Properties * m_sectionData;
+ };
+
+ struct ConfigRule {
+ bool (* m_configRule)(Vector<ConfigRuleSection>&,
+ struct InitConfigFileParser::Context &,
+ const char * m_ruleData);
+ const char * m_ruleData;
+ };
+
ConfigInfo();
/**
@@ -113,6 +128,7 @@ private:
public:
static const SectionRule m_SectionRules[];
+ static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules;
};
diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
index f4a8e1a8cd4..d52bc54db52 100644
--- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
@@ -22,7 +22,7 @@
#include <NdbOut.hpp>
#include "ConfigInfo.hpp"
-const int MAX_LINE_LENGTH = 120; // Max length of line of text in config file
+const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file
static void trim(char *);
static void require(bool v) { if(!v) abort();}
@@ -163,6 +163,30 @@ InitConfigFileParser::parseConfig(FILE * file) {
return 0;
}
+ for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){
+ ctx.type = InitConfigFileParser::Undefined;
+ ctx.m_currentSection = 0;
+ ctx.m_userDefaults = 0;
+ ctx.m_currentInfo = 0;
+ ctx.m_systemDefaults = 0;
+
+ Vector<ConfigInfo::ConfigRuleSection> tmp;
+ if(!(* ConfigInfo::m_ConfigRules[i].m_configRule)(tmp, ctx,
+ ConfigInfo::m_ConfigRules[i].m_ruleData))
+ return 0;
+
+ for(size_t j = 0; j<tmp.size(); j++){
+ snprintf(ctx.fname, sizeof(ctx.fname), tmp[j].m_sectionType.c_str());
+ ctx.type = InitConfigFileParser::Section;
+ ctx.m_currentSection = tmp[j].m_sectionData;
+ ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
+ ctx.m_currentInfo = m_info->getInfo(ctx.fname);
+ ctx.m_systemDefaults = m_info->getDefaults(ctx.fname);
+ if(!storeSection(ctx))
+ return 0;
+ }
+ }
+
Uint32 nConnections = 0;
Uint32 nComputers = 0;
Uint32 nNodes = 0;
@@ -499,28 +523,22 @@ bool
InitConfigFileParser::storeSection(Context& ctx){
if(ctx.m_currentSection == NULL)
return true;
-
for(int i = strlen(ctx.fname) - 1; i>=0; i--){
ctx.fname[i] = toupper(ctx.fname[i]);
}
-
snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname);
-
char buf[255];
if(ctx.type == InitConfigFileParser::Section)
snprintf(buf, sizeof(buf), "%s", ctx.fname);
if(ctx.type == InitConfigFileParser::DefaultSection)
snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname);
-
snprintf(ctx.fname, sizeof(ctx.fname), buf);
if(ctx.type == InitConfigFileParser::Section){
for(int i = 0; i<m_info->m_NoOfRules; i++){
const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i];
- if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname)){
- if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData)){
+ if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname))
+ if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData))
return false;
- }
- }
}
}
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 72ba282ad13..bb4b6be8221 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -430,7 +430,7 @@ const int no_of_type_values = (sizeof(type_values) /
sizeof(ndb_mgm_type_atoi));
extern "C"
-enum ndb_mgm_node_type
+ndb_mgm_node_type
ndb_mgm_match_node_type(const char * type)
{
if(type == 0)
@@ -474,7 +474,7 @@ const int no_of_status_values = (sizeof(status_values) /
sizeof(ndb_mgm_status_atoi));
extern "C"
-enum ndb_mgm_node_status
+ndb_mgm_node_status
ndb_mgm_match_node_status(const char * status)
{
if(status == 0)