1
0
Fork 0

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

This commit is contained in:
jsteemann 2016-06-13 15:17:02 +02:00
commit fc53bbec02
2 changed files with 65 additions and 7 deletions

View File

@ -165,7 +165,8 @@ std::vector<check_t> Supervision::checkDBServers() {
del->openArray();
del->openObject();
for (auto const& srv : todelete) {
del->add(_agencyPrefix + healthPrefix + srv, VPackValue(VPackValueType::Object));
del->add(_agencyPrefix + healthPrefix + srv,
VPackValue(VPackValueType::Object));
del->add("op", VPackValue("delete"));
del->close();
}
@ -273,7 +274,8 @@ std::vector<check_t> Supervision::checkCoordinators() {
del->openArray();
del->openObject();
for (auto const& srv : todelete) {
del->add(_agencyPrefix + healthPrefix + srv, VPackValue(VPackValueType::Object));
del->add(_agencyPrefix + healthPrefix + srv,
VPackValue(VPackValueType::Object));
del->add("op", VPackValue("delete"));
del->close();
}
@ -450,7 +452,8 @@ void Supervision::shrinkCluster () {
// Minimum 1 DB server must remain
if (availServers.size() == 1) {
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Only one db server left for operation";
LOG_TOPIC(DEBUG, Logger::AGENCY) <<
"Only one db server left for operation";
return;
}
@ -464,9 +467,9 @@ void Supervision::shrinkCluster () {
if (replFact > maxReplFact) {
maxReplFact = replFact;
}
} catch (std::exception const&) {
LOG_TOPIC(DEBUG, Logger::AGENCY) <<
"Cannot retrieve replication factor for collection " << collptr.first;
} catch (std::exception const& e) {
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Cannot retrieve replication " <<
"factor for collection " << collptr.first;
return;
}
}
@ -537,7 +540,7 @@ void Supervision::getUniqueIds() {
while (!this->isStopping()) {
try {
latestId = std::stoul(
_agent->readDB().get(_agencyPrefix + "/Sync/LatestID").slice().toJson());
_agent->readDB().get(_agencyPrefix + "/Sync/LatestID").slice().toJson());
} catch (...) {
std::this_thread::sleep_for (std::chrono::seconds(1));
continue;

View File

@ -131,7 +131,13 @@ function MovingShardsSuite () {
if (!ok) {
return false;
}
}
// Now get to work, first get the write lock on the Plan in the Agency:
//var success = ArangoAgency.lockRead("Target/CleanedServers", 0.5);
//print(ArangoAgency.get("Target/CleanedServers", false, true));
return true;
}
@ -150,6 +156,37 @@ function MovingShardsSuite () {
body: JSON.stringify(body) });
}
////////////////////////////////////////////////////////////////////////////////
/// @brief order the cluster to reduce number of db servers
////////////////////////////////////////////////////////////////////////////////
function shrinkCluster(toNum) {
var coordEndpoint = global.ArangoClusterInfo.getServerEndpoint("Coordinator001");
var request = require("@arangodb/request");
var endpointToURL = require("@arangodb/cluster").endpointToURL;
var url = endpointToURL(coordEndpoint);
var body = {"numberOfDBServers":toNum};
return request({ method: "PUT",
url: url + "/_admin/cluster/numberOfServers",
body: JSON.stringify(body) });
}
////////////////////////////////////////////////////////////////////////////////
/// @brief order the cluster to clean out a server:
////////////////////////////////////////////////////////////////////////////////
function resetCleanedOutServers() {
var coordEndpoint = global.ArangoClusterInfo.getServerEndpoint("Coordinator001");
var request = require("@arangodb/request");
var endpointToURL = require("@arangodb/cluster").endpointToURL;
var url = endpointToURL(coordEndpoint);
var numberOfDBServers = global.ArangoClusterInfo.getDBServers().length;
var body = {"cleanedServers":[], "numberOfDBServers":numberOfDBServers};
return request({ method: "PUT",
url: url + "/_admin/cluster/numberOfServers",
body: JSON.stringify(body) });
}
////////////////////////////////////////////////////////////////////////////////
/// @brief move a single shard
////////////////////////////////////////////////////////////////////////////////
@ -235,6 +272,7 @@ function MovingShardsSuite () {
c[i].drop();
}
c = [];
resetCleanedOutServers();
},
////////////////////////////////////////////////////////////////////////////////
@ -245,6 +283,23 @@ function MovingShardsSuite () {
assertTrue(waitForSynchronousReplication("_system"));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief cleaning out collection with one shard without replication
////////////////////////////////////////////////////////////////////////////////
/* testShrinkNoReplication : function() {
assertTrue(waitForSynchronousReplication("_system"));
shrinkCluster(4);
assertTrue(testServerEmpty("DBServer005"));
shrinkCluster(3);
assertTrue(testServerEmpty("DBServer004"));
shrinkCluster(2);
assertTrue(testServerEmpty("DBServer003"));
shrinkCluster(1);
assert(testServerEmpty("DBServer002"));
},*/
////////////////////////////////////////////////////////////////////////////////
/// @brief moving away a shard from a follower
////////////////////////////////////////////////////////////////////////////////