mirror of https://gitee.com/bigwinds/arangodb
Fix agency startup. Agency not yet working.
This commit is contained in:
parent
ef027dabaf
commit
7a12918021
|
@ -100,10 +100,9 @@ void AgencyFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
|
||||
void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::validateOptions";
|
||||
|
||||
_disabled = (_agentId == (std::numeric_limits<uint32_t>::max)());
|
||||
|
||||
if (_disabled) {
|
||||
|
||||
if (_agentId == (std::numeric_limits<uint32_t>::max)()) {
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -160,7 +159,7 @@ void AgencyFeature::prepare() {
|
|||
void AgencyFeature::start() {
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::start";
|
||||
|
||||
if (_disabled) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,12 +187,13 @@ void AgencyFeature::start() {
|
|||
_waitForSync, _supervisionFrequency)));
|
||||
|
||||
_agent->start();
|
||||
_agent->load();
|
||||
}
|
||||
|
||||
void AgencyFeature::stop() {
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::stop";
|
||||
|
||||
if (_disabled) {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ class AgencyFeature : virtual public application_features::ApplicationFeature {
|
|||
|
||||
private:
|
||||
std::unique_ptr<consensus::Agent> _agent;
|
||||
bool _disabled;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ write_ret_t Agent::write (query_t const& query) {
|
|||
|
||||
// Read from store
|
||||
read_ret_t Agent::read (query_t const& query) const {
|
||||
if (_constituent.leading()) { // Only working as leaer
|
||||
if (_constituent.leading()) { // Only working as leader
|
||||
query_t result = std::make_shared<arangodb::velocypack::Builder>();
|
||||
std::vector<bool> success = _readDB.read (query, result);
|
||||
return read_ret_t(true, _constituent.leaderID(), success, result);
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "ApplicationFeatures/SslFeature.h"
|
||||
#include "Aql/RestAqlHandler.h"
|
||||
#include "Agency/AgencyFeature.h"
|
||||
#include "Agency/RestAgencyHandler.h"
|
||||
#include "Agency/RestAgencyPrivHandler.h"
|
||||
#include "Cluster/ClusterComm.h"
|
||||
#include "Cluster/RestShardHandler.h"
|
||||
#include "Dispatcher/DispatcherFeature.h"
|
||||
|
@ -272,6 +275,10 @@ void RestServerFeature::buildServers() {
|
|||
}
|
||||
|
||||
void RestServerFeature::defineHandlers() {
|
||||
AgencyFeature* agency = dynamic_cast<AgencyFeature*>(
|
||||
application_features::ApplicationServer::lookupFeature("Agency"));
|
||||
TRI_ASSERT(agency != nullptr);
|
||||
|
||||
auto queryRegistry = DatabaseFeature::DATABASE->queryRegistry();
|
||||
|
||||
// ...........................................................................
|
||||
|
@ -356,6 +363,18 @@ void RestServerFeature::defineHandlers() {
|
|||
"/_api/query-cache",
|
||||
RestHandlerCreator<RestQueryCacheHandler>::createNoData);
|
||||
|
||||
if (agency->isEnabled()) {
|
||||
_handlerFactory->addPrefixHandler(
|
||||
RestVocbaseBaseHandler::AGENCY_PATH,
|
||||
RestHandlerCreator<RestAgencyHandler>::createData<consensus::Agent*>,
|
||||
agency->agent());
|
||||
|
||||
_handlerFactory->addPrefixHandler(
|
||||
RestVocbaseBaseHandler::AGENCY_PRIV_PATH,
|
||||
RestHandlerCreator<RestAgencyPrivHandler>::createData<consensus::Agent*>,
|
||||
agency->agent());
|
||||
}
|
||||
|
||||
// And now some handlers which are registered in both /_api and /_admin
|
||||
_handlerFactory->addPrefixHandler(
|
||||
"/_api/job", RestHandlerCreator<arangodb::RestJobHandler>::createData<
|
||||
|
|
|
@ -90,8 +90,9 @@ int main(int argc, char* argv[]) {
|
|||
application_features::ApplicationServer server(options);
|
||||
|
||||
std::vector<std::string> nonServerFeatures = {
|
||||
"Action", "Cluster", "Daemon", "Dispatcher", "Endpoint",
|
||||
"Server", "Scheduler", "Ssl", "Supervisor"};
|
||||
"Action", "Agency", "Cluster", "Daemon", "Dispatcher", "Endpoint",
|
||||
"Server", "Scheduler", "Ssl", "Supervisor"};
|
||||
#warning FRANK: does it make sense to list Agency here?
|
||||
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
|
|
|
@ -10,15 +10,12 @@ echo Starting agency...
|
|||
build/bin/arangod -c etc/relative/arangod.conf \
|
||||
--agency.size 1 \
|
||||
--server.endpoint tcp://127.0.0.1:4001 \
|
||||
--agency.endpoint tcp://127.0.0.1:4001 \
|
||||
--agency.wait-for-sync false \
|
||||
--database.directory cluster/data4001 \
|
||||
--agency.id 0 \
|
||||
--log.file cluster/4001.log \
|
||||
--log.requests-file cluster/4001.req \
|
||||
--server.disable-statistics true \
|
||||
--server.foxx-queues false \
|
||||
--server.disable-authentication true \
|
||||
--server.statistics false \
|
||||
--server.authentication false \
|
||||
--javascript.app-path ./js/apps \
|
||||
--javascript.startup-directory ./js \
|
||||
> cluster/4001.stdout 2>&1 &
|
||||
|
|
Loading…
Reference in New Issue