summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-07-20 11:30:03 -0400
committerBenety Goh <benety@mongodb.com>2016-07-26 21:21:40 -0400
commit44eabe39a7208706c3a31e9483fd5218e40fb967 (patch)
tree58b0a5e13a8e485e4efaacdd1cd8cda8c06a1451
parent8dd8bdf4dcb990ccb31ee753eb5b1afa10071e14 (diff)
downloadmongo-44eabe39a7208706c3a31e9483fd5218e40fb967.tar.gz
SERVER-25281 renamed CollectionCloner and DatabaseCloner lifecycle functions
-rw-r--r--src/mongo/db/repl/base_cloner.h6
-rw-r--r--src/mongo/db/repl/base_cloner_test_fixture.cpp18
-rw-r--r--src/mongo/db/repl/collection_cloner.cpp8
-rw-r--r--src/mongo/db/repl/collection_cloner.h6
-rw-r--r--src/mongo/db/repl/collection_cloner_test.cpp46
-rw-r--r--src/mongo/db/repl/database_cloner.cpp10
-rw-r--r--src/mongo/db/repl/database_cloner.h6
-rw-r--r--src/mongo/db/repl/database_cloner_test.cpp44
-rw-r--r--src/mongo/db/repl/databases_cloner.cpp6
9 files changed, 75 insertions, 75 deletions
diff --git a/src/mongo/db/repl/base_cloner.h b/src/mongo/db/repl/base_cloner.h
index c6de09f8d31..eb4c0c381b1 100644
--- a/src/mongo/db/repl/base_cloner.h
+++ b/src/mongo/db/repl/base_cloner.h
@@ -61,7 +61,7 @@ public:
/**
* Starts cloning by scheduling initial command to be run by the executor.
*/
- virtual Status start() = 0;
+ virtual Status startup() = 0;
/**
* Cancels current remote command request.
@@ -69,13 +69,13 @@ public:
*
* Callback function may be invoked with an ErrorCodes::CallbackCanceled status.
*/
- virtual void cancel() = 0;
+ virtual void shutdown() = 0;
/**
* Waits for active remote commands and database worker to complete.
* Returns immediately if cloner is not active.
*/
- virtual void wait() = 0;
+ virtual void join() = 0;
};
} // namespace repl
diff --git a/src/mongo/db/repl/base_cloner_test_fixture.cpp b/src/mongo/db/repl/base_cloner_test_fixture.cpp
index a34f4209a77..ac926addcd9 100644
--- a/src/mongo/db/repl/base_cloner_test_fixture.cpp
+++ b/src/mongo/db/repl/base_cloner_test_fixture.cpp
@@ -190,47 +190,47 @@ void BaseClonerTest::testLifeCycle() {
// IsActiveAfterStart
ASSERT_FALSE(getCloner()->isActive());
- ASSERT_OK(getCloner()->start());
+ ASSERT_OK(getCloner()->startup());
ASSERT_TRUE(getCloner()->isActive());
tearDown();
// StartWhenActive
setUp();
- ASSERT_OK(getCloner()->start());
+ ASSERT_OK(getCloner()->startup());
ASSERT_TRUE(getCloner()->isActive());
- ASSERT_NOT_OK(getCloner()->start());
+ ASSERT_NOT_OK(getCloner()->startup());
ASSERT_TRUE(getCloner()->isActive());
tearDown();
// CancelWithoutStart
setUp();
ASSERT_FALSE(getCloner()->isActive());
- getCloner()->cancel();
+ getCloner()->shutdown();
ASSERT_FALSE(getCloner()->isActive());
tearDown();
// WaitWithoutStart
setUp();
ASSERT_FALSE(getCloner()->isActive());
- getCloner()->wait();
+ getCloner()->join();
ASSERT_FALSE(getCloner()->isActive());
tearDown();
// ShutdownBeforeStart
setUp();
getExecutor().shutdown();
- ASSERT_NOT_OK(getCloner()->start());
+ ASSERT_NOT_OK(getCloner()->startup());
ASSERT_FALSE(getCloner()->isActive());
tearDown();
// StartAndCancel
setUp();
- ASSERT_OK(getCloner()->start());
+ ASSERT_OK(getCloner()->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
scheduleNetworkResponse(BSON("ok" << 1));
}
- getCloner()->cancel();
+ getCloner()->shutdown();
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
finishProcessingNetworkResponse();
@@ -241,7 +241,7 @@ void BaseClonerTest::testLifeCycle() {
// StartButShutdown
setUp();
- ASSERT_OK(getCloner()->start());
+ ASSERT_OK(getCloner()->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
scheduleNetworkResponse(BSON("ok" << 1));
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp
index fde0b65bf36..b7ddae0512a 100644
--- a/src/mongo/db/repl/collection_cloner.cpp
+++ b/src/mongo/db/repl/collection_cloner.cpp
@@ -131,7 +131,7 @@ CollectionCloner::CollectionCloner(executor::TaskExecutor* executor,
}
CollectionCloner::~CollectionCloner() {
- DESTRUCTOR_GUARD(cancel(); wait(););
+ DESTRUCTOR_GUARD(shutdown(); join(););
}
const NamespaceString& CollectionCloner::getSourceNamespace() const {
@@ -158,7 +158,7 @@ bool CollectionCloner::isActive() const {
return _active;
}
-Status CollectionCloner::start() {
+Status CollectionCloner::startup() {
LockGuard lk(_mutex);
LOG(0) << "CollectionCloner::start called, on ns:" << _destNss;
@@ -177,7 +177,7 @@ Status CollectionCloner::start() {
return Status::OK();
}
-void CollectionCloner::cancel() {
+void CollectionCloner::shutdown() {
if (!isActive()) {
return;
}
@@ -192,7 +192,7 @@ CollectionCloner::Stats CollectionCloner::getStats() const {
return _stats;
}
-void CollectionCloner::wait() {
+void CollectionCloner::join() {
stdx::unique_lock<stdx::mutex> lk(_mutex);
_condition.wait(lk, [this]() { return !_active; });
}
diff --git a/src/mongo/db/repl/collection_cloner.h b/src/mongo/db/repl/collection_cloner.h
index e290d9f6fe6..02c7d872ed9 100644
--- a/src/mongo/db/repl/collection_cloner.h
+++ b/src/mongo/db/repl/collection_cloner.h
@@ -103,11 +103,11 @@ public:
bool isActive() const override;
- Status start() override;
+ Status startup() override;
- void cancel() override;
+ void shutdown() override;
- void wait() override;
+ void join() override;
CollectionCloner::Stats getStats() const;
diff --git a/src/mongo/db/repl/collection_cloner_test.cpp b/src/mongo/db/repl/collection_cloner_test.cpp
index 5e7b6dda542..d6f13ee9720 100644
--- a/src/mongo/db/repl/collection_cloner_test.cpp
+++ b/src/mongo/db/repl/collection_cloner_test.cpp
@@ -170,7 +170,7 @@ TEST_F(CollectionClonerTest, ClonerLifeCycle) {
}
TEST_F(CollectionClonerTest, FirstRemoteCommand) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
auto net = getNet();
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -213,7 +213,7 @@ TEST_F(CollectionClonerTest, DoNotCreateIDIndexIfAutoIndexIdUsed) {
return std::unique_ptr<CollectionBulkLoader>(loader);
};
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListIndexesResponse(0, BSONArray()));
@@ -229,7 +229,7 @@ TEST_F(CollectionClonerTest, DoNotCreateIDIndexIfAutoIndexIdUsed) {
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createCursorResponse(0, BSON_ARRAY(doc)));
}
- collectionCloner->wait();
+ collectionCloner->join();
ASSERT_EQUALS(1, collectionStats.insertCount);
ASSERT_TRUE(collectionStats.commitCalled);
@@ -243,7 +243,7 @@ TEST_F(CollectionClonerTest, DoNotCreateIDIndexIfAutoIndexIdUsed) {
// A collection may have no indexes. The cloner will produce a warning but
// will still proceed with cloning.
TEST_F(CollectionClonerTest, ListIndexesReturnedNoIndexes) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
// Using a non-zero cursor to ensure that
// the cloner stops the fetcher from retrieving more results.
@@ -262,7 +262,7 @@ TEST_F(CollectionClonerTest, ListIndexesReturnedNoIndexes) {
}
TEST_F(CollectionClonerTest, ListIndexesReturnedNamespaceNotFound) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
bool collectionCreated = false;
NamespaceString collNss;
@@ -279,7 +279,7 @@ TEST_F(CollectionClonerTest, ListIndexesReturnedNamespaceNotFound) {
processNetworkResponse(ErrorCodes::NamespaceNotFound, "The collection doesn't exist.");
}
- collectionCloner->wait();
+ collectionCloner->join();
ASSERT_OK(getStatus());
ASSERT_FALSE(collectionCloner->isActive());
ASSERT_TRUE(collectionCreated);
@@ -287,7 +287,7 @@ TEST_F(CollectionClonerTest, ListIndexesReturnedNamespaceNotFound) {
}
TEST_F(CollectionClonerTest, BeginCollectionScheduleDbWorkFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
// Replace scheduleDbWork function so that cloner will fail to schedule DB work after
// getting index specs.
@@ -306,7 +306,7 @@ TEST_F(CollectionClonerTest, BeginCollectionScheduleDbWorkFailed) {
}
TEST_F(CollectionClonerTest, BeginCollectionCallbackCanceled) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
// Replace scheduleDbWork function so that the callback runs with a cancelled status.
auto&& executor = getExecutor();
@@ -332,7 +332,7 @@ TEST_F(CollectionClonerTest, BeginCollectionCallbackCanceled) {
}
TEST_F(CollectionClonerTest, BeginCollectionFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
storageInterface->createCollectionForBulkFn = [&](const NamespaceString& theNss,
const CollectionOptions& theOptions,
@@ -353,7 +353,7 @@ TEST_F(CollectionClonerTest, BeginCollectionFailed) {
}
TEST_F(CollectionClonerTest, BeginCollection) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
CollectionMockStats stats;
CollectionBulkLoaderMock* loader = new CollectionBulkLoaderMock(&stats);
@@ -416,7 +416,7 @@ TEST_F(CollectionClonerTest, BeginCollection) {
}
TEST_F(CollectionClonerTest, FindFetcherScheduleFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
// Shut down executor while in beginCollection callback.
// This will cause the fetcher to fail to schedule the find command.
@@ -446,7 +446,7 @@ TEST_F(CollectionClonerTest, FindFetcherScheduleFailed) {
}
TEST_F(CollectionClonerTest, FindCommandAfterBeginCollection) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
CollectionMockStats stats;
CollectionBulkLoaderMock* loader = new CollectionBulkLoaderMock(&stats);
@@ -482,7 +482,7 @@ TEST_F(CollectionClonerTest, FindCommandAfterBeginCollection) {
}
TEST_F(CollectionClonerTest, FindCommandFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -505,7 +505,7 @@ TEST_F(CollectionClonerTest, FindCommandFailed) {
}
TEST_F(CollectionClonerTest, FindCommandCanceled) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
@@ -530,7 +530,7 @@ TEST_F(CollectionClonerTest, FindCommandCanceled) {
}
ASSERT_TRUE(collectionCloner->isActive());
- collectionCloner->cancel();
+ collectionCloner->shutdown();
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -543,7 +543,7 @@ TEST_F(CollectionClonerTest, FindCommandCanceled) {
}
TEST_F(CollectionClonerTest, InsertDocumentsScheduleDbWorkFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -570,7 +570,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsScheduleDbWorkFailed) {
}
TEST_F(CollectionClonerTest, InsertDocumentsCallbackCanceled) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -602,7 +602,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsCallbackCanceled) {
}
TEST_F(CollectionClonerTest, InsertDocumentsFailed) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
@@ -627,7 +627,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsFailed) {
processNetworkResponse(createCursorResponse(0, BSON_ARRAY(BSON("_id" << 1))));
}
- collectionCloner->wait();
+ collectionCloner->join();
ASSERT_FALSE(collectionCloner->isActive());
ASSERT_EQUALS(0, collectionStats.insertCount);
@@ -635,7 +635,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsFailed) {
}
TEST_F(CollectionClonerTest, InsertDocumentsSingleBatch) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
@@ -665,7 +665,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsSingleBatch) {
}
TEST_F(CollectionClonerTest, InsertDocumentsMultipleBatches) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
@@ -709,7 +709,7 @@ TEST_F(CollectionClonerTest, InsertDocumentsMultipleBatches) {
}
TEST_F(CollectionClonerTest, LastBatchContainsNoDocuments) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
@@ -761,7 +761,7 @@ TEST_F(CollectionClonerTest, LastBatchContainsNoDocuments) {
}
TEST_F(CollectionClonerTest, MiddleBatchContainsNoDocuments) {
- ASSERT_OK(collectionCloner->start());
+ ASSERT_OK(collectionCloner->startup());
ASSERT_TRUE(collectionCloner->isActive());
{
diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp
index d928bb374c5..35ba3254681 100644
--- a/src/mongo/db/repl/database_cloner.cpp
+++ b/src/mongo/db/repl/database_cloner.cpp
@@ -114,7 +114,7 @@ DatabaseCloner::DatabaseCloner(executor::TaskExecutor* executor,
numListCollectionsRetries,
executor::RemoteCommandRequest::kNoTimeout,
RemoteCommandRetryScheduler::kAllRetriableErrors)),
- _startCollectionCloner([](CollectionCloner& cloner) { return cloner.start(); }) {
+ _startCollectionCloner([](CollectionCloner& cloner) { return cloner.startup(); }) {
// Fetcher throws an exception on null executor.
invariant(executor);
uassert(ErrorCodes::BadValue, "db worker thread pool cannot be null", dbWorkThreadPool);
@@ -125,7 +125,7 @@ DatabaseCloner::DatabaseCloner(executor::TaskExecutor* executor,
}
DatabaseCloner::~DatabaseCloner() {
- DESTRUCTOR_GUARD(cancel(); wait(););
+ DESTRUCTOR_GUARD(shutdown(); join(););
}
const std::vector<BSONObj>& DatabaseCloner::getCollectionInfos() const {
@@ -156,7 +156,7 @@ bool DatabaseCloner::isActive() const {
return _active;
}
-Status DatabaseCloner::start() {
+Status DatabaseCloner::startup() {
LockGuard lk(_mutex);
if (_active) {
@@ -177,7 +177,7 @@ Status DatabaseCloner::start() {
return Status::OK();
}
-void DatabaseCloner::cancel() {
+void DatabaseCloner::shutdown() {
{
LockGuard lk(_mutex);
@@ -194,7 +194,7 @@ DatabaseCloner::Stats DatabaseCloner::getStats() const {
return _stats;
}
-void DatabaseCloner::wait() {
+void DatabaseCloner::join() {
UniqueLock lk(_mutex);
_condition.wait(lk, [this]() { return !_active; });
}
diff --git a/src/mongo/db/repl/database_cloner.h b/src/mongo/db/repl/database_cloner.h
index 9472e79521c..bb6ecf13c77 100644
--- a/src/mongo/db/repl/database_cloner.h
+++ b/src/mongo/db/repl/database_cloner.h
@@ -130,11 +130,11 @@ public:
bool isActive() const override;
- Status start() override;
+ Status startup() override;
- void cancel() override;
+ void shutdown() override;
- void wait() override;
+ void join() override;
DatabaseCloner::Stats getStats() const;
diff --git a/src/mongo/db/repl/database_cloner_test.cpp b/src/mongo/db/repl/database_cloner_test.cpp
index 254c87206e7..77516249d51 100644
--- a/src/mongo/db/repl/database_cloner_test.cpp
+++ b/src/mongo/db/repl/database_cloner_test.cpp
@@ -187,7 +187,7 @@ TEST_F(DatabaseClonerTest, ClonerLifeCycle) {
}
TEST_F(DatabaseClonerTest, FirstRemoteCommandWithoutFilter) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
auto net = getNet();
executor::NetworkInterfaceMock::InNetworkGuard guard(net);
@@ -218,7 +218,7 @@ TEST_F(DatabaseClonerTest, FirstRemoteCommandWithFilter) {
stdx::placeholders::_1,
stdx::placeholders::_2),
stdx::bind(&DatabaseClonerTest::setStatus, this, stdx::placeholders::_1)));
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
auto net = getNet();
executor::NetworkInterfaceMock::InNetworkGuard guard(net);
@@ -236,7 +236,7 @@ TEST_F(DatabaseClonerTest, FirstRemoteCommandWithFilter) {
}
TEST_F(DatabaseClonerTest, InvalidListCollectionsFilter) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -252,7 +252,7 @@ TEST_F(DatabaseClonerTest, InvalidListCollectionsFilter) {
// A database may have no collections. Nothing to do for the database cloner.
TEST_F(DatabaseClonerTest, ListCollectionsReturnedNoCollections) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
// Keep going even if initial batch is empty.
{
@@ -290,7 +290,7 @@ TEST_F(DatabaseClonerTest, ListCollectionsPredicate) {
stdx::placeholders::_1,
stdx::placeholders::_2),
stdx::bind(&DatabaseClonerTest::setStatus, this, stdx::placeholders::_1)));
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
const std::vector<BSONObj> sourceInfos = {BSON("name"
<< "a"
@@ -320,7 +320,7 @@ TEST_F(DatabaseClonerTest, ListCollectionsPredicate) {
}
TEST_F(DatabaseClonerTest, ListCollectionsMultipleBatches) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
const std::vector<BSONObj> sourceInfos = {BSON("name"
<< "a"
@@ -362,7 +362,7 @@ TEST_F(DatabaseClonerTest, ListCollectionsMultipleBatches) {
}
TEST_F(DatabaseClonerTest, CollectionInfoNameFieldMissing) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(
@@ -374,7 +374,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoNameFieldMissing) {
}
TEST_F(DatabaseClonerTest, CollectionInfoNameNotAString) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListCollectionsResponse(
@@ -386,7 +386,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoNameNotAString) {
}
TEST_F(DatabaseClonerTest, CollectionInfoNameEmpty) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListCollectionsResponse(0,
@@ -401,7 +401,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoNameEmpty) {
}
TEST_F(DatabaseClonerTest, CollectionInfoNameDuplicate) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListCollectionsResponse(0,
@@ -420,7 +420,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoNameDuplicate) {
}
TEST_F(DatabaseClonerTest, CollectionInfoOptionsFieldMissing) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListCollectionsResponse(0,
@@ -433,7 +433,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoOptionsFieldMissing) {
}
TEST_F(DatabaseClonerTest, CollectionInfoOptionsNotAnObject) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(createListCollectionsResponse(0,
@@ -448,7 +448,7 @@ TEST_F(DatabaseClonerTest, CollectionInfoOptionsNotAnObject) {
}
TEST_F(DatabaseClonerTest, InvalidCollectionOptions) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
processNetworkResponse(
@@ -476,7 +476,7 @@ TEST_F(DatabaseClonerTest, ListCollectionsReturnsEmptyCollectionName) {
stdx::placeholders::_1,
stdx::placeholders::_2),
stdx::bind(&DatabaseClonerTest::setStatus, this, stdx::placeholders::_1)));
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
{
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
@@ -492,7 +492,7 @@ TEST_F(DatabaseClonerTest, ListCollectionsReturnsEmptyCollectionName) {
}
TEST_F(DatabaseClonerTest, StartFirstCollectionClonerFailed) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
_databaseCloner->setStartCollectionClonerFn([](CollectionCloner& cloner) {
return Status(ErrorCodes::OperationFailed,
@@ -512,7 +512,7 @@ TEST_F(DatabaseClonerTest, StartFirstCollectionClonerFailed) {
}
TEST_F(DatabaseClonerTest, StartSecondCollectionClonerFailed) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
const Status errStatus{ErrorCodes::OperationFailed,
"StartSecondCollectionClonerFailed injected failure."};
@@ -520,7 +520,7 @@ TEST_F(DatabaseClonerTest, StartSecondCollectionClonerFailed) {
if (cloner.getSourceNamespace().coll() == "b") {
return errStatus;
}
- return cloner.start();
+ return cloner.startup();
});
{
@@ -538,13 +538,13 @@ TEST_F(DatabaseClonerTest, StartSecondCollectionClonerFailed) {
processNetworkResponse(createListIndexesResponse(0, BSON_ARRAY(idIndexSpec)));
processNetworkResponse(createCursorResponse(0, BSONArray()));
}
- _databaseCloner->wait();
+ _databaseCloner->join();
ASSERT_FALSE(_databaseCloner->isActive());
ASSERT_EQUALS(errStatus, getStatus());
}
TEST_F(DatabaseClonerTest, FirstCollectionListIndexesFailed) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
const std::vector<BSONObj> sourceInfos = {BSON("name"
<< "a"
@@ -574,7 +574,7 @@ TEST_F(DatabaseClonerTest, FirstCollectionListIndexesFailed) {
processNetworkResponse(createListIndexesResponse(0, BSON_ARRAY(idIndexSpec)));
processNetworkResponse(createCursorResponse(0, BSONArray()));
}
- _databaseCloner->wait();
+ _databaseCloner->join();
ASSERT_EQ(getStatus().code(), ErrorCodes::InitialSyncFailure);
ASSERT_FALSE(_databaseCloner->isActive());
@@ -594,7 +594,7 @@ TEST_F(DatabaseClonerTest, FirstCollectionListIndexesFailed) {
}
TEST_F(DatabaseClonerTest, CreateCollections) {
- ASSERT_OK(_databaseCloner->start());
+ ASSERT_OK(_databaseCloner->startup());
const std::vector<BSONObj> sourceInfos = {BSON("name"
<< "a"
@@ -635,7 +635,7 @@ TEST_F(DatabaseClonerTest, CreateCollections) {
processNetworkResponse(createCursorResponse(0, BSONArray()));
}
- _databaseCloner->wait();
+ _databaseCloner->join();
ASSERT_OK(getStatus());
ASSERT_FALSE(_databaseCloner->isActive());
diff --git a/src/mongo/db/repl/databases_cloner.cpp b/src/mongo/db/repl/databases_cloner.cpp
index c0155d8fcb7..2e78c1c0995 100644
--- a/src/mongo/db/repl/databases_cloner.cpp
+++ b/src/mongo/db/repl/databases_cloner.cpp
@@ -107,7 +107,7 @@ void DatabasesCloner::join() {
lk.unlock();
for (auto&& cloner : clonersToWaitOn) {
- cloner->wait();
+ cloner->join();
}
lk.lock();
}
@@ -131,7 +131,7 @@ void DatabasesCloner::_cancelCloners_inlock(UniqueLock& lk) {
lk.unlock();
for (auto&& cloner : clonersToCancel) {
- cloner->cancel();
+ cloner->shutdown();
}
lk.lock();
}
@@ -260,7 +260,7 @@ void DatabasesCloner::_onListDatabaseFinish(const CommandCallbackArgs& cbd) {
dbCloner->setScheduleDbWorkFn_forTest(_scheduleDbWorkFn);
}
// Start database cloner.
- startStatus = dbCloner->start();
+ startStatus = dbCloner->startup();
} catch (...) {
startStatus = exceptionToStatus();
}