mirror of https://gitee.com/bigwinds/arangodb
Agency changes.
This commit is contained in:
parent
6cffcaa196
commit
5668e6e524
|
@ -40,8 +40,9 @@ CleanOutServer::CleanOutServer (
|
|||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
create();
|
||||
start();
|
||||
if (create()) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << " " << __FILE__ << __LINE__;
|
||||
|
@ -79,23 +80,27 @@ JOB_STATUS CleanOutServer::status () {
|
|||
for (auto const& subJob : todos) {
|
||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||
found++;
|
||||
#if 0
|
||||
Node const& sj = *(subJob.second);
|
||||
std::string subJobId = sj("jobId").slice().copyString();
|
||||
std::string creator = sj("creator").slice().copyString();
|
||||
MoveShard(_snapshot, _agent, subJobId, creator, _agencyPrefix);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for (auto const& subJob : pends) {
|
||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||
found++;
|
||||
#if 0
|
||||
Node const& sj = *(subJob.second);
|
||||
std::string subJobId = sj("jobId").slice().copyString();
|
||||
std::string creator = sj("creator").slice().copyString();
|
||||
MoveShard(_snapshot, _agent, subJobId, creator, _agencyPrefix);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (found == 0) {
|
||||
if (finish("DBServers/" + _server)) {
|
||||
return FINISHED;
|
||||
}
|
||||
|
@ -121,7 +126,7 @@ bool CleanOutServer::start() {
|
|||
_snapshot(toDoPrefix + _jobId).toBuilder(todo);
|
||||
todo.close();
|
||||
|
||||
// Enter peding, remove todo, block toserver
|
||||
// Enter pending, remove todo, block toserver
|
||||
pending.openArray();
|
||||
|
||||
// --- Add pending
|
||||
|
|
|
@ -42,8 +42,9 @@ FailedLeader::FailedLeader(
|
|||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
create();
|
||||
start();
|
||||
if (create()) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what();
|
||||
|
|
|
@ -43,8 +43,9 @@ FailedServer::FailedServer(Node const& snapshot,
|
|||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
create();
|
||||
start();
|
||||
if (create()) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << " " << __FILE__ << __LINE__;
|
||||
|
@ -219,19 +220,23 @@ JOB_STATUS FailedServer::status () {
|
|||
for (auto const& subJob : todos) {
|
||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||
found++;
|
||||
#if 0
|
||||
Node const& sj = *(subJob.second);
|
||||
std::string subJobId = sj("jobId").slice().copyString();
|
||||
std::string creator = sj("creator").slice().copyString();
|
||||
FailedLeader(_snapshot, _agent, subJobId, creator, _agencyPrefix);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for (auto const& subJob : pends) {
|
||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||
found++;
|
||||
#if 0
|
||||
Node const& sj = *(subJob.second);
|
||||
std::string subJobId = sj("jobId").slice().copyString();
|
||||
std::string creator = sj("creator").slice().copyString();
|
||||
FailedLeader(_snapshot, _agent, subJobId, creator, _agencyPrefix);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,9 @@ MoveShard::MoveShard (Node const& snapshot, Agent* agent,
|
|||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
create();
|
||||
start();
|
||||
if (create()) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << __FILE__ << __LINE__;
|
||||
|
@ -138,7 +139,7 @@ bool MoveShard::start() {
|
|||
}
|
||||
todo.close();
|
||||
|
||||
// Enter peding, remove todo, block toserver
|
||||
// Enter pending, remove todo, block toserver
|
||||
pending.openArray();
|
||||
|
||||
// --- Add pending
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "CleanOutServer.h"
|
||||
#include "FailedLeader.h"
|
||||
#include "FailedServer.h"
|
||||
#include "MoveShard.h"
|
||||
#include "Job.h"
|
||||
#include "Store.h"
|
||||
|
||||
|
@ -313,6 +314,10 @@ void Supervision::workJobs() {
|
|||
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "cleanOutServer") {
|
||||
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "moveShard") {
|
||||
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "failedLeader") {
|
||||
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
}
|
||||
} catch (std::exception const&) {}
|
||||
}
|
||||
|
@ -328,6 +333,10 @@ void Supervision::workJobs() {
|
|||
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "cleanOutServer") {
|
||||
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "moveShard") {
|
||||
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
} else if (jobType == "failedLeader") {
|
||||
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||
}
|
||||
} catch (std::exception const&) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue