mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
acd3c8a47a
|
@ -62,7 +62,7 @@ static bool IsRunning = false;
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static string ServiceName = "ArangoDB";
|
static std::string ServiceName = "ArangoDB";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -164,17 +164,17 @@ static void TRI_GlobalExitFunction(int exitCode, void* data) {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static void InstallServiceCommand (string command) {
|
static void InstallServiceCommand (std::string command) {
|
||||||
string friendlyServiceName = "ArangoDB - the multi-purpose database";
|
std::string friendlyServiceName = "ArangoDB - the multi-purpose database";
|
||||||
|
|
||||||
cout << "INFO: adding service '" << friendlyServiceName
|
std::cout << "INFO: adding service '" << friendlyServiceName
|
||||||
<< "' (internal '" << ServiceName << "')"
|
<< "' (internal '" << ServiceName << "')"
|
||||||
<< endl;
|
<< std::endl;
|
||||||
|
|
||||||
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (schSCManager == 0) {
|
if (schSCManager == 0) {
|
||||||
cerr << "FATAL: OpenSCManager failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,14 +196,14 @@ static void InstallServiceCommand (string command) {
|
||||||
CloseServiceHandle(schSCManager);
|
CloseServiceHandle(schSCManager);
|
||||||
|
|
||||||
if (schService == 0) {
|
if (schService == 0) {
|
||||||
cerr << "FATAL: CreateServiceA failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: CreateServiceA failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SERVICE_DESCRIPTION description = { "multi-purpose NoSQL database (version " TRI_VERSION ")" };
|
SERVICE_DESCRIPTION description = { "multi-purpose NoSQL database (version " TRI_VERSION ")" };
|
||||||
ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &description);
|
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);
|
CloseServiceHandle(schService);
|
||||||
}
|
}
|
||||||
|
@ -220,12 +220,12 @@ static void InstallService (int argc, char* argv[]) {
|
||||||
CHAR path[MAX_PATH];
|
CHAR path[MAX_PATH];
|
||||||
|
|
||||||
if(! GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
if(! GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
||||||
cerr << "FATAL: GetModuleFileNameA failed" << endl;
|
std::cerr << "FATAL: GetModuleFileNameA failed" << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build command
|
// build command
|
||||||
string command;
|
std::string command;
|
||||||
|
|
||||||
command += "\"";
|
command += "\"";
|
||||||
command += path;
|
command += path;
|
||||||
|
@ -246,12 +246,12 @@ static void InstallService (int argc, char* argv[]) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static void DeleteService (int argc, char* argv[]) {
|
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);
|
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (schSCManager == 0) {
|
if (schSCManager == 0) {
|
||||||
cerr << "FATAL: OpenSCManager failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,12 +263,12 @@ static void DeleteService (int argc, char* argv[]) {
|
||||||
CloseServiceHandle(schSCManager);
|
CloseServiceHandle(schSCManager);
|
||||||
|
|
||||||
if (schService == 0) {
|
if (schService == 0) {
|
||||||
cerr << "FATAL: OpenServiceA failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: OpenServiceA failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! DeleteService(schService)) {
|
if (! DeleteService(schService)) {
|
||||||
cerr << "FATAL: DeleteService failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: DeleteService failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ int main (int argc, char* argv[]) {
|
||||||
ARGV = argv;
|
ARGV = argv;
|
||||||
|
|
||||||
if (! StartServiceCtrlDispatcher(ste)) {
|
if (! StartServiceCtrlDispatcher(ste)) {
|
||||||
cerr << "FATAL: StartServiceCtrlDispatcher has failed with " << GetLastError() << endl;
|
std::cerr << "FATAL: StartServiceCtrlDispatcher has failed with " << GetLastError() << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,17 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
||||||
if (arangodPath !== cmd.arangodPath) {
|
if (arangodPath !== cmd.arangodPath) {
|
||||||
arangodPath = ArangoServerState.arangodPath();
|
arangodPath = ArangoServerState.arangodPath();
|
||||||
}
|
}
|
||||||
|
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));
|
pids.push(executeExternal(arangodPath, args));
|
||||||
|
}
|
||||||
ep = exchangePort(dispatchers[cmd.dispatcher].endpoint,port);
|
ep = exchangePort(dispatchers[cmd.dispatcher].endpoint,port);
|
||||||
ep = exchangeProtocol(ep,useSSL);
|
ep = exchangeProtocol(ep,useSSL);
|
||||||
endpoints.push(ep);
|
endpoints.push(ep);
|
||||||
|
|
|
@ -59,7 +59,11 @@ var PlannerLocalDefaults = {
|
||||||
"dispatchers" : {"me": {"endpoint": "tcp://localhost:"}},
|
"dispatchers" : {"me": {"endpoint": "tcp://localhost:"}},
|
||||||
// this means only we as a local instance
|
// this means only we as a local instance
|
||||||
"useSSLonDBservers" : false,
|
"useSSLonDBservers" : false,
|
||||||
"useSSLonCoordinators" : false
|
"useSSLonCoordinators" : false,
|
||||||
|
"valgrind" : "",
|
||||||
|
"valgrindopts" : [],
|
||||||
|
"valgrindXmlFileBase" : "",
|
||||||
|
"valgrindTestname" : ""
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some helpers using underscore:
|
// Some helpers using underscore:
|
||||||
|
@ -346,6 +350,11 @@ function fillConfigWithDefaults (config, defaultConfig) {
|
||||||
/// we use SSL on all DBservers in the cluster
|
/// we use SSL on all DBservers in the cluster
|
||||||
/// - *useSSLonCoordinators*: a boolean flag indicating whether or not
|
/// - *useSSLonCoordinators*: a boolean flag indicating whether or not
|
||||||
/// we use SSL on all coordinators in the cluster
|
/// 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
|
/// All these values have default values. Here is the current set of
|
||||||
/// default values:
|
/// default values:
|
||||||
|
@ -610,7 +619,12 @@ Planner.prototype.makePlan = function() {
|
||||||
"dataPath": config.dataPath,
|
"dataPath": config.dataPath,
|
||||||
"logPath": config.logPath,
|
"logPath": config.logPath,
|
||||||
"agentPath": config.agentPath,
|
"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++) {
|
for (j = 0; j < i; j++) {
|
||||||
ep = dispatchers[agents[j].dispatcher].endpoint;
|
ep = dispatchers[agents[j].dispatcher].endpoint;
|
||||||
tmp2.peers.push( exchangePort( ep, agents[j].intPort ) );
|
tmp2.peers.push( exchangePort( ep, agents[j].intPort ) );
|
||||||
|
@ -635,7 +649,12 @@ Planner.prototype.makePlan = function() {
|
||||||
"onlyLocalhost": config.onlyLocalhost,
|
"onlyLocalhost": config.onlyLocalhost,
|
||||||
"agency": copy(agencyPos),
|
"agency": copy(agencyPos),
|
||||||
"useSSLonDBservers": config.useSSLonDBservers,
|
"useSSLonDBservers": config.useSSLonDBservers,
|
||||||
"useSSLonCoordinators": config.useSSLonCoordinators } );
|
"useSSLonCoordinators": config.useSSLonCoordinators,
|
||||||
|
"valgrind": config.valgrind,
|
||||||
|
"valgrindopts": config.valgrindopts,
|
||||||
|
"valgrindXmlFileBase" : config.valgrindXmlFileBase,
|
||||||
|
"valgrindTestname" : config.valgrindTestname
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
var cc = [];
|
var cc = [];
|
||||||
|
|
|
@ -253,6 +253,7 @@ function startInstance (protocol, options, addArgs, testname) {
|
||||||
|
|
||||||
var endpoint;
|
var endpoint;
|
||||||
var pos;
|
var pos;
|
||||||
|
var valgrindopts = [];
|
||||||
var dispatcher;
|
var dispatcher;
|
||||||
if (options.cluster) {
|
if (options.cluster) {
|
||||||
dispatcher = {"endpoint":"tcp://localhost:",
|
dispatcher = {"endpoint":"tcp://localhost:",
|
||||||
|
@ -263,12 +264,26 @@ function startInstance (protocol, options, addArgs, testname) {
|
||||||
dispatcher.arangodExtraArgs = addArgs;
|
dispatcher.arangodExtraArgs = addArgs;
|
||||||
}
|
}
|
||||||
print("Temporary cluster data and logs are in",tmpDataDir);
|
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,
|
var p = new Planner({"numberOfDBservers":2,
|
||||||
"numberOfCoordinators":1,
|
"numberOfCoordinators":1,
|
||||||
"dispatchers": {"me": dispatcher},
|
"dispatchers": {"me": dispatcher},
|
||||||
"dataPath": tmpDataDir,
|
"dataPath": tmpDataDir,
|
||||||
"logPath": 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 = new Kickstarter(p.getPlan());
|
||||||
instanceInfo.kickstarter.launch();
|
instanceInfo.kickstarter.launch();
|
||||||
var runInfo = instanceInfo.kickstarter.runInfo;
|
var runInfo = instanceInfo.kickstarter.runInfo;
|
||||||
|
@ -309,7 +324,7 @@ function startInstance (protocol, options, addArgs, testname) {
|
||||||
}
|
}
|
||||||
if (typeof(options.valgrind) === 'string') {
|
if (typeof(options.valgrind) === 'string') {
|
||||||
var run = fs.join("bin","arangod");
|
var run = fs.join("bin","arangod");
|
||||||
var valgrindopts = options.valgrindargs.concat(
|
valgrindopts = options.valgrindargs.concat(
|
||||||
["--xml-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.xml',
|
["--xml-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.xml',
|
||||||
"--log-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.valgrind.log']);
|
"--log-file="+options.valgrindXmlFileBase + '_' + testname + '.%p.valgrind.log']);
|
||||||
var newargs=valgrindopts.concat([run]).concat(args);
|
var newargs=valgrindopts.concat([run]).concat(args);
|
||||||
|
|
|
@ -238,7 +238,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
|
||||||
hints.ai_flags = TRI_CONNECT_AI_FLAGS;
|
hints.ai_flags = TRI_CONNECT_AI_FLAGS;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
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);
|
error = getaddrinfo(_host.c_str(), portString.c_str(), &hints, &result);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue