1
0
Fork 0

Sort out start order of things w.r.t. cluster.

This commit is contained in:
Max Neunhoeffer 2016-04-21 11:13:11 +02:00
parent 70528a9abd
commit 80cd846702
1 changed files with 26 additions and 9 deletions

View File

@ -23,6 +23,7 @@
#include "ClusterFeature.h" #include "ClusterFeature.h"
#include "Agency/AgencyFeature.h"
#include "Basics/FileUtils.h" #include "Basics/FileUtils.h"
#include "Basics/JsonHelper.h" #include "Basics/JsonHelper.h"
#include "Basics/VelocyPackHelper.h" #include "Basics/VelocyPackHelper.h"
@ -58,6 +59,7 @@ ClusterFeature::ClusterFeature(application_features::ApplicationServer* server)
startsAfter("Database"); startsAfter("Database");
startsAfter("Dispatcher"); startsAfter("Dispatcher");
startsAfter("Scheduler"); startsAfter("Scheduler");
startsAfter("V8Dealer");
} }
ClusterFeature::~ClusterFeature() { ClusterFeature::~ClusterFeature() {
@ -199,17 +201,14 @@ void ClusterFeature::prepare() {
// create an instance (this will not yet create a thread) // create an instance (this will not yet create a thread)
ClusterComm::instance(); ClusterComm::instance();
}
//YYY #ifdef ARANGODB_ENABLE_MAINTAINER_MODE AgencyFeature* agency = dynamic_cast<AgencyFeature*>(
//YYY #warning FRANK split into methods application_features::ApplicationServer::lookupFeature("Agency"));
//YYY #endif
void ClusterFeature::start() {
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::start";
if (agency->isEnabled() || _enableCluster) {
// initialize ClusterComm library, must call initialize only once // initialize ClusterComm library, must call initialize only once
ClusterComm::initialize(); ClusterComm::initialize();
}
// return if cluster is disabled // return if cluster is disabled
if (!_enableCluster) { if (!_enableCluster) {
@ -335,6 +334,20 @@ void ClusterFeature::start() {
FATAL_ERROR_EXIT(); FATAL_ERROR_EXIT();
} }
}
//YYY #ifdef ARANGODB_ENABLE_MAINTAINER_MODE
//YYY #warning FRANK split into methods
//YYY #endif
void ClusterFeature::start() {
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::start";
// return if cluster is disabled
if (!_enableCluster) {
return;
}
ServerState::instance()->setState(ServerState::STATE_STARTUP); ServerState::instance()->setState(ServerState::STATE_STARTUP);
// the agency about our state // the agency about our state
@ -345,6 +358,10 @@ void ClusterFeature::start() {
ServerState::instance()->setInitialized(); ServerState::instance()->setInitialized();
std::string const endpoints = AgencyComm::getEndpointsString();
ServerState::RoleEnum role = ServerState::instance()->getRole();
LOG(INFO) << "Cluster feature is turned on. Agency version: " << version LOG(INFO) << "Cluster feature is turned on. Agency version: " << version
<< ", Agency endpoints: " << endpoints << ", server id: '" << _myId << ", Agency endpoints: " << endpoints << ", server id: '" << _myId
<< "', internal address: " << _myAddress << "', internal address: " << _myAddress