1
0
Fork 0

multi-host agency tests startup ok

This commit is contained in:
Kaveh Vahedipour 2016-06-07 19:01:23 +02:00
commit 9134933158
6 changed files with 23 additions and 11 deletions

View File

@ -197,10 +197,8 @@ void AgencyFeature::unprepare() {
return;
}
LOG_TOPIC(WARN, Logger::AGENCY) << __func__ << __LINE__;
_agent->beginShutdown();
if (_agent != nullptr) {
int counter = 0;
while (_agent->isRunning()) {
@ -212,6 +210,4 @@ void AgencyFeature::unprepare() {
}
}
LOG_TOPIC(WARN, Logger::AGENCY) << __func__ << __LINE__;
}

View File

@ -271,7 +271,7 @@ append_entries_t Agent::sendAppendEntriesRPC(
"1", 1, _config.endpoints[follower_id],
arangodb::GeneralRequest::RequestType::POST, path.str(),
std::make_shared<std::string>(builder.toJson()), headerFields,
std::make_shared<AgentCallback>(this, follower_id, last), 0, true);
std::make_shared<AgentCallback>(this, follower_id, last), 1, true);
return append_entries_t(t, true);
}
@ -392,9 +392,12 @@ void Agent::beginShutdown() {
_spearhead.beginShutdown();
_readDB.beginShutdown();
CONDITION_LOCKER(guardW, _waitForCV);
guardW.broadcast();
// Wake up all waiting REST handler (waitFor)
CONDITION_LOCKER(guard, _appendCV);
guard.broadcast();
CONDITION_LOCKER(guardA, _appendCV);
guardA.broadcast();
}
// Becoming leader

View File

@ -364,6 +364,10 @@ void Constituent::callElection() {
void Constituent::beginShutdown() {
_notifier.reset();
Thread::beginShutdown();
CONDITION_LOCKER(guard, _cv);
guard.broadcast();
}
bool Constituent::start(TRI_vocbase_t* vocbase,
@ -430,4 +434,5 @@ void Constituent::run() {
callElection(); // Run for office
}
}
}

View File

@ -77,6 +77,7 @@ void NotifierThread::run() {
} catch (...) {
LOG(ERR) << "Couldn't notify agents!";
}
}
void NotifierThread::beginShutdown() {

View File

@ -131,8 +131,10 @@ Store& Store::operator=(Store&& rhs) {
return *this;
}
// Default ctor
Store::~Store() {}
// Default dtor
Store::~Store() {
shutdown();
}
// Apply queries multiple queries to store
std::vector<bool> Store::apply(query_t const& query) {
@ -495,6 +497,7 @@ void Store::run() {
toClear = clearExpired();
_agent->write(toClear);
}
}
bool Store::applies(arangodb::velocypack::Slice const& slice) {

View File

@ -262,7 +262,7 @@ void Supervision::run() {
workJobs();
}
}
void Supervision::workJobs() {
@ -385,6 +385,10 @@ void Supervision::updateFromAgency() {
void Supervision::beginShutdown() {
// Personal hygiene
Thread::beginShutdown();
CONDITION_LOCKER(guard, _cv);
guard.broadcast();
}
Store const& Supervision::store() const {