diff options
author | Spencer T Brody <spencer@mongodb.com> | 2020-09-01 16:20:25 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-02 03:52:49 +0000 |
commit | 5f9a904ae5b8d1554516da08e73f1d8b1a1fc8fd (patch) | |
tree | e76092134f1f3eea832ad1a54edff15399ae8fb7 /src/mongo | |
parent | 36920786ecae139217f8ea1eed4274e77477b2d0 (diff) | |
download | mongo-5f9a904ae5b8d1554516da08e73f1d8b1a1fc8fd.tar.gz |
SERVER-50686 Rename PrimaryOnlyService::Instance::onCompletion() to getCompletionFuture()
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/commands/tenant_migration_donor_cmds.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/primary_only_service.h | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/primary_only_service_test.cpp | 16 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp index c5dd351160c..3e04399097d 100644 --- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp @@ -78,7 +78,7 @@ public: TenantMigrationDonorService::Instance::getOrCreate(donorService, donorStateDoc); uassertStatusOK(donor->checkIfOptionsConflict(donorStateDoc)); - donor->onCompletion().get(); + donor->getCompletionFuture().get(); } void doCheckAuthorization(OperationContext* opCtx) const {} diff --git a/src/mongo/db/repl/primary_only_service.h b/src/mongo/db/repl/primary_only_service.h index 6dc53082d05..f1742a2eac9 100644 --- a/src/mongo/db/repl/primary_only_service.h +++ b/src/mongo/db/repl/primary_only_service.h @@ -92,7 +92,7 @@ public: virtual ~Instance() = default; - SharedSemiFuture<void> onCompletion() { + SharedSemiFuture<void> getCompletionFuture() { return _completionPromise.getFuture(); } diff --git a/src/mongo/db/repl/primary_only_service_test.cpp b/src/mongo/db/repl/primary_only_service_test.cpp index 0340af20246..1d4242ae012 100644 --- a/src/mongo/db/repl/primary_only_service_test.cpp +++ b/src/mongo/db/repl/primary_only_service_test.cpp @@ -325,10 +325,10 @@ TEST_F(PrimaryOnlyServiceTest, BasicCreateInstance) { ASSERT_EQ(1, instance2->getID()); ASSERT_EQ(TestService::State::kInitializing, instance2->getInitialState()); - instance->onCompletion().get(); + instance->getCompletionFuture().get(); ASSERT_EQ(TestService::State::kDone, instance->getState()); - instance2->onCompletion().get(); + instance2->getCompletionFuture().get(); ASSERT_EQ(TestService::State::kDone, instance2->getState()); } @@ -344,7 +344,7 @@ TEST_F(PrimaryOnlyServiceTest, LookupInstance) { ASSERT_EQ(instance.get(), instance2.get().get()); TestServiceHangDuringCompletion.setMode(FailPoint::off); - instance->onCompletion().get(); + instance->getCompletionFuture().get(); // Shouldn't be able to look up instance after it has completed running. auto instance3 = TestService::Instance::lookup(_service, BSON("_id" << 0)); @@ -390,7 +390,7 @@ TEST_F(PrimaryOnlyServiceTest, StepDownBeforePersisted) { stepDown(); TestServiceHangDuringInitialization.setMode(FailPoint::off); - ASSERT_THROWS_CODE_AND_WHAT(instance->onCompletion().get(), + ASSERT_THROWS_CODE_AND_WHAT(instance->getCompletionFuture().get(), DBException, ErrorCodes::InterruptedDueToReplStateChange, "PrimaryOnlyService executor shut down due to stepDown"); @@ -436,7 +436,7 @@ TEST_F(PrimaryOnlyServiceTest, RecreateInstanceOnStepUp) { recreatedInstance = TestService::Instance::lookup(_service, BSON("_id" << 0)).get(); ASSERT_EQ(TestService::State::kTwo, recreatedInstance->getInitialState()); TestServiceHangDuringStateOne.setMode(FailPoint::off); - recreatedInstance->onCompletion().get(); + recreatedInstance->getCompletionFuture().get(); ASSERT_EQ(TestService::State::kDone, recreatedInstance->getState()); auto nonExistentInstance = TestService::Instance::lookup(_service, BSON("_id" << 0)); @@ -497,7 +497,7 @@ TEST_F(PrimaryOnlyServiceTest, StepDownBeforeRebuildingInstances) { TestServiceHangDuringStateOne.setMode(FailPoint::off); - instance->onCompletion().get(); + instance->getCompletionFuture().get(); } TEST_F(PrimaryOnlyServiceTest, RecreateInstancesFails) { @@ -550,7 +550,7 @@ TEST_F(PrimaryOnlyServiceTest, RecreateInstancesFails) { ASSERT_EQ(TestService::State::kOne, instance->getInitialState()); ASSERT_EQ(TestService::State::kOne, instance->getState()); TestServiceHangDuringStateOne.setMode(FailPoint::off); - instance->onCompletion().get(); + instance->getCompletionFuture().get(); ASSERT_EQ(TestService::State::kDone, instance->getState()); } @@ -564,5 +564,5 @@ TEST_F(PrimaryOnlyServiceTest, OpCtxInterruptedByStepdown) { stepDown(); TestServiceHangBeforeWritingStateDoc.setMode(FailPoint::off); - ASSERT_EQ(ErrorCodes::NotMaster, instance->onCompletion().getNoThrow()); + ASSERT_EQ(ErrorCodes::NotMaster, instance->getCompletionFuture().getNoThrow()); } |