1
0
Fork 0

Have twice seen coordinator go into long loop on shutdown. Added two tests for isStopping() to break the loops. (#4139)

This commit is contained in:
Matthew Von-Maszewski 2017-12-21 14:56:14 -05:00 committed by Jan
parent 223f63bed1
commit f35215ea51
2 changed files with 9 additions and 9 deletions

View File

@ -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 (...) {
@ -1457,8 +1457,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;
} }
@ -1512,7 +1512,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.
@ -1661,7 +1661,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
@ -1676,7 +1676,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()())));

View File

@ -1695,7 +1695,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;
} }