diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2017-06-09 14:06:26 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2017-06-09 14:06:26 -0400 |
commit | f9c36696a25d3837f512421755952736236bbed0 (patch) | |
tree | 9becbcdb1ade14d930d3b2da3c731ebfe20f8a75 /src/mongo/db | |
parent | db55e668d87d66b171c310241bdbcabfa790e2cf (diff) | |
download | mongo-f9c36696a25d3837f512421755952736236bbed0.tar.gz |
SERVER-29493 Make ThreadPoolTaskExecutor's destructor execute shutdown and join.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/repl/abstract_async_component_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.h | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/base_cloner_test_fixture.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/databases_cloner_test.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/multiapplier_test.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher_test.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/reporter_test.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/rollback_common_point_resolver_test.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/repl/rollback_test_fixture.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/sync_source_resolver_test.cpp | 6 |
12 files changed, 10 insertions, 55 deletions
diff --git a/src/mongo/db/repl/abstract_async_component_test.cpp b/src/mongo/db/repl/abstract_async_component_test.cpp index 5c69ca67d76..9d82755bafd 100644 --- a/src/mongo/db/repl/abstract_async_component_test.cpp +++ b/src/mongo/db/repl/abstract_async_component_test.cpp @@ -177,8 +177,6 @@ void AbstractAsyncComponentTest::setUp() { void AbstractAsyncComponentTest::tearDown() { shutdownExecutorThread(); joinExecutorThread(); - - executor::ThreadPoolExecutorTest::tearDown(); } TEST_F(AbstractAsyncComponentTest, ConstructorThrowsUserAssertionOnNullTaskExecutor) { diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp index 98c1bd08957..ab818341712 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp @@ -92,10 +92,6 @@ void AbstractOplogFetcherTest::setUp() { lastFetched = {456LL, {{123, 0}, 1}}; } -void AbstractOplogFetcherTest::tearDown() { - executor::ThreadPoolExecutorTest::tearDown(); -} - executor::RemoteCommandRequest AbstractOplogFetcherTest::processNetworkResponse( executor::RemoteCommandResponse response, bool expectReadyRequestsAfterProcessing) { diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.h b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.h index d33ff6174b1..2e238000e70 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.h +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.h @@ -82,7 +82,6 @@ public: protected: void setUp() override; - void tearDown() override; /** * Schedules network response and instructs network interface to process response. diff --git a/src/mongo/db/repl/base_cloner_test_fixture.cpp b/src/mongo/db/repl/base_cloner_test_fixture.cpp index 89676a8a7f6..e1a8131fb10 100644 --- a/src/mongo/db/repl/base_cloner_test_fixture.cpp +++ b/src/mongo/db/repl/base_cloner_test_fixture.cpp @@ -111,14 +111,12 @@ void BaseClonerTest::setUp() { } void BaseClonerTest::tearDown() { - executor::ThreadPoolExecutorTest::shutdownExecutorThread(); - executor::ThreadPoolExecutorTest::joinExecutorThread(); + getExecutor().shutdown(); + getExecutor().join(); storageInterface.reset(); dbWorkThreadPool->join(); dbWorkThreadPool.reset(); - - executor::ThreadPoolExecutorTest::tearDown(); } void BaseClonerTest::clear() { diff --git a/src/mongo/db/repl/databases_cloner_test.cpp b/src/mongo/db/repl/databases_cloner_test.cpp index f6a50786e47..36020cea9a8 100644 --- a/src/mongo/db/repl/databases_cloner_test.cpp +++ b/src/mongo/db/repl/databases_cloner_test.cpp @@ -186,12 +186,9 @@ protected: } void tearDown() override { - executor::ThreadPoolExecutorTest::shutdownExecutorThread(); - executor::ThreadPoolExecutorTest::joinExecutorThread(); - + getExecutor().shutdown(); + getExecutor().join(); _dbWorkThreadPool.join(); - - executor::ThreadPoolExecutorTest::tearDown(); } /** diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index c549bfbe391..1a55a5d83dc 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -360,8 +360,8 @@ protected: if (_executorThreadShutdownComplete) { return; } - executor::ThreadPoolExecutorTest::shutdownExecutorThread(); - executor::ThreadPoolExecutorTest::joinExecutorThread(); + getExecutor().shutdown(); + getExecutor().join(); _executorThreadShutdownComplete = true; } @@ -372,9 +372,6 @@ protected: _dbWorkThreadPool.reset(); _replicationProcess.reset(); _storageInterface.reset(); - - // tearDown() destroys the task executor which was referenced by the initial syncer. - executor::ThreadPoolExecutorTest::tearDown(); } /** diff --git a/src/mongo/db/repl/multiapplier_test.cpp b/src/mongo/db/repl/multiapplier_test.cpp index 45f387ecd0c..a031064130b 100644 --- a/src/mongo/db/repl/multiapplier_test.cpp +++ b/src/mongo/db/repl/multiapplier_test.cpp @@ -45,7 +45,6 @@ public: private: executor::ThreadPoolMock::Options makeThreadPoolMockOptions() const override; void setUp() override; - void tearDown() override; }; executor::ThreadPoolMock::Options MultiApplierTest::makeThreadPoolMockOptions() const { @@ -60,15 +59,6 @@ void MultiApplierTest::setUp() { launchExecutorThread(); } -void MultiApplierTest::tearDown() { - executor::ThreadPoolExecutorTest::shutdownExecutorThread(); - executor::ThreadPoolExecutorTest::joinExecutorThread(); - - // Local tear down steps here. - - executor::ThreadPoolExecutorTest::tearDown(); -} - Status applyOperation(MultiApplier::OperationPtrs*) { return Status::OK(); }; diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp index f4d91c6baed..01e85bc355e 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -54,7 +54,6 @@ using NetworkGuard = executor::NetworkInterfaceMock::InNetworkGuard; class OplogFetcherTest : public AbstractOplogFetcherTest { protected: void setUp() override; - void tearDown() override; /** * Starts an oplog fetcher. Processes a single batch of results from @@ -117,10 +116,6 @@ void OplogFetcherTest::setUp() { }; } -void OplogFetcherTest::tearDown() { - AbstractOplogFetcherTest::tearDown(); -} - BSONObj OplogFetcherTest::makeOplogQueryMetadataObject(OpTime lastAppliedOpTime, int rbid, int primaryIndex, diff --git a/src/mongo/db/repl/reporter_test.cpp b/src/mongo/db/repl/reporter_test.cpp index 383b2cf8aca..f0261d64f5f 100644 --- a/src/mongo/db/repl/reporter_test.cpp +++ b/src/mongo/db/repl/reporter_test.cpp @@ -182,7 +182,8 @@ void ReporterTest::setUp() { } void ReporterTest::tearDown() { - executor::ThreadPoolExecutorTest::tearDown(); + getExecutor().shutdown(); + getExecutor().join(); // Executor may still invoke reporter's callback before shutting down. reporter.reset(); posUpdater.reset(); diff --git a/src/mongo/db/repl/rollback_common_point_resolver_test.cpp b/src/mongo/db/repl/rollback_common_point_resolver_test.cpp index 4ed949ae1ce..d537e200362 100644 --- a/src/mongo/db/repl/rollback_common_point_resolver_test.cpp +++ b/src/mongo/db/repl/rollback_common_point_resolver_test.cpp @@ -99,9 +99,6 @@ private: class RollbackCommonPointResolverTest : public AbstractOplogFetcherTest { protected: - void setUp() override; - void tearDown() override; - /** * Starts a rollback common point resolver. Processes a single batch of results from * the oplog query and shuts down. @@ -152,16 +149,6 @@ protected: std::unique_ptr<ShutdownState> shutdownState; }; -void RollbackCommonPointResolverTest::setUp() { - AbstractOplogFetcherTest::setUp(); -} - -void RollbackCommonPointResolverTest::tearDown() { - AbstractOplogFetcherTest::tearDown(); - resolver.reset(); - shutdownState.reset(); -} - HostAndPort source("localhost:12345"); NamespaceString nss("local.oplog.rs"); diff --git a/src/mongo/db/repl/rollback_test_fixture.cpp b/src/mongo/db/repl/rollback_test_fixture.cpp index 791cbf0e2e7..cd77a41ba95 100644 --- a/src/mongo/db/repl/rollback_test_fixture.cpp +++ b/src/mongo/db/repl/rollback_test_fixture.cpp @@ -90,7 +90,6 @@ void RollbackTest::setUp() { void RollbackTest::tearDown() { _coordinator = nullptr; _opCtx.reset(); - _threadPoolExecutorTest.tearDown(); // We cannot unset the global replication coordinator because ServiceContextMongoD::tearDown() // calls dropAllDatabasesExceptLocal() which requires the replication coordinator to clear all diff --git a/src/mongo/db/repl/sync_source_resolver_test.cpp b/src/mongo/db/repl/sync_source_resolver_test.cpp index da410b6082a..48bdf70f13c 100644 --- a/src/mongo/db/repl/sync_source_resolver_test.cpp +++ b/src/mongo/db/repl/sync_source_resolver_test.cpp @@ -108,14 +108,12 @@ void SyncSourceResolverTest::setUp() { } void SyncSourceResolverTest::tearDown() { - executor::ThreadPoolExecutorTest::shutdownExecutorThread(); - executor::ThreadPoolExecutorTest::joinExecutorThread(); + getExecutor().shutdown(); + getExecutor().join(); _resolver.reset(); _selector.reset(); _executorProxy.reset(); - - executor::ThreadPoolExecutorTest::tearDown(); } std::unique_ptr<SyncSourceResolver> SyncSourceResolverTest::_makeResolver( |