mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
0907e901f2
|
@ -1381,6 +1381,61 @@ AgencyCommResult AgencyComm::sendWithFailover(
|
|||
waitInterval = std::chrono::duration<double>(.25);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Precondition failed.
|
||||
|
||||
if (result._statusCode == 412 && !clientId.empty()) {
|
||||
VPackBuilder b;
|
||||
{
|
||||
VPackArrayBuilder ab(&b);
|
||||
b.add(VPackValue(clientId));
|
||||
}
|
||||
|
||||
LOG_TOPIC(INFO, Logger::AGENCYCOMM) <<
|
||||
"Got precondition failed! Inquiring about clientId " << clientId << ": ";
|
||||
|
||||
AgencyCommResult inq = send(
|
||||
connection.get(), method, conTimeout, "/_api/agency/inquire",
|
||||
b.toJson(), "");
|
||||
|
||||
if (inq.successful()) {
|
||||
auto bodyBuilder = VPackParser::fromJson(inq._body);
|
||||
auto const& slice = bodyBuilder->slice();
|
||||
bool success = false;
|
||||
if (slice.isArray() && slice.length() > 0) {
|
||||
for (auto const& i : VPackArrayIterator(slice)) {
|
||||
if (i.isArray() && i.length() > 0) {
|
||||
for (auto const& j : VPackArrayIterator(i)) {
|
||||
if (j.getUInt() == 0) {
|
||||
LOG_TOPIC(INFO, Logger::AGENCYCOMM)
|
||||
<< body << " failed: " << slice.toJson();
|
||||
return result;
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
LOG_TOPIC(INFO, Logger::AGENCYCOMM)
|
||||
<< body << " succeeded with " << slice.toJson();
|
||||
return inq;
|
||||
} else {
|
||||
LOG_TOPIC(INFO, Logger::AGENCYCOMM)
|
||||
<< body << " failed with " << slice.toJson();
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
return inq;
|
||||
} else {
|
||||
LOG_TOPIC(INFO, Logger::AGENCYCOMM) <<
|
||||
"with error. Keep trying ...";
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// do not retry on client errors
|
||||
if (result._statusCode >= 400 && result._statusCode <= 499) {
|
||||
|
@ -1532,7 +1587,7 @@ bool AgencyComm::tryInitializeStructure(std::string const& jwtSecret) {
|
|||
builder.add(VPackValue("ServersRegistered"));
|
||||
{
|
||||
VPackObjectBuilder c(&builder);
|
||||
builder.add("Version", VPackValue("1"));
|
||||
builder.add("Version", VPackValue(1));
|
||||
}
|
||||
addEmptyVPackObject("Databases", builder);
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ bool Node::applieOp(VPackSlice const& slice) {
|
|||
return handle<OBSERVE>(slice);
|
||||
} else if (oper == "unobserve") { // "op":"unobserve"
|
||||
handle<UNOBSERVE>(slice);
|
||||
if (_children.empty()) {
|
||||
if (_children.empty() && _value.empty()) {
|
||||
if (_parent == nullptr) { // root node
|
||||
_children.clear();
|
||||
_value.clear();
|
||||
|
|
|
@ -1758,9 +1758,23 @@ int ClusterInfo::ensureIndexCoordinator(
|
|||
AgencyCommResult result = ac.sendTransactionWithFailover(trx, 0.0);
|
||||
|
||||
if (!result.successful()) {
|
||||
errorMsg += "ClientId: " + result._clientId;
|
||||
errorMsg += std::string(" ") + __FILE__ + ":" + std::to_string(__LINE__);
|
||||
resultBuilder = *resBuilder;
|
||||
if (result.httpCode() ==
|
||||
(int)arangodb::rest::ResponseCode::PRECONDITION_FAILED) {
|
||||
AgencyCommResult ag = ac.getValues("/");
|
||||
if (ag.successful()) {
|
||||
LOG_TOPIC(ERR, Logger::CLUSTER) << "Agency dump:\n"
|
||||
<< ag.slice().toJson();
|
||||
} else {
|
||||
LOG_TOPIC(ERR, Logger::CLUSTER) << "Could not get agency dump!";
|
||||
}
|
||||
} else {
|
||||
errorMsg += " Failed to execute ";
|
||||
errorMsg += trx.toJson();
|
||||
errorMsg += "ClientId: " + result._clientId + " ";
|
||||
errorMsg += " ResultCode: " + std::to_string(result.errorCode()) + " ";
|
||||
errorMsg += std::string(__FILE__) + ":" + std::to_string(__LINE__);
|
||||
resultBuilder = *resBuilder;
|
||||
}
|
||||
return TRI_ERROR_CLUSTER_COULD_NOT_CREATE_INDEX_IN_PLAN;
|
||||
}
|
||||
|
||||
|
@ -1979,8 +1993,11 @@ int ClusterInfo::dropIndexCoordinator(std::string const& databaseName,
|
|||
AgencyCommResult result = ac.sendTransactionWithFailover(trx, 0.0);
|
||||
|
||||
if (!result.successful()) {
|
||||
errorMsg += "ClientId: " + result._clientId;
|
||||
errorMsg += std::string(" ") + __FILE__ + ":" + std::to_string(__LINE__);
|
||||
errorMsg += " Failed to execute ";
|
||||
errorMsg += trx.toJson();
|
||||
errorMsg += " ClientId: " + result._clientId + " ";
|
||||
errorMsg += " ResultCode: " + std::to_string(result.errorCode()) + " ";
|
||||
|
||||
events::DropIndex(collectionID, idString,
|
||||
TRI_ERROR_CLUSTER_COULD_NOT_DROP_INDEX_IN_PLAN);
|
||||
return TRI_ERROR_CLUSTER_COULD_NOT_DROP_INDEX_IN_PLAN;
|
||||
|
|
Loading…
Reference in New Issue