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(ERR, Logger::AGENCY) << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TOPIC(DEBUG, Logger::AGENCY) << envelope->toJson();
|
LOG_TOPIC(INFO, Logger::AGENCY) << envelope->toJson();
|
||||||
auto ret = _agent->write(envelope);
|
auto ret = _agent->write(envelope);
|
||||||
if (waitForCommit) {
|
if (waitForCommit) {
|
||||||
auto maximum = *std::max_element(ret.indices.begin(), ret.indices.end());
|
auto maximum = *std::max_element(ret.indices.begin(), ret.indices.end());
|
||||||
|
|
|
@ -35,8 +35,8 @@ CleanOutServer::CleanOutServer (
|
||||||
std::string const& server) :
|
std::string const& server) :
|
||||||
Job(snapshot, agent, jobId, creator, prefix), _server(server) {
|
Job(snapshot, agent, jobId, creator, prefix), _server(server) {
|
||||||
|
|
||||||
JOB_STATUS js = status();
|
|
||||||
try {
|
try {
|
||||||
|
JOB_STATUS js = status();
|
||||||
if (js == TODO) {
|
if (js == TODO) {
|
||||||
start();
|
start();
|
||||||
} else if (js == NOTFOUND) {
|
} else if (js == NOTFOUND) {
|
||||||
|
|
|
@ -36,9 +36,9 @@ FailedLeader::FailedLeader(
|
||||||
Job(snapshot, agent, jobId, creator, agencyPrefix), _database(database),
|
Job(snapshot, agent, jobId, creator, agencyPrefix), _database(database),
|
||||||
_collection(collection), _shard(shard), _from(from), _to(to) {
|
_collection(collection), _shard(shard), _from(from), _to(to) {
|
||||||
|
|
||||||
JOB_STATUS js = status();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
JOB_STATUS js = status();
|
||||||
|
|
||||||
if (js == TODO) {
|
if (js == TODO) {
|
||||||
start();
|
start();
|
||||||
} else if (js == NOTFOUND) {
|
} else if (js == NOTFOUND) {
|
||||||
|
|
|
@ -38,8 +38,8 @@ FailedServer::FailedServer(Node const& snapshot,
|
||||||
Job(snapshot, agent, jobId, creator, agencyPrefix),
|
Job(snapshot, agent, jobId, creator, agencyPrefix),
|
||||||
_server(server) {
|
_server(server) {
|
||||||
|
|
||||||
JOB_STATUS js = status();
|
|
||||||
try {
|
try {
|
||||||
|
JOB_STATUS js = status();
|
||||||
if (js == TODO) {
|
if (js == TODO) {
|
||||||
start();
|
start();
|
||||||
} else if (js == NOTFOUND) {
|
} else if (js == NOTFOUND) {
|
||||||
|
@ -220,23 +220,12 @@ JOB_STATUS FailedServer::status () {
|
||||||
for (auto const& subJob : todos) {
|
for (auto const& subJob : todos) {
|
||||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||||
found++;
|
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) {
|
for (auto const& subJob : pends) {
|
||||||
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
if (!subJob.first.compare(0, _jobId.size()+1, _jobId + "-")) {
|
||||||
found++;
|
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),
|
Job(snapshot, agent, jobId, creator, prefix), _database(database),
|
||||||
_collection(collection), _shard(shard), _from(from), _to(to) {
|
_collection(collection), _shard(shard), _from(from), _to(to) {
|
||||||
|
|
||||||
JOB_STATUS js = status();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
JOB_STATUS js = status();
|
||||||
|
|
||||||
if (js == TODO) {
|
if (js == TODO) {
|
||||||
start();
|
start();
|
||||||
} else if (js == NOTFOUND) {
|
} else if (js == NOTFOUND) {
|
||||||
|
@ -251,29 +251,29 @@ JOB_STATUS MoveShard::status () {
|
||||||
Slice current = _snapshot(curPath).slice(),
|
Slice current = _snapshot(curPath).slice(),
|
||||||
plan = _snapshot(curPath).slice();
|
plan = _snapshot(curPath).slice();
|
||||||
|
|
||||||
|
LOG(WARN) << plan.toJson();
|
||||||
|
LOG(WARN) << current.toJson();
|
||||||
|
|
||||||
if (current == plan) {
|
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
|
Builder remove; // remove
|
||||||
cyclic.openArray();
|
remove.openArray();
|
||||||
cyclic.openObject();
|
remove.openObject();
|
||||||
// --- Plan changes
|
// --- 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) {
|
for (size_t i = 1; i < current.length(); ++i) {
|
||||||
cyclic.add(current[i]);
|
remove.add(current[i]);
|
||||||
}
|
}
|
||||||
std::string disabledLeader = current[0].copyString();
|
remove.close();
|
||||||
disabledLeader = disabledLeader.substr(1,disabledLeader.size()-1);
|
|
||||||
cyclic.add(VPackValue(disabledLeader));
|
|
||||||
cyclic.close();
|
|
||||||
// --- Plan version
|
// --- Plan version
|
||||||
cyclic.add(_agencyPrefix + planVersion,
|
remove.add(_agencyPrefix + planVersion,
|
||||||
VPackValue(VPackValueType::Object));
|
VPackValue(VPackValueType::Object));
|
||||||
cyclic.add("op", VPackValue("increment"));
|
remove.add("op", VPackValue("increment"));
|
||||||
cyclic.close();
|
remove.close();
|
||||||
cyclic.close(); cyclic.close();
|
remove.close(); remove.close();
|
||||||
transact(_agent, cyclic);
|
transact(_agent, remove);
|
||||||
|
|
||||||
return PENDING;
|
return PENDING;
|
||||||
|
|
||||||
|
@ -292,6 +292,8 @@ JOB_STATUS MoveShard::status () {
|
||||||
|
|
||||||
if (foundFrom && foundTo) {
|
if (foundFrom && foundTo) {
|
||||||
|
|
||||||
|
LOG(WARN) << _from << " " << current.toJson();
|
||||||
|
|
||||||
if (current[0].copyString() == _from) { // Leader
|
if (current[0].copyString() == _from) { // Leader
|
||||||
|
|
||||||
Builder underscore; // serverId -> _serverId
|
Builder underscore; // serverId -> _serverId
|
||||||
|
@ -342,7 +344,9 @@ JOB_STATUS MoveShard::status () {
|
||||||
|
|
||||||
} else if (foundTo && !foundFrom) {
|
} else if (foundTo && !foundFrom) {
|
||||||
|
|
||||||
return FINISHED;
|
if (finish("Shards/" + _shard)) {
|
||||||
|
return FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,39 +306,35 @@ void Supervision::workJobs() {
|
||||||
for (auto const& todoEnt : todos) {
|
for (auto const& todoEnt : todos) {
|
||||||
Node const& job = *todoEnt.second;
|
Node const& job = *todoEnt.second;
|
||||||
|
|
||||||
try {
|
std::string jobType = job("type").getString(),
|
||||||
std::string jobType = job("type").getString(),
|
jobId = job("jobId").getString(),
|
||||||
jobId = job("jobId").getString(),
|
creator = job("creator").getString();
|
||||||
creator = job("creator").getString();
|
if (jobType == "failedServer") {
|
||||||
if (jobType == "failedServer") {
|
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "cleanOutServer") {
|
||||||
} else if (jobType == "cleanOutServer") {
|
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "moveShard") {
|
||||||
} else if (jobType == "moveShard") {
|
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "failedLeader") {
|
||||||
} else if (jobType == "failedLeader") {
|
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
}
|
||||||
}
|
|
||||||
} catch (std::exception const&) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& pendEnt : pends) {
|
for (auto const& pendEnt : pends) {
|
||||||
Node const& job = *pendEnt.second;
|
Node const& job = *pendEnt.second;
|
||||||
|
|
||||||
try {
|
std::string jobType = job("type").getString(),
|
||||||
std::string jobType = job("type").getString(),
|
jobId = job("jobId").getString(),
|
||||||
jobId = job("jobId").getString(),
|
creator = job("creator").getString();
|
||||||
creator = job("creator").getString();
|
if (jobType == "failedServer") {
|
||||||
if (jobType == "failedServer") {
|
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
FailedServer fs(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "cleanOutServer") {
|
||||||
} else if (jobType == "cleanOutServer") {
|
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
CleanOutServer cos(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "moveShard") {
|
||||||
} else if (jobType == "moveShard") {
|
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
MoveShard mv(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
} else if (jobType == "failedLeader") {
|
||||||
} else if (jobType == "failedLeader") {
|
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
||||||
FailedLeader fl(_snapshot, _agent, jobId, creator, _agencyPrefix);
|
}
|
||||||
}
|
|
||||||
} catch (std::exception const&) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue