mirror of https://gitee.com/bigwinds/arangodb
cluster startup and supervision
This commit is contained in:
parent
313140e0e1
commit
114b643d6e
|
@ -1,26 +1,26 @@
|
||||||
#include "SanityCheck.h"
|
#include "Supervision.h"
|
||||||
#include "Agent.h"
|
#include "Agent.h"
|
||||||
|
|
||||||
#include "Basics/ConditionLocker.h"
|
#include "Basics/ConditionLocker.h"
|
||||||
|
|
||||||
using namespace arangodb::consensus;
|
using namespace arangodb::consensus;
|
||||||
|
|
||||||
SanityCheck::SanityCheck() : arangodb::Thread("SanityCheck"), _agent(nullptr) {}
|
Supervision::Supervision() : arangodb::Thread("Supervision"), _agent(nullptr) {}
|
||||||
|
|
||||||
SanityCheck::~SanityCheck() {
|
Supervision::~Supervision() {
|
||||||
shutdown();
|
shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
void SanityCheck::wakeUp () {
|
void Supervision::wakeUp () {
|
||||||
_cv.signal();
|
_cv.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SanityCheck::doChecks (bool timedout) {
|
bool Supervision::doChecks (bool timedout) {
|
||||||
LOG_TOPIC(INFO, Logger::AGENCY) << "Sanity checks";
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Sanity checks";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SanityCheck::run() {
|
void Supervision::run() {
|
||||||
|
|
||||||
CONDITION_LOCKER(guard, _cv);
|
CONDITION_LOCKER(guard, _cv);
|
||||||
TRI_ASSERT(_agent!=nullptr);
|
TRI_ASSERT(_agent!=nullptr);
|
||||||
|
@ -41,18 +41,18 @@ void SanityCheck::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start thread
|
// Start thread
|
||||||
bool SanityCheck::start () {
|
bool Supervision::start () {
|
||||||
Thread::start();
|
Thread::start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start thread with agent
|
// Start thread with agent
|
||||||
bool SanityCheck::start (Agent* agent) {
|
bool Supervision::start (Agent* agent) {
|
||||||
_agent = agent;
|
_agent = agent;
|
||||||
return start();
|
return start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SanityCheck::beginShutdown() {
|
void Supervision::beginShutdown() {
|
||||||
// Personal hygiene
|
// Personal hygiene
|
||||||
Thread::beginShutdown();
|
Thread::beginShutdown();
|
||||||
}
|
}
|
|
@ -21,8 +21,8 @@
|
||||||
/// @author Kaveh Vahedipour
|
/// @author Kaveh Vahedipour
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __ARANGODB_CONSENSUS_SANITY_CHECK__
|
#ifndef __ARANGODB_CONSENSUS_SUPERVISION__
|
||||||
#define __ARANGODB_CONSENSUS_SANITY_CHECK__
|
#define __ARANGODB_CONSENSUS_SUPERVISION__
|
||||||
|
|
||||||
#include "Basics/Thread.h"
|
#include "Basics/Thread.h"
|
||||||
#include "Basics/ConditionVariable.h"
|
#include "Basics/ConditionVariable.h"
|
||||||
|
@ -32,15 +32,15 @@ namespace consensus {
|
||||||
|
|
||||||
class Agent;
|
class Agent;
|
||||||
|
|
||||||
class SanityCheck : public arangodb::Thread {
|
class Supervision : public arangodb::Thread {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief Construct sanity checking
|
/// @brief Construct sanity checking
|
||||||
SanityCheck ();
|
Supervision ();
|
||||||
|
|
||||||
/// @brief Default dtor
|
/// @brief Default dtor
|
||||||
~SanityCheck ();
|
~Supervision ();
|
||||||
|
|
||||||
/// @brief Start thread
|
/// @brief Start thread
|
||||||
bool start ();
|
bool start ();
|
||||||
|
@ -59,16 +59,19 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/// @brief Read db
|
||||||
|
Store const& store ();
|
||||||
|
|
||||||
/// @brief Perform sanity checking
|
/// @brief Perform sanity checking
|
||||||
bool doChecks(bool);
|
bool doChecks(bool);
|
||||||
|
|
||||||
Agent* _agent; /**< @brief My agent */
|
Agent* _agent; /**< @brief My agent */
|
||||||
|
|
||||||
arangodb::basics::ConditionVariable _cv; /**< @brief Control if thread should run */
|
arangodb::basics::ConditionVariable _cv; /**< @brief Control if thread should run */
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#endif //__ARANGODB_CONSENSUS_SANITY_CHECK__
|
#endif //__ARANGODB_CONSENSUS_SUPERVISION__
|
|
@ -72,7 +72,7 @@ add_executable(${BIN_ARANGOD}
|
||||||
Agency/AgentCallback.cpp
|
Agency/AgentCallback.cpp
|
||||||
Agency/ApplicationAgency.cpp
|
Agency/ApplicationAgency.cpp
|
||||||
Agency/Constituent.cpp
|
Agency/Constituent.cpp
|
||||||
Agency/SanityCheck.cpp
|
Agency/Supervision.cpp
|
||||||
Agency/RestAgencyHandler.cpp
|
Agency/RestAgencyHandler.cpp
|
||||||
Agency/RestAgencyPrivHandler.cpp
|
Agency/RestAgencyPrivHandler.cpp
|
||||||
Agency/State.cpp
|
Agency/State.cpp
|
||||||
|
|
Loading…
Reference in New Issue