Commit a05b1ea6 authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.(none):/home/tomas/mysql-4.1
parents 20b3f6c5 8d497d4d
...@@ -1515,6 +1515,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ ...@@ -1515,6 +1515,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation], --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation],
[ndb_docs="$withval"], [ndb_docs="$withval"],
[ndb_docs=no]) [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_CHECKING([for NDB Cluster options])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
......
...@@ -389,8 +389,6 @@ then ...@@ -389,8 +389,6 @@ then
# Disable exceptions as they seams to create problems with gcc and threads. # Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it. # mysqld doesn't use run-time-type-checking, so we disable it.
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" 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, # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux,
# we will gets some problems when linking static programs. # we will gets some problems when linking static programs.
...@@ -2985,6 +2983,13 @@ then ...@@ -2985,6 +2983,13 @@ then
AC_SUBST([NDB_DEFS]) AC_SUBST([NDB_DEFS])
AC_SUBST([ndb_cxxflags_fix]) 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="" ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes if test X"$have_ndb_shm" = Xyes
then then
......
...@@ -7,19 +7,11 @@ Diskless: CHOOSE_Diskless ...@@ -7,19 +7,11 @@ Diskless: CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000 TimeBetweenWatchDogCheck: 30000
FileSystemPath: CHOOSE_FILESYSTEM FileSystemPath: CHOOSE_FILESYSTEM
[COMPUTER]
Id: 1
HostName: CHOOSE_HOSTNAME_1
[COMPUTER]
Id: 2
HostName: CHOOSE_HOSTNAME_2
[DB] [DB]
ExecuteOnComputer: 1 HostName: CHOOSE_HOSTNAME_1
[DB] [DB]
ExecuteOnComputer: 2 HostName: CHOOSE_HOSTNAME_2
[MGM] [MGM]
PortNumber: CHOOSE_PORT_MGM PortNumber: CHOOSE_PORT_MGM
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#define NDBGLOBAL_H #define NDBGLOBAL_H
#include <my_global.h> #include <my_global.h>
#define NDB_BASE_PORT 2200
/** signal & SIG_PIPE */ /** signal & SIG_PIPE */
#include <my_alarm.h> #include <my_alarm.h>
......
This diff is collapsed.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
* A MANDATORY parameters must be specified in the config file * A MANDATORY parameters must be specified in the config file
* An UNDEFINED parameter may or may not 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 char* MANDATORY = (char*)~(UintPtr)0; // Default value for mandatory params.
static const Uint64 UNDEFINED = (~0)-1; // Default value for undefined params. static const char* UNDEFINED = 0; // Default value for undefined params.
/** /**
* @class ConfigInfo * @class ConfigInfo
...@@ -56,9 +56,9 @@ public: ...@@ -56,9 +56,9 @@ public:
Status _status; Status _status;
bool _updateable; bool _updateable;
Type _type; Type _type;
Uint64 _default; const char* _default;
Uint64 _min; const char* _min;
Uint64 _max; const char* _max;
}; };
/** /**
......
...@@ -31,7 +31,6 @@ static void require(bool v) { if(!v) abort();} ...@@ -31,7 +31,6 @@ static void require(bool v) { if(!v) abort();}
// Ctor / Dtor // Ctor / Dtor
//**************************************************************************** //****************************************************************************
InitConfigFileParser::InitConfigFileParser(){ InitConfigFileParser::InitConfigFileParser(){
m_info = new ConfigInfo(); m_info = new ConfigInfo();
} }
...@@ -111,7 +110,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -111,7 +110,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file."); "of configuration file.");
return 0; return 0;
} }
snprintf(ctx.fname, sizeof(ctx.fname), section); free(section); snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
ctx.type = InitConfigFileParser::DefaultSection; ctx.type = InitConfigFileParser::DefaultSection;
ctx.m_sectionLineno = ctx.m_lineno; ctx.m_sectionLineno = ctx.m_lineno;
...@@ -132,7 +130,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -132,7 +130,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file."); "of configuration file.");
return 0; return 0;
} }
snprintf(ctx.fname, sizeof(ctx.fname), section); snprintf(ctx.fname, sizeof(ctx.fname), section);
free(section); free(section);
ctx.type = InitConfigFileParser::Section; ctx.type = InitConfigFileParser::Section;
...@@ -162,7 +159,6 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -162,7 +159,6 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.reportError("Could not store section of configuration file."); ctx.reportError("Could not store section of configuration file.");
return 0; return 0;
} }
for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){ for(size_t i = 0; ConfigInfo::m_ConfigRules[i].m_configRule != 0; i++){
ctx.type = InitConfigFileParser::Undefined; ctx.type = InitConfigFileParser::Undefined;
ctx.m_currentSection = 0; ctx.m_currentSection = 0;
...@@ -378,7 +374,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s, ...@@ -378,7 +374,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s,
errno = 0; errno = 0;
char* p; char* p;
long long v = strtoll(s, &p, 10); long long v = strtoll(s, &p, log10base);
if (errno != 0) if (errno != 0)
return false; return false;
...@@ -536,20 +532,18 @@ InitConfigFileParser::storeSection(Context& ctx){ ...@@ -536,20 +532,18 @@ InitConfigFileParser::storeSection(Context& ctx){
if(ctx.type == InitConfigFileParser::Section){ if(ctx.type == InitConfigFileParser::Section){
for(int i = 0; i<m_info->m_NoOfRules; i++){ for(int i = 0; i<m_info->m_NoOfRules; i++){
const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i]; const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i];
if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname)) if(!strcmp(rule.m_section, "*") || !strcmp(rule.m_section, ctx.fname)){
if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData)) if(!(* rule.m_sectionRule)(ctx, rule.m_ruleData)){
return false; return false;
}
}
} }
} }
if(ctx.type == InitConfigFileParser::DefaultSection) if(ctx.type == InitConfigFileParser::DefaultSection)
require(ctx.m_defaults->put(ctx.pname, ctx.m_currentSection)); require(ctx.m_defaults->put(ctx.pname, ctx.m_currentSection));
if(ctx.type == InitConfigFileParser::Section) if(ctx.type == InitConfigFileParser::Section)
require(ctx.m_config->put(ctx.pname, ctx.m_currentSection)); require(ctx.m_config->put(ctx.pname, ctx.m_currentSection));
delete ctx.m_currentSection; ctx.m_currentSection = NULL; delete ctx.m_currentSection; ctx.m_currentSection = NULL;
return true; return true;
} }
......
...@@ -86,6 +86,9 @@ public: ...@@ -86,6 +86,9 @@ public:
void reportWarning(const char * msg, ...); 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: private:
/** /**
* Check if line only contains space/comments * Check if line only contains space/comments
...@@ -111,8 +114,6 @@ private: ...@@ -111,8 +114,6 @@ private:
bool parseNameValuePair(Context&, const char* line); bool parseNameValuePair(Context&, const char* line);
bool storeNameValuePair(Context&, const char* fname, const char* value); 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&); bool storeSection(Context&);
const Properties* getSection(const char * name, const Properties* src); const Properties* getSection(const char * name, const Properties* src);
......
...@@ -89,7 +89,7 @@ LocalConfig::init(const char *connectString, ...@@ -89,7 +89,7 @@ LocalConfig::init(const char *connectString,
//7. Check //7. Check
{ {
char buf[256]; 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)) if(readConnectString(buf))
return true; return true;
} }
......
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
noinst_LTLIBRARIES = libmgmsrvcommon.la noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \ libmgmsrvcommon_la_SOURCES = \
...@@ -10,6 +14,11 @@ libmgmsrvcommon_la_SOURCES = \ ...@@ -10,6 +14,11 @@ libmgmsrvcommon_la_SOURCES = \
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi 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/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "Services.hpp" #include "Services.hpp"
extern bool g_StopServer;
static const unsigned int MAX_READ_TIMEOUT = 1000 ; static const unsigned int MAX_READ_TIMEOUT = 1000 ;
static const unsigned int MAX_WRITE_TIMEOUT = 100 ; static const unsigned int MAX_WRITE_TIMEOUT = 100 ;
...@@ -1012,12 +1014,29 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &, ...@@ -1012,12 +1014,29 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
nodes.push_back(atoi(p)); nodes.push_back(atoi(p));
} }
int stop_self= 0;
for(size_t i=0; i < nodes.size(); i++) {
if (nodes[i] == m_mgmsrv.getOwnNodeId()) {
stop_self= 1;
if (i != nodes.size()-1) {
m_output->println("stop reply");
m_output->println("result: server must be stopped last");
m_output->println("");
return;
}
}
}
int stopped = 0, result = 0; int stopped = 0, result = 0;
for(size_t i=0; i < nodes.size(); i++) for(size_t i=0; i < nodes.size(); i++)
if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0) if (nodes[i] != m_mgmsrv.getOwnNodeId()) {
if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0)
stopped++;
} else
stopped++; stopped++;
m_output->println("stop reply"); m_output->println("stop reply");
if(result != 0) if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result)); m_output->println("result: %s", m_mgmsrv.getErrorText(result));
...@@ -1025,6 +1044,9 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &, ...@@ -1025,6 +1044,9 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
m_output->println("result: Ok"); m_output->println("result: Ok");
m_output->println("stopped: %d", stopped); m_output->println("stopped: %d", stopped);
m_output->println(""); m_output->println("");
if (stop_self)
g_StopServer= true;
} }
......
...@@ -265,9 +265,10 @@ NDB_MAIN(mgmsrv){ ...@@ -265,9 +265,10 @@ NDB_MAIN(mgmsrv){
NdbSleep_MilliSleep(500); NdbSleep_MilliSleep(500);
} }
g_EventLogger.info("Shutting down server...");
glob.socketServer->stopServer(); glob.socketServer->stopServer();
glob.socketServer->stopSessions(); glob.socketServer->stopSessions();
g_EventLogger.info("Shutdown complete");
return 0; return 0;
error_end: error_end:
return 1; return 1;
......
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