mirror of https://gitee.com/bigwinds/arangodb
Have twice seen coordinator go into long loop on shutdown. Added two tests for isStopping() to break the loops. (#4138)
This commit is contained in:
parent
f8acbd9fae
commit
cb56f0acf1
|
@ -408,7 +408,7 @@ std::string AgencyCommResult::errorMessage() const {
|
||||||
try {
|
try {
|
||||||
std::shared_ptr<VPackBuilder> bodyBuilder =
|
std::shared_ptr<VPackBuilder> bodyBuilder =
|
||||||
VPackParser::fromJson(_body);
|
VPackParser::fromJson(_body);
|
||||||
|
|
||||||
|
|
||||||
VPackSlice body = bodyBuilder->slice();
|
VPackSlice body = bodyBuilder->slice();
|
||||||
if (!body.isObject()) {
|
if (!body.isObject()) {
|
||||||
|
@ -1155,8 +1155,8 @@ AgencyCommResult AgencyComm::sendTransactionWithFailover(
|
||||||
<< result._statusCode
|
<< result._statusCode
|
||||||
<< ", incriminating body: "
|
<< ", incriminating body: "
|
||||||
<< result.bodyRef()
|
<< result.bodyRef()
|
||||||
<< ", url: " << url
|
<< ", url: " << url
|
||||||
<< ", timeout: " << timeout
|
<< ", timeout: " << timeout
|
||||||
<< ", data sent: " << builder.toJson();
|
<< ", data sent: " << builder.toJson();
|
||||||
result.clear();
|
result.clear();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -1456,8 +1456,8 @@ AgencyCommResult AgencyComm::sendWithFailover(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// got a result, we are done
|
// got a result or shutdown, we are done
|
||||||
if (result.successful()) {
|
if (result.successful() || application_features::ApplicationServer::isStopping()) {
|
||||||
AgencyCommManager::MANAGER->release(std::move(connection), endpoint);
|
AgencyCommManager::MANAGER->release(std::move(connection), endpoint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1511,7 +1511,7 @@ AgencyCommResult AgencyComm::sendWithFailover(
|
||||||
if (outer.isObject() && outer.hasKey("ongoing")) {
|
if (outer.isObject() && outer.hasKey("ongoing")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get an answer, and it contains a "results" key,
|
// If we get an answer, and it contains a "results" key,
|
||||||
// we release the connection and break out of the loop letting the
|
// we release the connection and break out of the loop letting the
|
||||||
// inquiry result go to the client. Otherwise try again.
|
// inquiry result go to the client. Otherwise try again.
|
||||||
|
@ -1660,7 +1660,7 @@ AgencyCommResult AgencyComm::send(
|
||||||
|
|
||||||
basics::StringBuffer& sb = response->getBody();
|
basics::StringBuffer& sb = response->getBody();
|
||||||
result._body = std::string(sb.c_str(), sb.length());
|
result._body = std::string(sb.c_str(), sb.length());
|
||||||
|
|
||||||
LOG_TOPIC(TRACE, Logger::AGENCYCOMM)
|
LOG_TOPIC(TRACE, Logger::AGENCYCOMM)
|
||||||
<< "request to agency returned status code " << result._statusCode
|
<< "request to agency returned status code " << result._statusCode
|
||||||
<< ", message: '" << result._message << "', body: '" << result._body
|
<< ", message: '" << result._message << "', body: '" << result._body
|
||||||
|
@ -1675,7 +1675,7 @@ bool AgencyComm::tryInitializeStructure() {
|
||||||
try {
|
try {
|
||||||
VPackObjectBuilder b(&builder);
|
VPackObjectBuilder b(&builder);
|
||||||
|
|
||||||
|
|
||||||
builder.add( // Cluster Id --------------------------
|
builder.add( // Cluster Id --------------------------
|
||||||
"Cluster", VPackValue(to_string(boost::uuids::random_generator()())));
|
"Cluster", VPackValue(to_string(boost::uuids::random_generator()())));
|
||||||
|
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ int ClusterInfo::createCollectionCoordinator(std::string const& databaseName,
|
||||||
LOG_TOPIC(ERR, Logger::CLUSTER) << "Could not get agency dump!";
|
LOG_TOPIC(ERR, Logger::CLUSTER) << "Could not get agency dump!";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorMsg += std::string("file: ") + __FILE__ +
|
errorMsg += std::string("file: ") + __FILE__ +
|
||||||
" line: " + std::to_string(__LINE__);
|
" line: " + std::to_string(__LINE__);
|
||||||
errorMsg += " HTTP code: " + std::to_string(res.httpCode());
|
errorMsg += " HTTP code: " + std::to_string(res.httpCode());
|
||||||
errorMsg += " error message: " + res.errorMessage();
|
errorMsg += " error message: " + res.errorMessage();
|
||||||
|
@ -1660,7 +1660,7 @@ Result ClusterInfo::setCollectionStatusCoordinator(
|
||||||
if (res.successful()) {
|
if (res.successful()) {
|
||||||
loadPlan();
|
loadPlan();
|
||||||
return Result();
|
return Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result(TRI_ERROR_CLUSTER_AGENCY_COMMUNICATION_FAILED, res.errorMessage());
|
return Result(TRI_ERROR_CLUSTER_AGENCY_COMMUNICATION_FAILED, res.errorMessage());
|
||||||
}
|
}
|
||||||
|
@ -1693,7 +1693,7 @@ int ClusterInfo::ensureIndexCoordinator(
|
||||||
int errorCode = ensureIndexCoordinatorWithoutRollback(
|
int errorCode = ensureIndexCoordinatorWithoutRollback(
|
||||||
databaseName, collectionID, idString, slice, create, compare, resultBuilder, errorMsg, timeout);
|
databaseName, collectionID, idString, slice, create, compare, resultBuilder, errorMsg, timeout);
|
||||||
|
|
||||||
if (errorCode == TRI_ERROR_NO_ERROR) {
|
if (errorCode == TRI_ERROR_NO_ERROR || application_features::ApplicationServer::isStopping()) {
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue