1
0
Fork 0

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

This commit is contained in:
jsteemann 2016-06-29 17:44:29 +02:00
commit 10367c1de4
4 changed files with 22 additions and 19 deletions

View File

@ -440,7 +440,7 @@ void Agent::run() {
while (!this->isStopping() && size() > 1) { while (!this->isStopping() && size() > 1) {
if (leading()) { // Only if leading if (leading()) { // Only if leading
_appendCV.wait(20000); _appendCV.wait(25000);
} else { } else {
_appendCV.wait(); // Else wait for our moment in the sun _appendCV.wait(); // Else wait for our moment in the sun
} }

View File

@ -491,6 +491,8 @@ void Constituent::run() {
// Always start off as follower // Always start off as follower
while (!this->isStopping() && size() > 1) { while (!this->isStopping() && size() > 1) {
long t = 0;
if (_role == FOLLOWER) { if (_role == FOLLOWER) {
bool cast = false; bool cast = false;
@ -499,13 +501,9 @@ void Constituent::run() {
_cast = false; // New round set not cast vote _cast = false; // New round set not cast vote
} }
int32_t left = static_cast<int32_t>(1000000.0 * config().minPing), right = static_cast<int32_t>(1000000.0 * config().maxPing); int32_t left = static_cast<int32_t>(1000000.0 * config().minPing),
long rand_wait = static_cast<long>(RandomGenerator::interval(left, right)); right = static_cast<int32_t>(1000000.0 * config().maxPing);
t = static_cast<long>(RandomGenerator::interval(left, right));
{
CONDITION_LOCKER(guardv, _cv);
_cv.wait(rand_wait);
}
{ {
MUTEX_LOCKER(guard, _castLock); MUTEX_LOCKER(guard, _castLock);
@ -517,14 +515,19 @@ void Constituent::run() {
} }
} else if (_role == CANDIDATE) { } else if (_role == CANDIDATE) {
callElection(); // Run for office callElection(); // Run for office
continue;
} else { } else {
int32_t left = 100000.0 * config().minPing;
long rand_wait = static_cast<long>(left); t = 100000.0 * config().minPing;
}
{ {
CONDITION_LOCKER(guardv, _cv); CONDITION_LOCKER(guardv, _cv);
_cv.wait(rand_wait); _cv.wait(t);
}
} }
} }

View File

@ -97,7 +97,7 @@ Slice Node::slice() const {
} }
// Some value // Some value
if (!_value.empty() && !_value.empty()) { if (!_value.empty()) {
return Slice(_value.front().data()); return Slice(_value.front().data());
} }

View File

@ -51,7 +51,7 @@ if [ $NRAGENTS -gt 1 ]; then
--agency.compaction-step-size $COMP \ --agency.compaction-step-size $COMP \
--log.force-direct true \ --log.force-direct true \
> agency/$port.stdout 2>&1 & > agency/$port.stdout 2>&1 &
sleep 0 sleep 1
done done
fi fi
for aid in `seq 0 $(( $NRAGENTS - 1 ))`; do for aid in `seq 0 $(( $NRAGENTS - 1 ))`; do