1
0
Fork 0

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

This commit is contained in:
Jan Steemann 2016-09-07 09:59:49 +02:00
commit f80b36b6ff
2 changed files with 14 additions and 16 deletions

View File

@ -414,7 +414,8 @@ void Constituent::run() {
std::vector<std::string> act = _agent->config().active();
while (!this->isStopping() && ((size_t)(find(act.begin(), act.end(), _id) -
act.begin()) >= size())) {
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
CONDITION_LOCKER(guardv, _cv);
_cv.wait(5000000);
}
if (size() == 1) {
@ -428,33 +429,33 @@ void Constituent::run() {
MUTEX_LOCKER(guard, _castLock);
_cast = false; // New round set not cast vote
}
int32_t left = static_cast<int32_t>(1000000.0 *
_agent->config().minPing()),
right = static_cast<int32_t>(1000000.0 *
_agent->config().maxPing());
right = static_cast<int32_t>(1000000.0 *
_agent->config().maxPing());
long rand_wait =
static_cast<long>(RandomGenerator::interval(left, right));
static_cast<long>(RandomGenerator::interval(left, right));
{
CONDITION_LOCKER(guardv, _cv);
_cv.wait(rand_wait);
}
{
MUTEX_LOCKER(guard, _castLock);
cast = _cast;
}
if (!cast) {
candidate(); // Next round, we are running
}
} else if (_role == CANDIDATE) {
callElection(); // Run for office
} else {
int32_t left =
static_cast<int32_t>(100000.0 * _agent->config().minPing());
static_cast<int32_t>(100000.0 * _agent->config().minPing());
long rand_wait = static_cast<long>(left);
{
CONDITION_LOCKER(guardv, _cv);

View File

@ -1226,6 +1226,8 @@ function shutdownInstance (instanceInfo, options) {
let count = 0;
let bar = '[';
var shutdownTime = require('internal').time();
let toShutdown = instanceInfo.arangods.slice();
while (toShutdown.length > 0) {
// Once all other servers are shut down, we take care of the agents,
@ -1241,13 +1243,8 @@ function shutdownInstance (instanceInfo, options) {
arangod.exitStatus = statusExternal(arangod.pid, false);
if (arangod.exitStatus.status === 'RUNNING') {
++count;
if (count % 10 === 0) {
bar = bar + '#';
}
if (count > timeout) {
if ((require('internal').time() - shutdownTime) > timeout) {
print('forcefully terminating ' + yaml.safeDump(arangod.pid) +
' after ' + timeout + 's grace period; marking crashy.');
serverCrashed = true;