mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
Conflicts: js/common/modules/jsunity.js
This commit is contained in:
commit
f0fc42645b
|
@ -69,10 +69,10 @@ AgencyEndpoint::AgencyEndpoint (triagens::rest::Endpoint* endpoint,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
AgencyEndpoint::~AgencyEndpoint () {
|
AgencyEndpoint::~AgencyEndpoint () {
|
||||||
if (_connection != 0) {
|
if (_connection != nullptr) {
|
||||||
delete _connection;
|
delete _connection;
|
||||||
}
|
}
|
||||||
if (_endpoint != 0) {
|
if (_endpoint != nullptr) {
|
||||||
delete _endpoint;
|
delete _endpoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ AgencyCommResult::~AgencyCommResult () {
|
||||||
std::map<std::string, AgencyCommResultEntry>::iterator it = _values.begin();
|
std::map<std::string, AgencyCommResultEntry>::iterator it = _values.begin();
|
||||||
|
|
||||||
while (it != _values.end()) {
|
while (it != _values.end()) {
|
||||||
if ((*it).second._json != 0) {
|
if ((*it).second._json != nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, (*it).second._json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, (*it).second._json);
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
@ -145,7 +145,7 @@ int AgencyCommResult::errorCode () const {
|
||||||
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, _body.c_str());
|
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, _body.c_str());
|
||||||
|
|
||||||
if (! TRI_IsArrayJson(json)) {
|
if (! TRI_IsArrayJson(json)) {
|
||||||
if (json != 0) {
|
if (json != nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -227,7 +227,7 @@ void AgencyCommResult::clear () {
|
||||||
std::map<std::string, AgencyCommResultEntry>::iterator it = _values.begin();
|
std::map<std::string, AgencyCommResultEntry>::iterator it = _values.begin();
|
||||||
|
|
||||||
while (it != _values.end()) {
|
while (it != _values.end()) {
|
||||||
if ((*it).second._json != 0) {
|
if ((*it).second._json != nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, (*it).second._json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, (*it).second._json);
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
@ -343,7 +343,7 @@ bool AgencyCommResult::parse (std::string const& stripKeyPrefix,
|
||||||
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, _body.c_str());
|
TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, _body.c_str());
|
||||||
|
|
||||||
if (! TRI_IsArrayJson(json)) {
|
if (! TRI_IsArrayJson(json)) {
|
||||||
if (json != 0) {
|
if (json != nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -418,7 +418,7 @@ AgencyCommLocker::AgencyCommLocker (std::string const& key,
|
||||||
double ttl)
|
double ttl)
|
||||||
: _key(key),
|
: _key(key),
|
||||||
_type(type),
|
_type(type),
|
||||||
_json(0),
|
_json(nullptr),
|
||||||
_version(0),
|
_version(0),
|
||||||
_isLocked(false) {
|
_isLocked(false) {
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ AgencyCommLocker::AgencyCommLocker (std::string const& key,
|
||||||
|
|
||||||
_json = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, type.c_str(), type.size());
|
_json = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, type.c_str(), type.size());
|
||||||
|
|
||||||
if (_json == 0) {
|
if (_json == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ AgencyCommLocker::AgencyCommLocker (std::string const& key,
|
||||||
AgencyCommLocker::~AgencyCommLocker () {
|
AgencyCommLocker::~AgencyCommLocker () {
|
||||||
unlock();
|
unlock();
|
||||||
|
|
||||||
if (_json != 0) {
|
if (_json != nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, _json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, _json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ bool AgencyCommLocker::updateVersion (AgencyComm& comm) {
|
||||||
if (_version == 0) {
|
if (_version == 0) {
|
||||||
TRI_json_t* json = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, 1);
|
TRI_json_t* json = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, 1);
|
||||||
|
|
||||||
if (json == 0) {
|
if (json == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,13 +531,13 @@ bool AgencyCommLocker::updateVersion (AgencyComm& comm) {
|
||||||
// Version key found, now update it
|
// Version key found, now update it
|
||||||
TRI_json_t* oldJson = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, _version);
|
TRI_json_t* oldJson = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, _version);
|
||||||
|
|
||||||
if (oldJson == 0) {
|
if (oldJson == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_json_t* newJson = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, _version + 1);
|
TRI_json_t* newJson = triagens::basics::JsonHelper::uint64String(TRI_UNKNOWN_MEM_ZONE, _version + 1);
|
||||||
|
|
||||||
if (newJson == 0) {
|
if (newJson == nullptr) {
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, oldJson);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, oldJson);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ void AgencyComm::cleanup () {
|
||||||
while (it != _globalEndpoints.end()) {
|
while (it != _globalEndpoints.end()) {
|
||||||
AgencyEndpoint* agencyEndpoint = (*it);
|
AgencyEndpoint* agencyEndpoint = (*it);
|
||||||
|
|
||||||
TRI_ASSERT(agencyEndpoint != 0);
|
TRI_ASSERT(agencyEndpoint != nullptr);
|
||||||
delete agencyEndpoint;
|
delete agencyEndpoint;
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
|
@ -624,9 +624,9 @@ bool AgencyComm::tryConnect () {
|
||||||
while (it != _globalEndpoints.end()) {
|
while (it != _globalEndpoints.end()) {
|
||||||
AgencyEndpoint* agencyEndpoint = (*it);
|
AgencyEndpoint* agencyEndpoint = (*it);
|
||||||
|
|
||||||
TRI_ASSERT(agencyEndpoint != 0);
|
TRI_ASSERT(agencyEndpoint != nullptr);
|
||||||
TRI_ASSERT(agencyEndpoint->_endpoint != 0);
|
TRI_ASSERT(agencyEndpoint->_endpoint != nullptr);
|
||||||
TRI_ASSERT(agencyEndpoint->_connection != 0);
|
TRI_ASSERT(agencyEndpoint->_connection != nullptr);
|
||||||
|
|
||||||
if (agencyEndpoint->_endpoint->isConnected()) {
|
if (agencyEndpoint->_endpoint->isConnected()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -659,9 +659,9 @@ void AgencyComm::disconnect () {
|
||||||
while (it != _globalEndpoints.end()) {
|
while (it != _globalEndpoints.end()) {
|
||||||
AgencyEndpoint* agencyEndpoint = (*it);
|
AgencyEndpoint* agencyEndpoint = (*it);
|
||||||
|
|
||||||
TRI_ASSERT(agencyEndpoint != 0);
|
TRI_ASSERT(agencyEndpoint != nullptr);
|
||||||
TRI_ASSERT(agencyEndpoint->_connection != 0);
|
TRI_ASSERT(agencyEndpoint->_connection != nullptr);
|
||||||
TRI_ASSERT(agencyEndpoint->_endpoint != 0);
|
TRI_ASSERT(agencyEndpoint->_endpoint != nullptr);
|
||||||
|
|
||||||
agencyEndpoint->_connection->disconnect();
|
agencyEndpoint->_connection->disconnect();
|
||||||
agencyEndpoint->_endpoint->disconnect();
|
agencyEndpoint->_endpoint->disconnect();
|
||||||
|
|
|
@ -952,6 +952,7 @@ int ClusterInfo::createDatabaseCoordinator (string const& name,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now wait for it to appear and be complete:
|
// Now wait for it to appear and be complete:
|
||||||
|
res.clear();
|
||||||
res = ac.getValues("Current/Version", false);
|
res = ac.getValues("Current/Version", false);
|
||||||
if (! res.successful()) {
|
if (! res.successful()) {
|
||||||
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
||||||
|
@ -964,6 +965,7 @@ int ClusterInfo::createDatabaseCoordinator (string const& name,
|
||||||
|
|
||||||
string where = "Current/Databases/" + name;
|
string where = "Current/Databases/" + name;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where+"/", false)) {
|
if (res.successful() && res.parse(where+"/", false)) {
|
||||||
if (res._values.size() == DBServers.size()) {
|
if (res._values.size() == DBServers.size()) {
|
||||||
|
@ -999,6 +1001,7 @@ int ClusterInfo::createDatabaseCoordinator (string const& name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, getReloadServerListTimeout() / interval, false);
|
res = ac.watchValue("Current/Version", index, getReloadServerListTimeout() / interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
if (++count >= static_cast<int>(getReloadServerListTimeout() / interval)) {
|
if (++count >= static_cast<int>(getReloadServerListTimeout() / interval)) {
|
||||||
|
@ -1050,6 +1053,7 @@ int ClusterInfo::dropDatabaseCoordinator (string const& name, string& errorMsg,
|
||||||
errorMsg);
|
errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.removeValues("Plan/Collections/" + name, true);
|
res = ac.removeValues("Plan/Collections/" + name, true);
|
||||||
|
|
||||||
if (! res.successful() && res.httpCode() != (int) rest::HttpResponse::NOT_FOUND) {
|
if (! res.successful() && res.httpCode() != (int) rest::HttpResponse::NOT_FOUND) {
|
||||||
|
@ -1061,6 +1065,7 @@ int ClusterInfo::dropDatabaseCoordinator (string const& name, string& errorMsg,
|
||||||
_collectionsValid = false;
|
_collectionsValid = false;
|
||||||
|
|
||||||
// Now wait for it to appear and be complete:
|
// Now wait for it to appear and be complete:
|
||||||
|
res.clear();
|
||||||
res = ac.getValues("Current/Version", false);
|
res = ac.getValues("Current/Version", false);
|
||||||
if (!res.successful()) {
|
if (!res.successful()) {
|
||||||
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
||||||
|
@ -1070,11 +1075,13 @@ int ClusterInfo::dropDatabaseCoordinator (string const& name, string& errorMsg,
|
||||||
|
|
||||||
string where = "Current/Databases/" + name;
|
string where = "Current/Databases/" + name;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where+"/", false)) {
|
if (res.successful() && res.parse(where+"/", false)) {
|
||||||
if (res._values.size() == 0) {
|
if (res._values.size() == 0) {
|
||||||
AgencyCommLocker locker("Current", "WRITE");
|
AgencyCommLocker locker("Current", "WRITE");
|
||||||
if (locker.successful()) {
|
if (locker.successful()) {
|
||||||
|
res.clear();
|
||||||
res = ac.removeValues(where, true);
|
res = ac.removeValues(where, true);
|
||||||
if (res.successful()) {
|
if (res.successful()) {
|
||||||
return setErrormsg(TRI_ERROR_NO_ERROR, errorMsg);
|
return setErrormsg(TRI_ERROR_NO_ERROR, errorMsg);
|
||||||
|
@ -1085,7 +1092,7 @@ int ClusterInfo::dropDatabaseCoordinator (string const& name, string& errorMsg,
|
||||||
return setErrormsg(TRI_ERROR_NO_ERROR, errorMsg);
|
return setErrormsg(TRI_ERROR_NO_ERROR, errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, interval, false);
|
res = ac.watchValue("Current/Version", index, interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
}
|
}
|
||||||
|
@ -1162,6 +1169,7 @@ int ClusterInfo::createCollectionCoordinator (string const& databaseName,
|
||||||
|
|
||||||
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where+"/", false)) {
|
if (res.successful() && res.parse(where+"/", false)) {
|
||||||
if (res._values.size() == (size_t) numberOfShards) {
|
if (res._values.size() == (size_t) numberOfShards) {
|
||||||
|
@ -1197,6 +1205,7 @@ int ClusterInfo::createCollectionCoordinator (string const& databaseName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, interval, false);
|
res = ac.watchValue("Current/Version", index, interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
}
|
}
|
||||||
|
@ -1245,6 +1254,7 @@ int ClusterInfo::dropCollectionCoordinator (string const& databaseName,
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
// Now wait for it to appear and be complete:
|
// Now wait for it to appear and be complete:
|
||||||
|
res.clear();
|
||||||
res = ac.getValues("Current/Version", false);
|
res = ac.getValues("Current/Version", false);
|
||||||
if (!res.successful()) {
|
if (!res.successful()) {
|
||||||
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
return setErrormsg(TRI_ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION,
|
||||||
|
@ -1255,6 +1265,7 @@ int ClusterInfo::dropCollectionCoordinator (string const& databaseName,
|
||||||
// monitor the entry for the collection
|
// monitor the entry for the collection
|
||||||
const string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
const string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where+"/", false)) {
|
if (res.successful() && res.parse(where+"/", false)) {
|
||||||
// if there are no more active shards for the collection...
|
// if there are no more active shards for the collection...
|
||||||
|
@ -1262,6 +1273,7 @@ int ClusterInfo::dropCollectionCoordinator (string const& databaseName,
|
||||||
// ...remove the entire directory for the collection
|
// ...remove the entire directory for the collection
|
||||||
AgencyCommLocker locker("Current", "WRITE");
|
AgencyCommLocker locker("Current", "WRITE");
|
||||||
if (locker.successful()) {
|
if (locker.successful()) {
|
||||||
|
res.clear();
|
||||||
res = ac.removeValues("Current/Collections/"+databaseName+"/"+
|
res = ac.removeValues("Current/Collections/"+databaseName+"/"+
|
||||||
collectionID, true);
|
collectionID, true);
|
||||||
if (res.successful()) {
|
if (res.successful()) {
|
||||||
|
@ -1274,6 +1286,7 @@ int ClusterInfo::dropCollectionCoordinator (string const& databaseName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, interval, false);
|
res = ac.watchValue("Current/Version", index, interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
}
|
}
|
||||||
|
@ -1331,6 +1344,7 @@ int ClusterInfo::setCollectionPropertiesCoordinator (string const& databaseName,
|
||||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "journalSize", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_maximalSize));
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "journalSize", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_maximalSize));
|
||||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "waitForSync", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_waitForSync));
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "waitForSync", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_waitForSync));
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.setValue("Plan/Collections/" + databaseName + "/" + collectionID, copy, 0.0);
|
res = ac.setValue("Plan/Collections/" + databaseName + "/" + collectionID, copy, 0.0);
|
||||||
|
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, copy);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, copy);
|
||||||
|
@ -1396,6 +1410,7 @@ int ClusterInfo::setCollectionStatusCoordinator (string const& databaseName,
|
||||||
TRI_DeleteArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "status");
|
TRI_DeleteArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "status");
|
||||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "status", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, status));
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, copy, "status", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, status));
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.setValue("Plan/Collections/" + databaseName + "/" + collectionID, copy, 0.0);
|
res = ac.setValue("Plan/Collections/" + databaseName + "/" + collectionID, copy, 0.0);
|
||||||
|
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, copy);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, copy);
|
||||||
|
@ -1576,6 +1591,7 @@ int ClusterInfo::ensureIndexCoordinator (string const& databaseName,
|
||||||
|
|
||||||
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where + "/", false)) {
|
if (res.successful() && res.parse(where + "/", false)) {
|
||||||
if (res._values.size() == (size_t) numberOfShards) {
|
if (res._values.size() == (size_t) numberOfShards) {
|
||||||
|
@ -1631,7 +1647,7 @@ int ClusterInfo::ensureIndexCoordinator (string const& databaseName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, interval, false);
|
res = ac.watchValue("Current/Version", index, interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
}
|
}
|
||||||
|
@ -1772,6 +1788,7 @@ int ClusterInfo::dropIndexCoordinator (string const& databaseName,
|
||||||
|
|
||||||
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
string where = "Current/Collections/" + databaseName + "/" + collectionID;
|
||||||
while (TRI_microtime() <= endTime) {
|
while (TRI_microtime() <= endTime) {
|
||||||
|
res.clear();
|
||||||
res = ac.getValues(where, true);
|
res = ac.getValues(where, true);
|
||||||
if (res.successful() && res.parse(where + "/", false)) {
|
if (res.successful() && res.parse(where + "/", false)) {
|
||||||
if (res._values.size() == (size_t) numberOfShards) {
|
if (res._values.size() == (size_t) numberOfShards) {
|
||||||
|
@ -1807,6 +1824,7 @@ int ClusterInfo::dropIndexCoordinator (string const& databaseName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.clear();
|
||||||
res = ac.watchValue("Current/Version", index, interval, false);
|
res = ac.watchValue("Current/Version", index, interval, false);
|
||||||
index = res._index;
|
index = res._index;
|
||||||
}
|
}
|
||||||
|
@ -1845,7 +1863,7 @@ void ClusterInfo::loadServers () {
|
||||||
= triagens::basics::JsonHelper::getArrayElement((*it).second._json,
|
= triagens::basics::JsonHelper::getArrayElement((*it).second._json,
|
||||||
"endpoint");
|
"endpoint");
|
||||||
if (nullptr != sub) {
|
if (nullptr != sub) {
|
||||||
const std::string server = triagens::basics::JsonHelper::getStringValue(sub, "");
|
std::string server = triagens::basics::JsonHelper::getStringValue(sub, "");
|
||||||
|
|
||||||
_servers.emplace(std::make_pair((*it).first, server));
|
_servers.emplace(std::make_pair((*it).first, server));
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,9 +563,9 @@ int createDocumentOnCoordinator (
|
||||||
// The user did not specify a key, let's create one:
|
// The user did not specify a key, let's create one:
|
||||||
uint64_t uid = ci->uniqid();
|
uint64_t uid = ci->uniqid();
|
||||||
_key = triagens::basics::StringUtils::itoa(uid);
|
_key = triagens::basics::StringUtils::itoa(uid);
|
||||||
TRI_InsertArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "_key",
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "_key",
|
||||||
TRI_CreateStringReference2Json(TRI_UNKNOWN_MEM_ZONE,
|
TRI_CreateStringReference2Json(TRI_UNKNOWN_MEM_ZONE,
|
||||||
_key.c_str(), _key.size()));
|
_key.c_str(), _key.size()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
userSpecifiedKey = true;
|
userSpecifiedKey = true;
|
||||||
|
@ -1248,9 +1248,9 @@ int createEdgeOnCoordinator (
|
||||||
// The user did not specify a key, let's create one:
|
// The user did not specify a key, let's create one:
|
||||||
uint64_t uid = ci->uniqid();
|
uint64_t uid = ci->uniqid();
|
||||||
_key = triagens::basics::StringUtils::itoa(uid);
|
_key = triagens::basics::StringUtils::itoa(uid);
|
||||||
TRI_InsertArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "_key",
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "_key",
|
||||||
TRI_CreateStringReference2Json(TRI_UNKNOWN_MEM_ZONE,
|
TRI_CreateStringReference2Json(TRI_UNKNOWN_MEM_ZONE,
|
||||||
_key.c_str(), _key.size()));
|
_key.c_str(), _key.size()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
userSpecifiedKey = true;
|
userSpecifiedKey = true;
|
||||||
|
|
|
@ -28,25 +28,17 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
var _ = require("underscore");
|
|
||||||
var internal = require("internal");
|
var internal = require("internal");
|
||||||
var print = internal.print;
|
var print = internal.print;
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var console = require("console");
|
var console = require("console");
|
||||||
|
|
||||||
var COMPLETE={
|
|
||||||
"TOTAL": 0,
|
|
||||||
"PASSED": 0,
|
|
||||||
"FAILED": 0,
|
|
||||||
"DURATION": 0,
|
|
||||||
"RESULTS": {}
|
|
||||||
};
|
|
||||||
|
|
||||||
var TOTAL = 0;
|
var TOTAL = 0;
|
||||||
var PASSED = 0;
|
var PASSED = 0;
|
||||||
var FAILED = 0;
|
var FAILED = 0;
|
||||||
var DURATION = 0;
|
var DURATION = 0;
|
||||||
var RESULTS = {};
|
var RESULTS = {};
|
||||||
|
var COMPLETE = {};
|
||||||
|
|
||||||
var jsUnity = require("./jsunity/jsunity").jsUnity;
|
var jsUnity = require("./jsunity/jsunity").jsUnity;
|
||||||
var STARTTEST = 0.0;
|
var STARTTEST = 0.0;
|
||||||
|
@ -148,11 +140,7 @@ function Run (testsuite) {
|
||||||
FAILED += result.failed;
|
FAILED += result.failed;
|
||||||
DURATION += result.duration;
|
DURATION += result.duration;
|
||||||
|
|
||||||
COMPLETE.TOTAL += result.total;
|
for (var attrname in RESULTS) { COMPLETE[attrname] = RESULTS[attrname]; }
|
||||||
COMPLETE.PASSED += result.passed;
|
|
||||||
COMPLETE.FAILED += result.failed;
|
|
||||||
COMPLETE.DURATION += result.duration;
|
|
||||||
_.defaults(COMPLETE.RESULTS, RESULTS);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -168,18 +156,18 @@ function Done (suiteName) {
|
||||||
|
|
||||||
var ok = FAILED === 0;
|
var ok = FAILED === 0;
|
||||||
|
|
||||||
RESULTS.duration = DURATION;
|
COMPLETE.duration = DURATION;
|
||||||
RESULTS.status = ok;
|
COMPLETE.status = ok;
|
||||||
RESULTS.failed = FAILED;
|
COMPLETE.failed = FAILED;
|
||||||
RESULTS.total = TOTAL;
|
COMPLETE.total = TOTAL;
|
||||||
RESULTS.suiteName = suiteName;
|
COMPLETE.suiteName = suiteName;
|
||||||
|
|
||||||
TOTAL = 0;
|
TOTAL = 0;
|
||||||
PASSED = 0;
|
PASSED = 0;
|
||||||
FAILED = 0;
|
FAILED = 0;
|
||||||
DURATION = 0;
|
DURATION = 0;
|
||||||
|
|
||||||
return RESULTS;
|
return COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue