Commit 28985a75 authored by unknown's avatar unknown

further simplifications of ndb config and aligned usage of mysql datadir in ndb


acinclude.m4:
  added configure switch for ndb base port
configure.in:
  ndb gcc compile now works with -fno-implicit-templates
mysql-test/ndb/ndb_config_2_node.ini:
  further simplifications of config, removed need for [COMPUTER] section
ndb/include/ndb_global.h:
  moved this to configure option
ndb/src/common/mgmcommon/ConfigInfo.cpp:
  changed config to take to take strings instead of ints
ndb/src/common/mgmcommon/ConfigInfo.hpp:
  changed config to take to take strings instead of ints
ndb/src/common/mgmcommon/InitConfigFileParser.cpp:
  string to number convert to accept "0x" prefix on numbers
ndb/src/common/mgmcommon/InitConfigFileParser.hpp:
  movet convert function to public and static
ndb/src/common/mgmcommon/LocalConfig.cpp:
  define NDB_BASE_PORT now string instead of number
ndb/src/common/mgmcommon/Makefile.am:
  added mysqld defines in mgmcommon to be able to configure default data dir to be the same as for mysqld
parent 45e14bab
......@@ -1515,6 +1515,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation],
[ndb_docs="$withval"],
[ndb_docs=no])
AC_ARG_WITH([ndb-port-base],
[
--with-ndb-port-base Base port for NDB Cluster],
[ndb_port_base="$withval"],
[ndb_port_base="default"])
AC_MSG_CHECKING([for NDB Cluster options])
AC_MSG_RESULT([])
......
......@@ -389,8 +389,6 @@ then
# Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
# ndb cannot be compiled with -fno-implicit-templaces
ndb_cxxflags_fix="$ndb_cxxflags_fix -fimplicit-templates"
# If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux,
# we will gets some problems when linking static programs.
......@@ -2985,6 +2983,13 @@ then
AC_SUBST([NDB_DEFS])
AC_SUBST([ndb_cxxflags_fix])
if test X"$ndb_port_base" = Xdefault
then
ndb_port_base="2200"
fi
AC_SUBST([ndb_port_base])
ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes
then
......
......@@ -7,19 +7,11 @@ Diskless: CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000
FileSystemPath: CHOOSE_FILESYSTEM
[COMPUTER]
Id: 1
HostName: CHOOSE_HOSTNAME_1
[COMPUTER]
Id: 2
HostName: CHOOSE_HOSTNAME_2
[DB]
ExecuteOnComputer: 1
HostName: CHOOSE_HOSTNAME_1
[DB]
ExecuteOnComputer: 2
HostName: CHOOSE_HOSTNAME_2
[MGM]
PortNumber: CHOOSE_PORT_MGM
......
......@@ -3,7 +3,6 @@
#define NDBGLOBAL_H
#include <my_global.h>
#define NDB_BASE_PORT 2200
/** signal & SIG_PIPE */
#include <my_alarm.h>
......
This diff is collapsed.
......@@ -27,8 +27,8 @@
* A MANDATORY parameters must be specified in the config file
* An UNDEFINED parameter may or may not be specified in the config file
*/
static const Uint64 MANDATORY = ~0; // Default value for mandatory params.
static const Uint64 UNDEFINED = (~0)-1; // Default value for undefined params.
static const char* MANDATORY = (char*)~(UintPtr)0; // Default value for mandatory params.
static const char* UNDEFINED = 0; // Default value for undefined params.
/**
* @class ConfigInfo
......@@ -56,9 +56,9 @@ public:
Status _status;
bool _updateable;
Type _type;
Uint64 _default;
Uint64 _min;
Uint64 _max;
const char* _default;
const char* _min;
const char* _max;
};
/**
......
......@@ -31,7 +31,6 @@ static void require(bool v) { if(!v) abort();}
// Ctor / Dtor
//****************************************************************************
InitConfigFileParser::InitConfigFileParser(){
m_info = new ConfigInfo();
}
......@@ -111,7 +110,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file.");
return 0;
}
snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
ctx.type = InitConfigFileParser::DefaultSection;
ctx.m_sectionLineno = ctx.m_lineno;
......@@ -132,7 +130,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file.");
return 0;
}
snprintf(ctx.fname, sizeof(ctx.fname), section);
free(section);
ctx.type = InitConfigFileParser::Section;
......@@ -162,7 +159,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.reportError("Could not store section of configuration file.");
return 0;
}
for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){
ctx.type = InitConfigFileParser::Undefined;
ctx.m_currentSection = 0;
......@@ -378,7 +374,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s,
errno = 0;
char* p;
long long v = strtoll(s, &p, 10);
long long v = strtoll(s, &p, log10base);
if (errno != 0)
return false;
......@@ -536,20 +532,18 @@ InitConfigFileParser::storeSection(Context& ctx){
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;
}
}
}
}
if(ctx.type == InitConfigFileParser::DefaultSection)
require(ctx.m_defaults->put(ctx.pname, ctx.m_currentSection));
if(ctx.type == InitConfigFileParser::Section)
require(ctx.m_config->put(ctx.pname, ctx.m_currentSection));
delete ctx.m_currentSection; ctx.m_currentSection = NULL;
return true;
}
......
......@@ -86,6 +86,9 @@ public:
void reportWarning(const char * msg, ...);
};
static bool convertStringToUint64(const char* s, Uint64& val, Uint32 log10base = 0);
static bool convertStringToBool(const char* s, bool& val);
private:
/**
* Check if line only contains space/comments
......@@ -111,8 +114,6 @@ private:
bool parseNameValuePair(Context&, const char* line);
bool storeNameValuePair(Context&, const char* fname, const char* value);
bool convertStringToUint64(const char* s, Uint64& val, Uint32 log10base = 0);
bool convertStringToBool(const char* s, bool& val);
bool storeSection(Context&);
const Properties* getSection(const char * name, const Properties* src);
......
......@@ -89,7 +89,7 @@ LocalConfig::init(const char *connectString,
//7. Check
{
char buf[256];
snprintf(buf, sizeof(buf), "host=localhost:%u", NDB_BASE_PORT);
snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_BASE_PORT);
if(readConnectString(buf))
return true;
}
......
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \
......@@ -10,6 +14,11 @@ libmgmsrvcommon_la_SOURCES = \
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment