1
0
Fork 0

Revert change to shared_ptr in ClusterInfo. (#9256)

This commit is contained in:
Dan Larkin-York 2019-06-12 10:19:18 -04:00 committed by Frank Celler
parent 7432c5f152
commit 1b5475a0c2
1 changed files with 6 additions and 6 deletions

View File

@ -2751,11 +2751,11 @@ Result ClusterInfo::ensureIndexCoordinatorInner( // create index
} }
// will contain the error number and message // will contain the error number and message
std::atomic<int> dbServerResult(-1); std::shared_ptr<std::atomic<int>> dbServerResult =
std::make_shared<std::atomic<int>>(-1);
std::shared_ptr<std::string> errMsg = std::make_shared<std::string>(); std::shared_ptr<std::string> errMsg = std::make_shared<std::string>();
std::function<bool(VPackSlice const& result)> dbServerChanged = [=, &dbServerResult]( std::function<bool(VPackSlice const& result)> dbServerChanged = [=](VPackSlice const& result) {
VPackSlice const& result) {
if (!result.isObject() || result.length() != numberOfShards) { if (!result.isObject() || result.length() != numberOfShards) {
return true; return true;
} }
@ -2787,7 +2787,7 @@ Result ClusterInfo::ensureIndexCoordinatorInner( // create index
// error otherwise // error otherwise
int errNum = arangodb::basics::VelocyPackHelper::readNumericValue<int>( int errNum = arangodb::basics::VelocyPackHelper::readNumericValue<int>(
v, StaticStrings::ErrorNum, TRI_ERROR_ARANGO_INDEX_CREATION_FAILED); v, StaticStrings::ErrorNum, TRI_ERROR_ARANGO_INDEX_CREATION_FAILED);
dbServerResult.store(errNum, std::memory_order_release); dbServerResult->store(errNum, std::memory_order_release);
return true; return true;
} }
@ -2798,7 +2798,7 @@ Result ClusterInfo::ensureIndexCoordinatorInner( // create index
} }
if (found == (size_t)numberOfShards) { if (found == (size_t)numberOfShards) {
dbServerResult.store(setErrormsg(TRI_ERROR_NO_ERROR, *errMsg), std::memory_order_release); dbServerResult->store(setErrormsg(TRI_ERROR_NO_ERROR, *errMsg), std::memory_order_release);
} }
return true; return true;
@ -2879,7 +2879,7 @@ Result ClusterInfo::ensureIndexCoordinatorInner( // create index
{ {
while (!application_features::ApplicationServer::isStopping()) { while (!application_features::ApplicationServer::isStopping()) {
int tmpRes = dbServerResult.load(std::memory_order_acquire); int tmpRes = dbServerResult->load(std::memory_order_acquire);
if (tmpRes < 0) { if (tmpRes < 0) {
// index has not shown up in Current yet, follow up check to // index has not shown up in Current yet, follow up check to