diff options
author | Benety Goh <benety@mongodb.com> | 2019-10-09 23:53:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-09 23:53:39 +0000 |
commit | b19059886cbd5fe55df8c7f87335a5d1112c9206 (patch) | |
tree | a51608f84a22c08220de23540b66717a2d34ec18 | |
parent | d1394b01eccd22e0b2f29fc3d818fe783be038b7 (diff) | |
download | mongo-b19059886cbd5fe55df8c7f87335a5d1112c9206.tar.gz |
SERVER-43924 Remove construction of Status with ErrorCodes::Error in IndexBuildsCoordinator
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 92e13973546..6308c20c217 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -829,15 +829,14 @@ void IndexBuildsCoordinator::_runIndexBuildInner(OperationContext* opCtx, std::shared_ptr<ReplIndexBuildState> replState, const IndexBuildOptions& indexBuildOptions) { const NamespaceStringOrUUID dbAndUUID(replState->dbName, replState->collectionUUID); - // 'status' should always be set to something else before this function exits. - Status status{ErrorCodes::InternalError, - "Uninitialized status value in IndexBuildsCoordinator"}; // TODO(SERVER-39484): Since 'replSetAndNotPrimary' is derived from the replication state at the // start of the index build, this value is not resilient to member state changes like // stepup/stepdown. auto replSetAndNotPrimary = indexBuildOptions.replSetAndNotPrimary; + // This Status stays unchanged unless we catch an exception in the following try-catch block. + auto status = Status::OK(); try { // Lock acquisition might throw, and we would still need to clean up the index build state, // so do it in the try-catch block @@ -877,7 +876,6 @@ void IndexBuildsCoordinator::_runIndexBuildInner(OperationContext* opCtx, CollectionCatalog::get(opCtx).lookupCollectionByUUID(replState->collectionUUID); invariant(collection); replState->stats.numIndexesAfter = _getNumIndexesTotal(opCtx, collection); - status = Status::OK(); } catch (const DBException& ex) { status = ex.toStatus(); } |