mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into vpack
This commit is contained in:
commit
4a62f3d389
|
@ -748,20 +748,6 @@ endif ()
|
|||
|
||||
add_definitions("-DTRI_ZLIB_VERSION=\"${ZLIB_VERSION}\"")
|
||||
|
||||
################################################################################
|
||||
### @brief VELOCYPACK
|
||||
################################################################################
|
||||
|
||||
set(VELOCYPACK_VERSION "unknown" CACHE string "VELOCYPACK version")
|
||||
|
||||
if (NOT MSVC)
|
||||
set(VELOCYPACK_INCLUDE ${PROJECT_SOURCE_DIR}/3rdParty/velocypack/include CACHE path "VELOCYPACK include path")
|
||||
endif ()
|
||||
|
||||
if (VELOCYPACK_INCLUDE)
|
||||
include_directories(${VELOCYPACK_INCLUDE})
|
||||
endif ()
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
## --SECTION-- SUB-PROJECTS
|
||||
## -----------------------------------------------------------------------------
|
||||
|
|
|
@ -32,6 +32,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/tests/")
|
|||
### @brief basics_suite
|
||||
################################################################################
|
||||
|
||||
include_directories(../3rdParty/velocypack/include)
|
||||
|
||||
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
|
||||
add_executable(
|
||||
|
|
|
@ -482,9 +482,10 @@ bool ApplicationEndpointServer::createSslContext () {
|
|||
|
||||
// set options
|
||||
SSL_CTX_set_options(_sslContext, (long) _sslOptions);
|
||||
|
||||
LOG_INFO("using SSL options: %ld", (long) _sslOptions);
|
||||
|
||||
if (_sslCipherList.size() > 0) {
|
||||
if (! _sslCipherList.empty()) {
|
||||
if (SSL_CTX_set_cipher_list(_sslContext, _sslCipherList.c_str()) != 1) {
|
||||
LOG_ERROR("SSL error: %s", lastSSLError().c_str());
|
||||
LOG_FATAL_AND_EXIT("cannot set SSL cipher list '%s'", _sslCipherList.c_str());
|
||||
|
|
|
@ -41,19 +41,29 @@ using namespace std;
|
|||
using namespace triagens::arango;
|
||||
using namespace triagens::basics;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief cleans up shaped json values
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void CleanupShapes (std::vector<TRI_shaped_json_t*>& values) {
|
||||
for (auto& it : values) {
|
||||
if (it != nullptr) {
|
||||
TRI_FreeShapedJson(TRI_UNKNOWN_MEM_ZONE, it);
|
||||
}
|
||||
}
|
||||
values.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief cleans up the example object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ExampleMatcher::cleanup () {
|
||||
auto zone = _shaper->memoryZone();
|
||||
// clean shaped json objects
|
||||
for (auto& def : definitions) {
|
||||
for (auto& it : def._values) {
|
||||
TRI_FreeShapedJson(zone, it);
|
||||
it = nullptr;
|
||||
}
|
||||
CleanupShapes(def._values);
|
||||
}
|
||||
definitions.clear();
|
||||
}
|
||||
|
||||
void ExampleMatcher::fillExampleDefinition (v8::Isolate* isolate,
|
||||
|
@ -226,7 +236,6 @@ void ExampleMatcher::fillExampleDefinition (TRI_json_t const* example,
|
|||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Constructor using a v8::Object example
|
||||
|
@ -245,12 +254,13 @@ ExampleMatcher::ExampleMatcher (v8::Isolate* isolate,
|
|||
|
||||
try {
|
||||
ExampleMatcher::fillExampleDefinition(isolate, example, names, n, errorMessage, def);
|
||||
definitions.emplace_back(std::move(def));
|
||||
}
|
||||
catch (...) {
|
||||
CleanupShapes(def._values);
|
||||
ExampleMatcher::cleanup();
|
||||
throw;
|
||||
}
|
||||
definitions.emplace_back(move(def));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -278,12 +288,13 @@ ExampleMatcher::ExampleMatcher (v8::Isolate* isolate,
|
|||
|
||||
try {
|
||||
ExampleMatcher::fillExampleDefinition(isolate, example, names, n, errorMessage, def);
|
||||
definitions.emplace_back(std::move(def));
|
||||
}
|
||||
catch (...) {
|
||||
CleanupShapes(def._values);
|
||||
ExampleMatcher::cleanup();
|
||||
throw;
|
||||
}
|
||||
definitions.emplace_back(move(def));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,10 +313,11 @@ ExampleMatcher::ExampleMatcher (TRI_json_t const* example,
|
|||
ExampleMatcher::fillExampleDefinition(example, resolver, def);
|
||||
}
|
||||
catch (...) {
|
||||
CleanupShapes(def._values);
|
||||
ExampleMatcher::cleanup();
|
||||
throw;
|
||||
}
|
||||
definitions.emplace_back(move(def));
|
||||
definitions.emplace_back(std::move(def));
|
||||
}
|
||||
else if (TRI_IsArrayJson(example)) {
|
||||
size_t size = TRI_LengthArrayJson(example);
|
||||
|
@ -313,10 +325,11 @@ ExampleMatcher::ExampleMatcher (TRI_json_t const* example,
|
|||
ExampleDefinition def;
|
||||
try {
|
||||
ExampleMatcher::fillExampleDefinition(TRI_LookupArrayJson(example, i), resolver, def);
|
||||
definitions.emplace_back(move(def));
|
||||
definitions.emplace_back(std::move(def));
|
||||
}
|
||||
catch (triagens::basics::Exception& e) {
|
||||
if (e.code() != TRI_RESULT_ELEMENT_NOT_FOUND) {
|
||||
CleanupShapes(def._values);
|
||||
ExampleMatcher::cleanup();
|
||||
throw;
|
||||
}
|
||||
|
@ -324,7 +337,7 @@ ExampleMatcher::ExampleMatcher (TRI_json_t const* example,
|
|||
// might be matched.
|
||||
}
|
||||
}
|
||||
if (definitions.size() == 0) {
|
||||
if (definitions.empty()) {
|
||||
// None of the given examples could ever match.
|
||||
// Throw result not found so client can short circuit.
|
||||
THROW_ARANGO_EXCEPTION(TRI_RESULT_ELEMENT_NOT_FOUND);
|
||||
|
@ -342,8 +355,8 @@ bool ExampleMatcher::matches (TRI_voc_cid_t cid, TRI_doc_mptr_t const* mptr) con
|
|||
}
|
||||
TRI_shaped_json_t document;
|
||||
TRI_EXTRACT_SHAPED_JSON_MARKER(document, mptr->getDataPtr());
|
||||
for (auto def : definitions) {
|
||||
if (def._internal.size() > 0) {
|
||||
for (auto const& def : definitions) {
|
||||
if (! def._internal.empty()) {
|
||||
// Match _key
|
||||
auto it = def._internal.find(internalAttr::key);
|
||||
if (it != def._internal.end()) {
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace triagens {
|
|||
|
||||
~ExampleMatcher () {
|
||||
cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
bool matches (TRI_voc_cid_t cid,
|
||||
TRI_doc_mptr_t const* mptr) const;
|
||||
|
|
|
@ -5045,7 +5045,7 @@ triagens::arango::Index* TRI_EnsureFulltextIndexDocumentCollection (triagens::ar
|
|||
|
||||
std::vector<TRI_doc_mptr_copy_t> TRI_SelectByExample (
|
||||
TRI_transaction_collection_t* trxCollection,
|
||||
ExampleMatcher& matcher) {
|
||||
ExampleMatcher const& matcher) {
|
||||
|
||||
TRI_document_collection_t* document = trxCollection->_collection->_collection;
|
||||
|
||||
|
|
|
@ -1082,7 +1082,7 @@ triagens::arango::Index* TRI_EnsureFulltextIndexDocumentCollection (triagens::ar
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::vector<TRI_doc_mptr_copy_t> TRI_SelectByExample (struct TRI_transaction_collection_s*,
|
||||
triagens::arango::ExampleMatcher& matcher);
|
||||
triagens::arango::ExampleMatcher const& matcher);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes a select-by-example query
|
||||
|
|
|
@ -866,58 +866,6 @@ typedef struct TRI_shaped_json_s {
|
|||
}
|
||||
TRI_shaped_json_t;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Hash and Equal comparison for a vector of TRI_shaped_json_t
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace std {
|
||||
|
||||
template<> struct hash<std::vector<TRI_shaped_json_t>> {
|
||||
size_t operator () (std::vector<TRI_shaped_json_t> const& x) const {
|
||||
std::hash<TRI_shape_sid_t> sidHash;
|
||||
size_t res = 0xdeadbeef;
|
||||
for (auto& el : x) {
|
||||
res ^= sidHash(el._sid);
|
||||
if (el._data.data != nullptr) {
|
||||
res ^= fasthash64(el._data.data, el._data.length, 0xdeadbeef);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct equal_to<std::vector<TRI_shaped_json_t>> {
|
||||
bool operator () (std::vector<TRI_shaped_json_t> const& a,
|
||||
std::vector<TRI_shaped_json_t> const& b) const {
|
||||
size_t size = a.size();
|
||||
if (size != b.size()) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (a[i]._sid != b[i]._sid) {
|
||||
return false;
|
||||
}
|
||||
if (a[i]._data.data == nullptr || b[i]._data.data == nullptr) {
|
||||
if (a[i]._sid != b[i]._sid) {
|
||||
// this should be a TRI_SHAPE_SID_NULL value or TRI_SHAPE_SID_ILLEGAL
|
||||
return false;
|
||||
}
|
||||
// We cannot short circuit here. Fast forward to next i
|
||||
continue;
|
||||
}
|
||||
if (a[i]._data.length != b[i]._data.length) {
|
||||
return false;
|
||||
}
|
||||
if (memcmp(a[i]._data.data, b[i]._data.data, a[i]._data.length) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} //closes namespace std
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shaped json sub-object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1136,6 +1084,69 @@ void TRI_IterateShapeDataList (VocShaper*,
|
|||
void TRI_PrintShapeValues (TRI_shape_value_t*,
|
||||
size_t);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Hash and Equal comparison for a vector of TRI_shaped_json_t
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace std {
|
||||
|
||||
template<> struct hash<std::vector<TRI_shaped_json_t>> {
|
||||
size_t operator () (std::vector<TRI_shaped_json_t> const& x) const {
|
||||
std::hash<TRI_shape_sid_t> sidHash;
|
||||
size_t res = 0xdeadbeef;
|
||||
for (auto& el : x) {
|
||||
res ^= sidHash(el._sid);
|
||||
if (el._data.data != nullptr) {
|
||||
res ^= fasthash64(el._data.data, el._data.length, 0xdeadbeef);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct equal_to<std::vector<TRI_shaped_json_t>> {
|
||||
bool operator () (std::vector<TRI_shaped_json_t> const& a,
|
||||
std::vector<TRI_shaped_json_t> const& b) const {
|
||||
size_t size = a.size();
|
||||
if (size != b.size()) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (a[i]._sid != b[i]._sid) {
|
||||
return false;
|
||||
}
|
||||
if (a[i]._data.data == nullptr || b[i]._data.data == nullptr) {
|
||||
if (a[i]._sid != b[i]._sid) {
|
||||
// this should be a TRI_SHAPE_SID_NULL value or TRI_SHAPE_SID_ILLEGAL
|
||||
return false;
|
||||
}
|
||||
// We cannot short circuit here. Fast forward to next i
|
||||
continue;
|
||||
}
|
||||
if (a[i]._data.length != b[i]._data.length) {
|
||||
return false;
|
||||
}
|
||||
if (memcmp(a[i]._data.data, b[i]._data.data, a[i]._data.length) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class default_delete<TRI_shaped_json_t> {
|
||||
public:
|
||||
|
||||
void operator() (TRI_shaped_json_t* json) {
|
||||
if (json != nullptr) {
|
||||
TRI_FreeShapedJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} //closes namespace std
|
||||
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -125,13 +125,15 @@ function getAuthorization (dispatcher) {
|
|||
return getAuthorizationHeader(dispatcher.username, dispatcher.passwd);
|
||||
}
|
||||
|
||||
function waitForServerUp (endpoint, timeout) {
|
||||
function waitForServerUp (cmd, endpoint, timeout) {
|
||||
var url = endpointToURL(endpoint) + "/_api/version";
|
||||
var time = 0;
|
||||
while (true) {
|
||||
var r = download(url, "", {});
|
||||
if (r.code === 200 || r.code === 401) {
|
||||
console.info("Could talk to "+endpoint+" .");
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Could talk to "+endpoint+" .");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (time >= timeout) {
|
||||
|
@ -143,17 +145,19 @@ function waitForServerUp (endpoint, timeout) {
|
|||
}
|
||||
}
|
||||
|
||||
function waitForServerDown (endpoint, timeout) {
|
||||
function waitForServerDown (cmd, endpoint, timeout) {
|
||||
var url = endpointToURL(endpoint) + "/_api/version";
|
||||
var time = 0;
|
||||
while (true) {
|
||||
var r = download(url, "", {});
|
||||
if (r.code === 500 || r.code === 401) {
|
||||
console.info("Server at "+endpoint+" does not answer any more.");
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Server at " + endpoint + " does not answer any more.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (time >= timeout) {
|
||||
console.info("After timeout, server at "+endpoint+
|
||||
console.info("After timeout, server at " + endpoint +
|
||||
"is still there, giving up.");
|
||||
return false;
|
||||
}
|
||||
|
@ -162,16 +166,18 @@ function waitForServerDown (endpoint, timeout) {
|
|||
}
|
||||
}
|
||||
|
||||
function sendToAgency (agencyURL, path, obj) {
|
||||
function sendToAgency (cmd, agencyURL, path, obj) {
|
||||
var res;
|
||||
var body;
|
||||
|
||||
console.info("Sending %s to agency...", path);
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Sending %s to agency...", path);
|
||||
}
|
||||
if (typeof obj === "string") {
|
||||
var count = 0;
|
||||
while (count++ <= 2) {
|
||||
body = "value="+encodeURIComponent(obj);
|
||||
res = download(agencyURL+path,body,
|
||||
body = "value=" + encodeURIComponent(obj);
|
||||
res = download(agencyURL + path,body,
|
||||
{"method":"PUT", "followRedirects": true,
|
||||
"headers": { "Content-Type": "application/x-www-form-urlencoded"}});
|
||||
if (res.code === 201 || res.code === 200) {
|
||||
|
@ -188,7 +194,7 @@ function sendToAgency (agencyURL, path, obj) {
|
|||
var i;
|
||||
if (keys.length !== 0) {
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
res = sendToAgency (agencyURL, path+"/"+encode(keys[i]), obj[keys[i]]);
|
||||
res = sendToAgency(cmd, agencyURL, path + "/" + encode(keys[i]), obj[keys[i]]);
|
||||
if (res !== true) {
|
||||
return res;
|
||||
}
|
||||
|
@ -291,18 +297,18 @@ launchActions.startAgent = function (dispatchers, cmd, isRelaunch) {
|
|||
};
|
||||
|
||||
launchActions.sendConfiguration = function (dispatchers, cmd, isRelaunch) {
|
||||
var yaml = require("js-yaml");
|
||||
if (isRelaunch) {
|
||||
// nothing to do here
|
||||
console.info("Waiting 1 second for agency to come alive...");
|
||||
wait(1);
|
||||
return {"error":false, "isSendConfiguration": true};
|
||||
}
|
||||
var url = endpointToURL(cmd.agency.endpoints[0])+"/v2/keys";
|
||||
var res = sendToAgency(url, "", cmd.data);
|
||||
var url = endpointToURL(cmd.agency.endpoints[0]) + "/v2/keys";
|
||||
var res = sendToAgency(cmd, url, "", cmd.data);
|
||||
if (res === true) {
|
||||
return {"error":false, "isSendConfiguration": true};
|
||||
}
|
||||
var yaml = require("js-yaml");
|
||||
return {"error":true, "isSendConfiguration": true, "suberror": res, errorMessage : yaml.safeDump(res)};
|
||||
};
|
||||
|
||||
|
@ -316,17 +322,19 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
logPath = fs.normalize(fs.join(ArangoServerState.logPath(), cmd.logPath));
|
||||
}
|
||||
|
||||
var url = endpointToURL(cmd.agency.endpoints[0])+"/v2/keys/"+
|
||||
cmd.agency.agencyPrefix+"/";
|
||||
console.info("Downloading %sLaunchers/%s", url, encode(cmd.name));
|
||||
var res = download(url+"Launchers/"+encode(cmd.name),"",{method:"GET",
|
||||
followRedirects:true});
|
||||
var url = endpointToURL(cmd.agency.endpoints[0]) + "/v2/keys/"+
|
||||
cmd.agency.agencyPrefix + "/";
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Downloading %sLaunchers/%s", url, encode(cmd.name));
|
||||
}
|
||||
var res = download(url + "Launchers/" + encode(cmd.name), "", { method: "GET",
|
||||
followRedirects: true });
|
||||
if (res.code !== 200) {
|
||||
return {"error": true, "isStartServers": true, "suberror": res};
|
||||
}
|
||||
var body = JSON.parse( res.body );
|
||||
var info = JSON.parse(body.node.value);
|
||||
var id,ep,args,pids,port,endpoints,endpointNames,roles;
|
||||
var id, ep, args, pids, port, endpoints, endpointNames, roles;
|
||||
|
||||
console.info("Starting servers...");
|
||||
var i;
|
||||
|
@ -343,8 +351,10 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
endpointNames = [];
|
||||
for (i = 0; i < servers.length; i++) {
|
||||
id = servers[i];
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
res = download(url+"Target/MapIDToEndpoint/"+id);
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
}
|
||||
res = download(url + "Target/MapIDToEndpoint/" + id);
|
||||
if (res.code !== 200) {
|
||||
return {"error": true, "pids": pids,
|
||||
"isStartServers": true, "suberror": res};
|
||||
|
@ -370,13 +380,13 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
"--cluster.agency-endpoint", cmd.agency.endpoints[0],
|
||||
"--server.endpoint"]);
|
||||
if (cmd.onlyLocalhost) {
|
||||
args.push(exchangeProtocol("tcp://127.0.0.1:"+port,useSSL));
|
||||
args.push(exchangeProtocol("tcp://127.0.0.1:" + port, useSSL));
|
||||
}
|
||||
else {
|
||||
args.push(exchangeProtocol("tcp://0.0.0.0:"+port,useSSL));
|
||||
args.push(exchangeProtocol("tcp://0.0.0.0:" + port, useSSL));
|
||||
}
|
||||
args.push("--log.file");
|
||||
var logfile = fs.join(logPath,"log-"+cmd.agency.agencyPrefix+"-"+id);
|
||||
var logfile = fs.join(logPath, "log-" + cmd.agency.agencyPrefix + "-" + id);
|
||||
args.push(logfile);
|
||||
if (!isRelaunch) {
|
||||
if (!fs.exists(logPath)) {
|
||||
|
@ -386,7 +396,7 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
fs.remove(logfile);
|
||||
}
|
||||
}
|
||||
var datadir = fs.join(dataPath,"data-"+cmd.agency.agencyPrefix+"-"+id);
|
||||
var datadir = fs.join(dataPath, "data-" + cmd.agency.agencyPrefix + "-" + id);
|
||||
if (!isRelaunch) {
|
||||
if (!fs.exists(dataPath)) {
|
||||
fs.makeDirectoryRecursive(dataPath);
|
||||
|
@ -407,8 +417,8 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
(cmd.valgrindHosts !== undefined) &&
|
||||
(cmd.valgrindHosts.indexOf(roles[i]) > -1)) {
|
||||
var valgrindopts = cmd.valgrindopts.concat(
|
||||
["--xml-file="+cmd.valgrindXmlFileBase + '_' + cmd.valgrindTestname + '_' + id + '.%p.xml',
|
||||
"--log-file="+cmd.valgrindXmlFileBase + '_' + cmd.valgrindTestname + '_' + id + '.%p.valgrind.log']);
|
||||
["--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));
|
||||
|
@ -428,7 +438,7 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
if (cmd.valgrind !== '') {
|
||||
timeout *= 10000;
|
||||
}
|
||||
if (! waitForServerUp(endpoints[i], timeout)) {
|
||||
if (! waitForServerUp(cmd, endpoints[i], timeout)) {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +571,7 @@ shutdownActions.startServers = function (dispatchers, cmd, run) {
|
|||
}
|
||||
}
|
||||
for (i = 0;i < run.endpoints.length;i++) {
|
||||
waitForServerDown(run.endpoints[i], 30);
|
||||
waitForServerDown(cmd, run.endpoints[i], 30);
|
||||
// we cannot do much with the result...
|
||||
}
|
||||
|
||||
|
@ -656,7 +666,9 @@ cleanupActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
};
|
||||
|
||||
isHealthyActions.startAgent = function (dispatchers, cmd, run) {
|
||||
console.info("Checking health of agent %s", JSON.stringify(run.pid));
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Checking health of agent %s", JSON.stringify(run.pid));
|
||||
}
|
||||
var r = statusExternal(run.pid);
|
||||
r.isStartAgent = true;
|
||||
r.error = false;
|
||||
|
@ -667,19 +679,20 @@ isHealthyActions.startServers = function (dispatchers, cmd, run) {
|
|||
var i;
|
||||
var r = [];
|
||||
for (i = 0;i < run.pids.length;i++) {
|
||||
console.info("Checking health of %s %s %s %s",
|
||||
run.roles[i],
|
||||
run.endpointNames[i],
|
||||
run.endpoints[i],
|
||||
JSON.stringify(run.pids[i]));
|
||||
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Checking health of %s %s %s %s",
|
||||
run.roles[i],
|
||||
run.endpointNames[i],
|
||||
run.endpoints[i],
|
||||
JSON.stringify(run.pids[i]));
|
||||
}
|
||||
r.push(statusExternal(run.pids[i]));
|
||||
}
|
||||
var s = [];
|
||||
var x;
|
||||
var error = false;
|
||||
for (i = 0;i < run.endpoints.length;i++) {
|
||||
x = waitForServerUp(run.endpoints[i], 0);
|
||||
x = waitForServerUp(cmd, run.endpoints[i], 0);
|
||||
s.push(x);
|
||||
if (x === false) {
|
||||
error = true;
|
||||
|
@ -713,9 +726,11 @@ upgradeActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
|
||||
var url = endpointToURL(cmd.agency.endpoints[0])+"/v2/keys/"+
|
||||
cmd.agency.agencyPrefix+"/";
|
||||
console.info("Downloading %sLaunchers/%s", url, encode(cmd.name));
|
||||
var res = download(url+"Launchers/"+encode(cmd.name),"",{method:"GET",
|
||||
followRedirects:true});
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Downloading %sLaunchers/%s", url, encode(cmd.name));
|
||||
}
|
||||
var res = download(url+"Launchers/" + encode(cmd.name), "", { method: "GET",
|
||||
followRedirects: true });
|
||||
if (res.code !== 200) {
|
||||
return {"error": true, "isStartServers": true, "suberror": res};
|
||||
}
|
||||
|
@ -740,8 +755,10 @@ upgradeActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
var logfile, datadir;
|
||||
for (i = 0; i < servers.length; i++) {
|
||||
id = servers[i];
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
res = download(url+"Target/MapIDToEndpoint/"+id);
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
}
|
||||
res = download(url + "Target/MapIDToEndpoint/" + id);
|
||||
if (res.code !== 200) {
|
||||
return {"error": true, "pids": pids,
|
||||
"isStartServers": true, "suberror": res};
|
||||
|
@ -818,8 +835,10 @@ upgradeActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
endpointNames = [];
|
||||
for (i = 0; i < servers.length; i++) {
|
||||
id = servers[i];
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
res = download(url+"Target/MapIDToEndpoint/"+id);
|
||||
if (cmd.extremeVerbosity) {
|
||||
console.info("Downloading %sTarget/MapIDToEndpoint/%s", url, id);
|
||||
}
|
||||
res = download(url + "Target/MapIDToEndpoint/" + id);
|
||||
if (res.code !== 200) {
|
||||
return {"error": true, "pids": pids,
|
||||
"isStartServers": true, "suberror": res};
|
||||
|
@ -887,7 +906,7 @@ upgradeActions.startServers = function (dispatchers, cmd, isRelaunch) {
|
|||
|
||||
error = false;
|
||||
for (i = 0;i < endpoints.length;i++) {
|
||||
if (! waitForServerUp(endpoints[i], 30)) {
|
||||
if (! waitForServerUp(cmd, endpoints[i], 30)) {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -1005,6 +1024,7 @@ function Kickstarter (clusterPlan, myname) {
|
|||
else {
|
||||
this.myname = myname;
|
||||
}
|
||||
require("internal").print("KOCKSTARTER PLAN: ", clusterPlan);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -63,7 +63,8 @@ var PlannerLocalDefaults = {
|
|||
"valgrindopts" : [],
|
||||
"valgrindXmlFileBase" : "",
|
||||
"valgrindTestname" : "",
|
||||
"valgrindHosts" : ""
|
||||
"valgrindHosts" : "",
|
||||
"extremeVerbosity" : true
|
||||
};
|
||||
|
||||
// Some helpers using underscore:
|
||||
|
@ -402,6 +403,8 @@ function checkDispatcherIps (config) {
|
|||
/// - *valgrindTestname*: name of test to add to the logfiles
|
||||
/// - *valgrindHosts*: which host classes should run in valgrind?
|
||||
/// Coordinator / DBServer
|
||||
/// - *extremeVerbosity* : if set to true, then there will be more test
|
||||
/// run output, especially for cluster tests.
|
||||
///
|
||||
/// All these values have default values. Here is the current set of
|
||||
/// default values:
|
||||
|
@ -439,10 +442,12 @@ function Planner (userConfig) {
|
|||
if (typeof userConfig !== "object") {
|
||||
throw new Error("userConfig must be an object");
|
||||
}
|
||||
require("internal").print("PLANNER USERCONFIG: ", userConfig);
|
||||
this.config = copy(userConfig);
|
||||
checkDispatcherIps(this.config);
|
||||
|
||||
fillConfigWithDefaults(this.config, PlannerLocalDefaults);
|
||||
require("internal").print("PLANNER USERCONFIG NOW: ", this.config);
|
||||
this.commands = [];
|
||||
this.makePlan();
|
||||
}
|
||||
|
@ -676,7 +681,8 @@ Planner.prototype.makePlan = function() {
|
|||
"valgrindopts" : config.valgrindopts,
|
||||
"valgrindXmlFileBase" : config.valgrindXmlFileBase,
|
||||
"valgrindTestname" : config.valgrindXmlFileBase,
|
||||
"valgrindHosts" : config.valgrindHosts
|
||||
"valgrindHosts" : config.valgrindHosts,
|
||||
"extremeVerbosity" : config.extremeVerbosity
|
||||
};
|
||||
for (j = 0; j < i; j++) {
|
||||
ep = dispatchers[agents[j].dispatcher].endpoint;
|
||||
|
@ -688,9 +694,13 @@ Planner.prototype.makePlan = function() {
|
|||
"endpoints": agents.map(function(a) {
|
||||
return exchangePort(dispatchers[a.dispatcher].endpoint,
|
||||
a.extPort);}) };
|
||||
tmp.push( { "action": "sendConfiguration",
|
||||
"agency": agencyPos,
|
||||
"data": agencyData } );
|
||||
tmp.push({
|
||||
"action": "sendConfiguration",
|
||||
"agency": agencyPos,
|
||||
"data": agencyData,
|
||||
"extremeVerbosity": config.extremeVerbosity
|
||||
});
|
||||
|
||||
for (i = 0; i < dispList.length; i++) {
|
||||
tmp.push( { "action" : "startServers",
|
||||
"dispatcher" : dispList[i],
|
||||
|
@ -708,7 +718,8 @@ Planner.prototype.makePlan = function() {
|
|||
"valgrindopts" : config.valgrindopts,
|
||||
"valgrindXmlFileBase" : config.valgrindXmlFileBase,
|
||||
"valgrindTestname" : config.valgrindTestname,
|
||||
"valgrindHosts" : config.valgrindHosts
|
||||
"valgrindHosts" : config.valgrindHosts,
|
||||
"extremeVerbosity" : config.extremeVerbosity
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -734,9 +745,12 @@ Planner.prototype.makePlan = function() {
|
|||
dd.push(endpointToURL(e));
|
||||
}
|
||||
|
||||
tmp.push( { "action": "bootstrapServers",
|
||||
"dbServers": dd,
|
||||
"coordinators": cc });
|
||||
tmp.push({
|
||||
"action": "bootstrapServers",
|
||||
"dbServers": dd,
|
||||
"coordinators": cc,
|
||||
"extremeVerbosity": config.extremeVerbosity
|
||||
});
|
||||
|
||||
this.myname = "me";
|
||||
};
|
||||
|
|
|
@ -55,19 +55,19 @@ var optionsDocumentation = [
|
|||
' - `force`: if set to true the tests are continued even if one fails',
|
||||
' - `skipBoost`: if set to true the boost unittests are skipped',
|
||||
' - `skipGeo`: if set to true the geo index tests are skipped',
|
||||
' - `skipGraph`: if set to true the Graph tests are skipped',
|
||||
' - `skipGraph`: if set to true the graph tests are skipped',
|
||||
' - `skipAql`: if set to true the AQL tests are skipped',
|
||||
' - `skipArangoB`: if set to true benchmark tests are skipped',
|
||||
' - `skipArangoBNonConnKeepAlive`: if set to true benchmark tests are skipped',
|
||||
' - `skipRanges`: if set to true the ranges tests are skipped',
|
||||
' - `skipTimeCritical`: if set to true, time critical tests will be skipped.',
|
||||
' - `skipMemoryIntense`: tests using lots of resources will be skippet.',
|
||||
' - `skipMemoryIntense`: tests using lots of resources will be skipped.',
|
||||
' - `skipAuth : testing authentication will be skipped.',
|
||||
' - `skipSsl`: ommit the ssl_server rspec tests.',
|
||||
' - `skipSsl`: omit the ssl_server rspec tests.',
|
||||
' - `skipLogAnalysis`: don\'t try to crawl the server logs',
|
||||
' - `skipConfig`: ommit the noisy configuration tests',
|
||||
' - `skipFoxxQueues`: ommit the test for the foxx queues',
|
||||
' - `skipNightly`: ommit the nightly tests',
|
||||
' - `skipConfig`: omit the noisy configuration tests',
|
||||
' - `skipFoxxQueues`: omit the test for the foxx queues',
|
||||
' - `skipNightly`: omit the nightly tests',
|
||||
' - `onlyNightly`: execute only the nightly tests',
|
||||
'',
|
||||
' - `cluster`: if set to true the tests are run with the coordinator',
|
||||
|
@ -90,6 +90,8 @@ var optionsDocumentation = [
|
|||
' - `valgrindargs`: list of commandline parameters to add to valgrind',
|
||||
'',
|
||||
' - `extraargs`: list of extra commandline arguments to add to arangod',
|
||||
' - `extremeVerbosity`: if set to true, then there will be more test run',
|
||||
' output, especially for cluster tests.',
|
||||
' - `portOffset`: move our base port by n ports up',
|
||||
''
|
||||
];
|
||||
|
@ -118,51 +120,51 @@ var toArgv = require("internal").toArgv;
|
|||
|
||||
var serverCrashed = false;
|
||||
|
||||
var optionsDefaults = { "cluster": false,
|
||||
"valgrind": false,
|
||||
"force": true,
|
||||
"skipBoost": false,
|
||||
"skipGeo": false,
|
||||
"skipTimeCritical": false,
|
||||
"skipNightly": true,
|
||||
"onlyNightly": false,
|
||||
"skipMemoryIntense": false,
|
||||
"skipAql": false,
|
||||
"skipArangoB": false,
|
||||
"skipArangoBNonConnKeepAlive": false,
|
||||
"skipRanges": false,
|
||||
"skipLogAnalysis": false,
|
||||
"username": "root",
|
||||
"password": "",
|
||||
"test": undefined,
|
||||
"cleanup": true,
|
||||
"jsonReply": false,
|
||||
"portOffset": 0,
|
||||
"valgrindargs": [],
|
||||
"valgrindXmlFileBase" : "",
|
||||
"extraargs": [],
|
||||
"coreDirectory": "/var/tmp",
|
||||
"writeXmlReport": true
|
||||
|
||||
var optionsDefaults = {
|
||||
"cluster": false,
|
||||
"valgrind": false,
|
||||
"force": true,
|
||||
"skipBoost": false,
|
||||
"skipGeo": false,
|
||||
"skipTimeCritical": false,
|
||||
"skipNightly": true,
|
||||
"onlyNightly": false,
|
||||
"skipMemoryIntense": false,
|
||||
"skipAql": false,
|
||||
"skipArangoB": false,
|
||||
"skipArangoBNonConnKeepAlive": false,
|
||||
"skipRanges": false,
|
||||
"skipLogAnalysis": false,
|
||||
"username": "root",
|
||||
"password": "",
|
||||
"test": undefined,
|
||||
"cleanup": true,
|
||||
"jsonReply": false,
|
||||
"portOffset": 0,
|
||||
"valgrindargs": [],
|
||||
"valgrindXmlFileBase" : "",
|
||||
"extraargs": [],
|
||||
"coreDirectory": "/var/tmp",
|
||||
"writeXmlReport": true,
|
||||
"extremeVerbosity": true
|
||||
};
|
||||
var allTests =
|
||||
[
|
||||
"config",
|
||||
"boost",
|
||||
"shell_server",
|
||||
"shell_server_aql",
|
||||
"http_server",
|
||||
"ssl_server",
|
||||
"shell_client",
|
||||
"dump",
|
||||
"arangob",
|
||||
"arangosh",
|
||||
"importing",
|
||||
"upgrade",
|
||||
"authentication",
|
||||
"authentication_parameters"
|
||||
];
|
||||
|
||||
var allTests = [
|
||||
"config",
|
||||
"boost",
|
||||
"shell_server",
|
||||
"shell_server_aql",
|
||||
"http_server",
|
||||
"ssl_server",
|
||||
"shell_client",
|
||||
"dump",
|
||||
"arangob",
|
||||
"arangosh",
|
||||
"importing",
|
||||
"upgrade",
|
||||
"authentication",
|
||||
"authentication_parameters"
|
||||
];
|
||||
|
||||
function printUsage () {
|
||||
print();
|
||||
|
@ -186,7 +188,7 @@ function printUsage () {
|
|||
else {
|
||||
checkAll = ' ';
|
||||
}
|
||||
print(' ' + checkAll + ' '+i+' ' + oneFunctionDocumentation);
|
||||
print(' ' + checkAll + ' '+ i + ' ' + oneFunctionDocumentation);
|
||||
}
|
||||
}
|
||||
for (i in optionsDocumentation) {
|
||||
|
@ -355,7 +357,7 @@ function startInstance (protocol, options, addArgs, testname, tmpDir) {
|
|||
"arangodExtraArgs": toArgv(extraargs),
|
||||
"username": "root",
|
||||
"password": ""};
|
||||
print("Temporary cluster data and logs are in",tmpDataDir);
|
||||
print("Temporary cluster data and logs are in", tmpDataDir);
|
||||
|
||||
var runInValgrind = "";
|
||||
var valgrindXmlFileBase = "";
|
||||
|
@ -374,8 +376,11 @@ function startInstance (protocol, options, addArgs, testname, tmpDir) {
|
|||
"valgrindopts" : toArgv(valgrindopts, true),
|
||||
"valgrindXmlFileBase" : valgrindXmlFileBase + '_cluster',
|
||||
"valgrindTestname" : testname,
|
||||
"valgrindHosts" : valgrindHosts
|
||||
"valgrindHosts" : valgrindHosts,
|
||||
"extremeVerbosity" : options.extremeVerbosity
|
||||
});
|
||||
|
||||
require("internal").print("OPTIONS",options);
|
||||
instanceInfo.kickstarter = new Kickstarter(p.getPlan());
|
||||
var rc = instanceInfo.kickstarter.launch();
|
||||
if (rc.error) {
|
||||
|
@ -1083,7 +1088,9 @@ function performTests(options, testList, testname, remote) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
if (options.extremeVerbosity) {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (remote) {
|
||||
|
@ -1307,7 +1314,9 @@ testFuncs.shell_client = function(options) {
|
|||
continueTesting = checkInstanceAlive(instanceInfo, options);
|
||||
}
|
||||
else {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
if (options.extremeVerbosity) {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
print("Shutting down...");
|
||||
|
@ -1460,7 +1469,9 @@ function rubyTests (options, ssl) {
|
|||
|
||||
}
|
||||
else {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
if (options.extremeVerbosity) {
|
||||
print("Skipped " + te + " because of " + filtered.filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1624,7 +1635,9 @@ var impTodo = [
|
|||
|
||||
testFuncs.importing = function (options) {
|
||||
if (options.cluster) {
|
||||
print("Skipped because of cluster.");
|
||||
if (options.extremeVerbosity) {
|
||||
print("Skipped because of cluster.");
|
||||
}
|
||||
return {"importing":
|
||||
{
|
||||
"status" : true,
|
||||
|
|
|
@ -346,7 +346,7 @@ function nestedArrayInArraySuite () {
|
|||
assertEqual(0, result.warnings.length);
|
||||
|
||||
c2.ensureIndex({ type: "hash", fields: [ "values[*]" ] });
|
||||
var result = AQL_EXECUTE(query, { "@c1" : cn1, "@c2" : cn2 });
|
||||
result = AQL_EXECUTE(query, { "@c1" : cn1, "@c2" : cn2 });
|
||||
assertEqual(expected.sort(), result.json.sort());
|
||||
assertEqual(0, result.warnings.length);
|
||||
assertTrue(indexUsed(query, { "@c1": cn1, "@c2" : cn2 }));
|
||||
|
|
Loading…
Reference in New Issue