Skip to content

Commit 976c841

Browse files
benetyevergreen
authored andcommitted
SERVER-43019 remove unreachable code from IndexBuildsCoordinator and rename function
The code for _shuttingDown was made unreachable by commit c72617a.
1 parent c72617a commit 976c841

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

src/mongo/db/index_builds_coordinator.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,8 @@ Future<void> IndexBuildsCoordinator::joinIndexBuilds(const NamespaceString& nss,
255255
return std::move(pf.future);
256256
}
257257

258-
void IndexBuildsCoordinator::interruptAllIndexBuildsForShutdown(const std::string& reason) {
258+
void IndexBuildsCoordinator::waitForAllIndexBuildsToStopForShutdown() {
259259
stdx::unique_lock<stdx::mutex> lk(_mutex);
260-
_shuttingDown = true;
261260

262261
// All index builds should have been signaled to stop via the ServiceContext.
263262

@@ -828,11 +827,6 @@ void IndexBuildsCoordinator::_runIndexBuildInner(OperationContext* opCtx,
828827

829828
// Failed index builds should abort secondary oplog application.
830829
if (replSetAndNotPrimary) {
831-
stdx::unique_lock<stdx::mutex> lk(_mutex);
832-
if (_shuttingDown) {
833-
// Allow shutdown with success exit status, despite interrupted index builds.
834-
return;
835-
}
836830
fassert(51101,
837831
status.withContext(str::stream() << "Index build: " << replState->buildUUID
838832
<< "; Database: " << replState->dbName));

src/mongo/db/index_builds_coordinator.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ class IndexBuildsCoordinator {
148148
const UUID& buildUUID) = 0;
149149

150150
/**
151-
* Signals all the index builds to stop and then waits for them to finish. Leaves the index
152-
* builds in a recoverable state.
151+
* Waits for all index builds to stop after they have been interrupted during shutdown.
152+
* Leaves the index builds in a recoverable state.
153153
*
154154
* This should only be called when certain the server will not start any new index builds --
155155
* i.e. when the server is not accepting user requests and no internal operations are
156156
* concurrently starting new index builds.
157157
*/
158-
void interruptAllIndexBuildsForShutdown(const std::string& reason);
158+
void waitForAllIndexBuildsToStopForShutdown();
159159

160160
/**
161161
* Signals all of the index builds on the specified collection to abort and then waits until the
@@ -442,7 +442,6 @@ class IndexBuildsCoordinator {
442442
IndexBuildsManager _indexBuildsManager;
443443

444444
bool _sleepForTest = false;
445-
bool _shuttingDown = false;
446445
};
447446

448447
/**

src/mongo/db/index_builds_coordinator_mongod.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ void IndexBuildsCoordinatorMongod::shutdown() {
8080
// Stop new scheduling.
8181
_threadPool.shutdown();
8282

83-
// Signal active builds to stop and wait for them to stop.
84-
interruptAllIndexBuildsForShutdown("Index build interrupted due to shutdown.");
83+
// Wait for all active builds to stop.
84+
waitForAllIndexBuildsToStopForShutdown();
8585

8686
// Wait for active threads to finish.
8787
_threadPool.join();

0 commit comments

Comments
 (0)