mirror of https://gitee.com/bigwinds/arangodb
Correct depiction of servers health status
This commit is contained in:
parent
40c6e2b48c
commit
bbb45ca397
|
@ -103,13 +103,14 @@ void Supervision::upgradeAgency() {
|
||||||
|
|
||||||
// Check all DB servers, guarded above doChecks
|
// Check all DB servers, guarded above doChecks
|
||||||
std::vector<check_t> Supervision::checkDBServers() {
|
std::vector<check_t> Supervision::checkDBServers() {
|
||||||
|
|
||||||
std::vector<check_t> ret;
|
std::vector<check_t> ret;
|
||||||
Node::Children const& machinesPlanned =
|
Node::Children const& machinesPlanned =
|
||||||
_snapshot(planDBServersPrefix).children();
|
_snapshot(planDBServersPrefix).children();
|
||||||
Node::Children const serversRegistered =
|
Node::Children const serversRegistered =
|
||||||
_snapshot(currentServersRegisteredPrefix).children();
|
_snapshot(currentServersRegisteredPrefix).children();
|
||||||
|
|
||||||
bool reportPersistent;
|
bool reportPersistent = false;
|
||||||
|
|
||||||
std::vector<std::string> todelete;
|
std::vector<std::string> todelete;
|
||||||
for (auto const& machine : _snapshot(healthPrefix).children()) {
|
for (auto const& machine : _snapshot(healthPrefix).children()) {
|
||||||
|
@ -148,6 +149,8 @@ std::vector<check_t> Supervision::checkDBServers() {
|
||||||
good = true;
|
good = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportPersistent = (heartbeatStatus != lastStatus);
|
||||||
|
|
||||||
query_t report = std::make_shared<Builder>();
|
query_t report = std::make_shared<Builder>();
|
||||||
report->openArray();
|
report->openArray();
|
||||||
report->openArray();
|
report->openArray();
|
||||||
|
@ -174,9 +177,6 @@ std::vector<check_t> Supervision::checkDBServers() {
|
||||||
|
|
||||||
if (good) {
|
if (good) {
|
||||||
|
|
||||||
if (lastStatus != Supervision::HEALTH_STATUS_GOOD) {
|
|
||||||
reportPersistent = true;
|
|
||||||
}
|
|
||||||
report->add(
|
report->add(
|
||||||
"LastHeartbeatAcked",
|
"LastHeartbeatAcked",
|
||||||
VPackValue(timepointToString(std::chrono::system_clock::now())));
|
VPackValue(timepointToString(std::chrono::system_clock::now())));
|
||||||
|
@ -210,7 +210,6 @@ std::vector<check_t> Supervision::checkDBServers() {
|
||||||
// for at least grace period
|
// for at least grace period
|
||||||
if (t.count() > _gracePeriod && secondsSinceLeader > _gracePeriod) {
|
if (t.count() > _gracePeriod && secondsSinceLeader > _gracePeriod) {
|
||||||
if (lastStatus == "BAD") {
|
if (lastStatus == "BAD") {
|
||||||
reportPersistent = true;
|
|
||||||
report->add("Status", VPackValue("FAILED"));
|
report->add("Status", VPackValue("FAILED"));
|
||||||
FailedServer fsj(_snapshot, _agent, std::to_string(_jobId++),
|
FailedServer fsj(_snapshot, _agent, std::to_string(_jobId++),
|
||||||
"supervision", _agencyPrefix, serverID);
|
"supervision", _agencyPrefix, serverID);
|
||||||
|
@ -257,6 +256,9 @@ std::vector<check_t> Supervision::checkDBServers() {
|
||||||
|
|
||||||
// Check all coordinators, guarded above doChecks
|
// Check all coordinators, guarded above doChecks
|
||||||
std::vector<check_t> Supervision::checkCoordinators() {
|
std::vector<check_t> Supervision::checkCoordinators() {
|
||||||
|
|
||||||
|
bool reportPersistent = false;
|
||||||
|
|
||||||
std::vector<check_t> ret;
|
std::vector<check_t> ret;
|
||||||
Node::Children const& machinesPlanned =
|
Node::Children const& machinesPlanned =
|
||||||
_snapshot(planCoordinatorsPrefix).children();
|
_snapshot(planCoordinatorsPrefix).children();
|
||||||
|
@ -305,6 +307,8 @@ std::vector<check_t> Supervision::checkCoordinators() {
|
||||||
good = true;
|
good = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportPersistent = (heartbeatStatus != lastStatus);
|
||||||
|
|
||||||
query_t report = std::make_shared<Builder>();
|
query_t report = std::make_shared<Builder>();
|
||||||
report->openArray();
|
report->openArray();
|
||||||
report->openArray();
|
report->openArray();
|
||||||
|
@ -329,6 +333,7 @@ std::vector<check_t> Supervision::checkCoordinators() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (good) {
|
if (good) {
|
||||||
|
|
||||||
if (goodServerId.empty()) {
|
if (goodServerId.empty()) {
|
||||||
goodServerId = serverID;
|
goodServerId = serverID;
|
||||||
}
|
}
|
||||||
|
@ -359,6 +364,9 @@ std::vector<check_t> Supervision::checkCoordinators() {
|
||||||
report->close();
|
report->close();
|
||||||
if (!this->isStopping()) {
|
if (!this->isStopping()) {
|
||||||
_agent->transient(report);
|
_agent->transient(report);
|
||||||
|
if (reportPersistent) { // STATUS changes should be persisted
|
||||||
|
_agent->write(report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue