mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/ArangoDB/ArangoDB into devel
This commit is contained in:
commit
a7cb6b6830
|
@ -195,7 +195,7 @@ inline arangodb::consensus::write_ret_t transact (
|
|||
LOG_TOPIC(ERR, Logger::AGENCY) << e.what();
|
||||
}
|
||||
|
||||
LOG_TOPIC(DEBUG, Logger::AGENCY) << envelope->toJson();
|
||||
LOG_TOPIC(INFO, Logger::AGENCY) << envelope->toJson();
|
||||
auto ret = _agent->write(envelope);
|
||||
if (waitForCommit) {
|
||||
auto maximum = *std::max_element(ret.indices.begin(), ret.indices.end());
|
||||
|
|
|
@ -35,8 +35,8 @@ CleanOutServer::CleanOutServer (
|
|||
std::string const& server) :
|
||||
Job(snapshot, agent, jobId, creator, prefix), _server(server) {
|
||||
|
||||
JOB_STATUS js = status();
|
||||
try {
|
||||
JOB_STATUS js = status();
|
||||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
|
|
|
@ -36,9 +36,9 @@ FailedLeader::FailedLeader(
|
|||
Job(snapshot, agent, jobId, creator, agencyPrefix), _database(database),
|
||||
_collection(collection), _shard(shard), _from(from), _to(to) {
|
||||
|
||||
JOB_STATUS js = status();
|
||||
|
||||
try {
|
||||
JOB_STATUS js = status();
|
||||
|
||||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
|
|
|
@ -38,8 +38,8 @@ FailedServer::FailedServer(Node const& snapshot,
|
|||
Job(snapshot, agent, jobId, creator, agencyPrefix),
|
||||
_server(server) {
|
||||
|
||||
JOB_STATUS js = status();
|
||||
try {
|
||||
JOB_STATUS js = status();
|
||||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
|
@ -220,23 +220,12 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ MoveShard::MoveShard (Node const& snapshot, Agent* agent,
|
|||
Job(snapshot, agent, jobId, creator, prefix), _database(database),
|
||||
_collection(collection), _shard(shard), _from(from), _to(to) {
|
||||
|
||||
JOB_STATUS js = status();
|
||||
|
||||
try {
|
||||
JOB_STATUS js = status();
|
||||
|
||||
if (js == TODO) {
|
||||
start();
|
||||
} else if (js == NOTFOUND) {
|
||||
|
@ -251,29 +251,29 @@ JOB_STATUS MoveShard::status () {
|
|||
Slice current = _snapshot(curPath).slice(),
|
||||
plan = _snapshot(curPath).slice();
|
||||
|
||||
LOG(WARN) << plan.toJson();
|
||||
LOG(WARN) << current.toJson();
|
||||
|
||||
if (current == plan) {
|
||||
|
||||
if ((current[0].copyString())[0] == '_') { // Retired leader
|
||||
if (current[0].copyString() == std::string("_")+_from) { // Retired leader
|
||||
|
||||
Builder cyclic; // Cyclic shift _serverId to end
|
||||
cyclic.openArray();
|
||||
cyclic.openObject();
|
||||
Builder remove; // remove
|
||||
remove.openArray();
|
||||
remove.openObject();
|
||||
// --- Plan changes
|
||||
cyclic.add(_agencyPrefix + planPath, VPackValue(VPackValueType::Array));
|
||||
remove.add(_agencyPrefix + planPath, VPackValue(VPackValueType::Array));
|
||||
for (size_t i = 1; i < current.length(); ++i) {
|
||||
cyclic.add(current[i]);
|
||||
remove.add(current[i]);
|
||||
}
|
||||
std::string disabledLeader = current[0].copyString();
|
||||
disabledLeader = disabledLeader.substr(1,disabledLeader.size()-1);
|
||||
cyclic.add(VPackValue(disabledLeader));
|
||||
cyclic.close();
|
||||
remove.close();
|
||||
// --- Plan version
|
||||
cyclic.add(_agencyPrefix + planVersion,
|
||||
remove.add(_agencyPrefix + planVersion,
|
||||
VPackValue(VPackValueType::Object));
|
||||
cyclic.add("op", VPackValue("increment"));
|
||||
cyclic.close();
|
||||
cyclic.close(); cyclic.close();
|
||||
transact(_agent, cyclic);
|
||||
remove.add("op", VPackValue("increment"));
|
||||
remove.close();
|
||||
remove.close(); remove.close();
|
||||
transact(_agent, remove);
|
||||
|
||||
return PENDING;
|
||||
|
||||
|
@ -292,6 +292,8 @@ JOB_STATUS MoveShard::status () {
|
|||
|
||||
if (foundFrom && foundTo) {
|
||||
|
||||
LOG(WARN) << _from << " " << current.toJson();
|
||||
|
||||
if (current[0].copyString() == _from) { // Leader
|
||||
|
||||
Builder underscore; // serverId -> _serverId
|
||||
|
@ -342,7 +344,9 @@ JOB_STATUS MoveShard::status () {
|
|||
|
||||
} else if (foundTo && !foundFrom) {
|
||||
|
||||
return FINISHED;
|
||||
if (finish("Shards/" + _shard)) {
|
||||
return FINISHED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -306,39 +306,35 @@ void Supervision::workJobs() {
|
|||
for (auto const& todoEnt : todos) {
|
||||
Node const& job = *todoEnt.second;
|
||||
|
||||
try {
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
if (jobType == "failedServer") {
|
||||
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&) {}
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
if (jobType == "failedServer") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const& pendEnt : pends) {
|
||||
Node const& job = *pendEnt.second;
|
||||
|
||||
try {
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
if (jobType == "failedServer") {
|
||||
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&) {}
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
if (jobType == "failedServer") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue