1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Jan Steemann 2014-10-28 11:30:59 +01:00
commit acd3c8a47a
5 changed files with 67 additions and 23 deletions

View File

@ -62,7 +62,7 @@ static bool IsRunning = false;
////////////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
static string ServiceName = "ArangoDB";
static std::string ServiceName = "ArangoDB";
#endif
////////////////////////////////////////////////////////////////////////////////
@ -164,17 +164,17 @@ static void TRI_GlobalExitFunction(int exitCode, void* data) {
#ifdef _WIN32
static void InstallServiceCommand (string command) {
string friendlyServiceName = "ArangoDB - the multi-purpose database";
static void InstallServiceCommand (std::string command) {
std::string friendlyServiceName = "ArangoDB - the multi-purpose database";
cout << "INFO: adding service '" << friendlyServiceName
<< "' (internal '" << ServiceName << "')"
<< endl;
std::cout << "INFO: adding service '" << friendlyServiceName
<< "' (internal '" << ServiceName << "')"
<< std::endl;
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
if (schSCManager == 0) {
cerr << "FATAL: OpenSCManager failed with " << GetLastError() << endl;
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
@ -196,14 +196,14 @@ static void InstallServiceCommand (string command) {
CloseServiceHandle(schSCManager);
if (schService == 0) {
cerr << "FATAL: CreateServiceA failed with " << GetLastError() << endl;
std::cerr << "FATAL: CreateServiceA failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
SERVICE_DESCRIPTION description = { "multi-purpose NoSQL database (version " TRI_VERSION ")" };
ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &description);
cout << "INFO: added service with command line '" << command << "'" << endl;
std::cout << "INFO: added service with command line '" << command << "'" << std::endl;
CloseServiceHandle(schService);
}
@ -220,12 +220,12 @@ static void InstallService (int argc, char* argv[]) {
CHAR path[MAX_PATH];
if(! GetModuleFileNameA(NULL, path, MAX_PATH)) {
cerr << "FATAL: GetModuleFileNameA failed" << endl;
std::cerr << "FATAL: GetModuleFileNameA failed" << std::endl;
exit(EXIT_FAILURE);
}
// build command
string command;
std::string command;
command += "\"";
command += path;
@ -246,12 +246,12 @@ static void InstallService (int argc, char* argv[]) {
#ifdef _WIN32
static void DeleteService (int argc, char* argv[]) {
cout << "INFO: removing service '" << ServiceName << "'" << endl;
std::cout << "INFO: removing service '" << ServiceName << "'" << std::endl;
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
if (schSCManager == 0) {
cerr << "FATAL: OpenSCManager failed with " << GetLastError() << endl;
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
@ -263,12 +263,12 @@ static void DeleteService (int argc, char* argv[]) {
CloseServiceHandle(schSCManager);
if (schService == 0) {
cerr << "FATAL: OpenServiceA failed with " << GetLastError() << endl;
std::cerr << "FATAL: OpenServiceA failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
if (! DeleteService(schService)) {
cerr << "FATAL: DeleteService failed with " << GetLastError() << endl;
std::cerr << "FATAL: DeleteService failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
@ -440,7 +440,7 @@ int main (int argc, char* argv[]) {
ARGV = argv;
if (! StartServiceCtrlDispatcher(ste)) {
cerr << "FATAL: StartServiceCtrlDispatcher has failed with " << GetLastError() << endl;
std::cerr << "FATAL: StartServiceCtrlDispatcher has failed with " << GetLastError() << std::endl;
exit(EXIT_FAILURE);
}
}

View File

@ -385,7 +385,17 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
if (arangodPath !== cmd.arangodPath) {
arangodPath = ArangoServerState.arangodPath();
}
pids.push(executeExternal(arangodPath, args));
if (cmd.valgrind !== '') {
var valgrindopts = cmd.valgrindopts.concat(
["--xml-file="+cmd.valgrindXmlFileBase + '_' + cmd.valgrindTestname + '_' + id + '.%p.xml',
"--log-file="+cmd.valgrindXmlFileBase + '_' + cmd.valgrindTestname + '_' + id + '.%p.valgrind.log']);
var newargs = valgrindopts.concat([arangodPath]).concat(args);
var cmdline = cmd.valgrind;
pids.push(executeExternal(cmdline, newargs));
}
else {
pids.push(executeExternal(arangodPath, args));
}
ep = exchangePort(dispatchers[cmd.dispatcher].endpoint,port);
ep = exchangeProtocol(ep,useSSL);
endpoints.push(ep);

View File

@ -59,7 +59,11 @@ var PlannerLocalDefaults = {
"dispatchers" : {"me": {"endpoint": "tcp://localhost:"}},
// this means only we as a local instance
"useSSLonDBservers" : false,
"useSSLonCoordinators" : false
"useSSLonCoordinators" : false,
"valgrind" : "",
"valgrindopts" : [],
"valgrindXmlFileBase" : "",
"valgrindTestname" : ""
};
// Some helpers using underscore:
@ -346,6 +350,11 @@ function fillConfigWithDefaults (config, defaultConfig) {
/// we use SSL on all DBservers in the cluster
/// - *useSSLonCoordinators*: a boolean flag indicating whether or not
/// we use SSL on all coordinators in the cluster
/// - *valgrind*: a string to contain the path of the valgrind binary
/// if we should run the cluster components in it
/// - *valgrindopts*: commandline options to the valgrind process
/// - *valgrindXmlFileBase*: pattern for logfiles
/// - *valgrindTestname*: name of test to add to the logfiles
///
/// All these values have default values. Here is the current set of
/// default values:
@ -610,7 +619,12 @@ Planner.prototype.makePlan = function() {
"dataPath": config.dataPath,
"logPath": config.logPath,
"agentPath": config.agentPath,
"onlyLocalhost": config.onlyLocalhost };
"onlyLocalhost": config.onlyLocalhost,
"valgrind": config.valgrind,
"valgrindopts": config.valgrindopts,
"valgrindXmlFileBase" : config.valgrindXmlFileBase,
"valgrindTestname" : config.valgrindXmlFileBase
};
for (j = 0; j < i; j++) {
ep = dispatchers[agents[j].dispatcher].endpoint;
tmp2.peers.push( exchangePort( ep, agents[j].intPort ) );
@ -635,7 +649,12 @@ Planner.prototype.makePlan = function() {
"onlyLocalhost": config.onlyLocalhost,
"agency": copy(agencyPos),
"useSSLonDBservers": config.useSSLonDBservers,
"useSSLonCoordinators": config.useSSLonCoordinators } );
"useSSLonCoordinators": config.useSSLonCoordinators,
"valgrind": config.valgrind,
"valgrindopts": config.valgrindopts,
"valgrindXmlFileBase" : config.valgrindXmlFileBase,
"valgrindTestname" : config.valgrindTestname
} );
}
var cc = [];

View File

@ -253,6 +253,7 @@ function startInstance (protocol, options, addArgs, testname) {
var endpoint;
var pos;
var valgrindopts = [];
var dispatcher;
if (options.cluster) {
dispatcher = {"endpoint":"tcp://localhost:",
@ -263,12 +264,26 @@ function startInstance (protocol, options, addArgs, testname) {
dispatcher.arangodExtraArgs = addArgs;
}
print("Temporary cluster data and logs are in",tmpDataDir);
var runInValgrind = "";
var valgrindXmlFileBase = "";
if (typeof(options.valgrind) === 'string') {
runInValgrind = options.valgrind;
valgrindopts = options.valgrindargs;
valgrindXmlFileBase = options.valgrindXmlFileBase;
}
var p = new Planner({"numberOfDBservers":2,
"numberOfCoordinators":1,
"dispatchers": {"me": dispatcher},
"dataPath": tmpDataDir,
"logPath": tmpDataDir,
"useSSLonCoordinators": protocol === "ssl"});
"useSSLonCoordinators": protocol === "ssl",
"valgrind": runInValgrind,
"valgrindopts": valgrindopts,
"valgrindXmlFileBase" : valgrindXmlFileBase,
"valgrindTestname" : testname
});
instanceInfo.kickstarter = new Kickstarter(p.getPlan());
instanceInfo.kickstarter.launch();
var runInfo = instanceInfo.kickstarter.runInfo;
@ -309,7 +324,7 @@ function startInstance (protocol, options, addArgs, testname) {
}
if (typeof(options.valgrind) === 'string') {
var run = fs.join("bin","arangod");
var valgrindopts = options.valgrindargs.concat(
valgrindopts = options.valgrindargs.concat(
["--xml-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.xml',
"--log-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.valgrind.log']);
var newargs=valgrindopts.concat([run]).concat(args);

View File

@ -238,7 +238,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
hints.ai_flags = TRI_CONNECT_AI_FLAGS;
hints.ai_socktype = SOCK_STREAM;
string portString = StringUtils::itoa(_port);
std::string portString = StringUtils::itoa(_port);
error = getaddrinfo(_host.c_str(), portString.c_str(), &hints, &result);