diff options
author | Benety Goh <benety@mongodb.com> | 2019-08-28 16:50:05 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-28 16:50:05 +0000 |
commit | 976c841bda34f6f7a9da52b540b70acda65ae2e0 (patch) | |
tree | 6a4c1ac27683c763b45f510bf142083f396453bc /src/mongo/db | |
parent | c72617a4777e31bbd887632e9529b8e00ce0857a (diff) | |
download | mongo-976c841bda34f6f7a9da52b540b70acda65ae2e0.tar.gz |
SERVER-43019 remove unreachable code from IndexBuildsCoordinator and rename function
The code for _shuttingDown was made unreachable by commit c72617a4777e31bbd887632e9529b8e00ce0857a.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/index_builds_coordinator.h | 7 | ||||
-rw-r--r-- | src/mongo/db/index_builds_coordinator_mongod.cpp | 4 |
3 files changed, 6 insertions, 13 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 6c134d36a7b..c28e6000ef9 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -255,9 +255,8 @@ Future<void> IndexBuildsCoordinator::joinIndexBuilds(const NamespaceString& nss, return std::move(pf.future); } -void IndexBuildsCoordinator::interruptAllIndexBuildsForShutdown(const std::string& reason) { +void IndexBuildsCoordinator::waitForAllIndexBuildsToStopForShutdown() { stdx::unique_lock<stdx::mutex> lk(_mutex); - _shuttingDown = true; // All index builds should have been signaled to stop via the ServiceContext. @@ -828,11 +827,6 @@ void IndexBuildsCoordinator::_runIndexBuildInner(OperationContext* opCtx, // Failed index builds should abort secondary oplog application. if (replSetAndNotPrimary) { - stdx::unique_lock<stdx::mutex> lk(_mutex); - if (_shuttingDown) { - // Allow shutdown with success exit status, despite interrupted index builds. - return; - } fassert(51101, status.withContext(str::stream() << "Index build: " << replState->buildUUID << "; Database: " << replState->dbName)); diff --git a/src/mongo/db/index_builds_coordinator.h b/src/mongo/db/index_builds_coordinator.h index b7040be5ba0..1d1846fc354 100644 --- a/src/mongo/db/index_builds_coordinator.h +++ b/src/mongo/db/index_builds_coordinator.h @@ -148,14 +148,14 @@ public: const UUID& buildUUID) = 0; /** - * Signals all the index builds to stop and then waits for them to finish. Leaves the index - * builds in a recoverable state. + * Waits for all index builds to stop after they have been interrupted during shutdown. + * Leaves the index builds in a recoverable state. * * This should only be called when certain the server will not start any new index builds -- * i.e. when the server is not accepting user requests and no internal operations are * concurrently starting new index builds. */ - void interruptAllIndexBuildsForShutdown(const std::string& reason); + void waitForAllIndexBuildsToStopForShutdown(); /** * Signals all of the index builds on the specified collection to abort and then waits until the @@ -442,7 +442,6 @@ protected: IndexBuildsManager _indexBuildsManager; bool _sleepForTest = false; - bool _shuttingDown = false; }; /** diff --git a/src/mongo/db/index_builds_coordinator_mongod.cpp b/src/mongo/db/index_builds_coordinator_mongod.cpp index c3299d97463..695edb86852 100644 --- a/src/mongo/db/index_builds_coordinator_mongod.cpp +++ b/src/mongo/db/index_builds_coordinator_mongod.cpp @@ -80,8 +80,8 @@ void IndexBuildsCoordinatorMongod::shutdown() { // Stop new scheduling. _threadPool.shutdown(); - // Signal active builds to stop and wait for them to stop. - interruptAllIndexBuildsForShutdown("Index build interrupted due to shutdown."); + // Wait for all active builds to stop. + waitForAllIndexBuildsToStopForShutdown(); // Wait for active threads to finish. _threadPool.join(); |