summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/active_migrations_registry_test.cpp
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2018-02-26 15:50:19 -0500
committerBlake Oler <blake.oler@mongodb.com>2018-02-27 16:05:14 -0500
commitcbe3e978d9fd41b85f2f394ce6182e6579667fd1 (patch)
tree0655752d8862b0588eb6261a5d9c6a6a580e990d /src/mongo/db/s/active_migrations_registry_test.cpp
parent044b03fc7e01c3cc0df135566432837568cb78a3 (diff)
downloadmongo-cbe3e978d9fd41b85f2f394ce6182e6579667fd1.tar.gz
SERVER-33197 Implement joining behavior for movePrimary on shards
Diffstat (limited to 'src/mongo/db/s/active_migrations_registry_test.cpp')
-rw-r--r--src/mongo/db/s/active_migrations_registry_test.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/mongo/db/s/active_migrations_registry_test.cpp b/src/mongo/db/s/active_migrations_registry_test.cpp
index d336ba0362d..5450296d505 100644
--- a/src/mongo/db/s/active_migrations_registry_test.cpp
+++ b/src/mongo/db/s/active_migrations_registry_test.cpp
@@ -82,20 +82,19 @@ MoveChunkRequest createMoveChunkRequest(const NamespaceString& nss) {
return assertGet(MoveChunkRequest::createFromCommand(nss, builder.obj()));
}
-TEST_F(MoveChunkRegistration, ScopedRegisterDonateChunkMoveConstructorAndAssignment) {
- auto originalScopedRegisterDonateChunk = assertGet(_registry.registerDonateChunk(
+TEST_F(MoveChunkRegistration, ScopedDonateChunkMoveConstructorAndAssignment) {
+ auto originalScopedDonateChunk = assertGet(_registry.registerDonateChunk(
createMoveChunkRequest(NamespaceString("TestDB", "TestColl"))));
- ASSERT(originalScopedRegisterDonateChunk.mustExecute());
+ ASSERT(originalScopedDonateChunk.mustExecute());
- ScopedRegisterDonateChunk movedScopedRegisterDonateChunk(
- std::move(originalScopedRegisterDonateChunk));
- ASSERT(movedScopedRegisterDonateChunk.mustExecute());
+ ScopedDonateChunk movedScopedDonateChunk(std::move(originalScopedDonateChunk));
+ ASSERT(movedScopedDonateChunk.mustExecute());
- originalScopedRegisterDonateChunk = std::move(movedScopedRegisterDonateChunk);
- ASSERT(originalScopedRegisterDonateChunk.mustExecute());
+ originalScopedDonateChunk = std::move(movedScopedDonateChunk);
+ ASSERT(originalScopedDonateChunk.mustExecute());
// Need to signal the registered migration so the destructor doesn't invariant
- originalScopedRegisterDonateChunk.complete(Status::OK());
+ originalScopedDonateChunk.signalComplete(Status::OK());
}
TEST_F(MoveChunkRegistration, GetActiveMigrationNamespace) {
@@ -103,39 +102,39 @@ TEST_F(MoveChunkRegistration, GetActiveMigrationNamespace) {
const NamespaceString nss("TestDB", "TestColl");
- auto originalScopedRegisterDonateChunk =
+ auto originalScopedDonateChunk =
assertGet(_registry.registerDonateChunk(createMoveChunkRequest(nss)));
ASSERT_EQ(nss.ns(), _registry.getActiveDonateChunkNss()->ns());
// Need to signal the registered migration so the destructor doesn't invariant
- originalScopedRegisterDonateChunk.complete(Status::OK());
+ originalScopedDonateChunk.signalComplete(Status::OK());
}
TEST_F(MoveChunkRegistration, SecondMigrationReturnsConflictingOperationInProgress) {
- auto originalScopedRegisterDonateChunk = assertGet(_registry.registerDonateChunk(
+ auto originalScopedDonateChunk = assertGet(_registry.registerDonateChunk(
createMoveChunkRequest(NamespaceString("TestDB", "TestColl1"))));
- auto secondScopedRegisterDonateChunkStatus = _registry.registerDonateChunk(
+ auto secondScopedDonateChunkStatus = _registry.registerDonateChunk(
createMoveChunkRequest(NamespaceString("TestDB", "TestColl2")));
ASSERT_EQ(ErrorCodes::ConflictingOperationInProgress,
- secondScopedRegisterDonateChunkStatus.getStatus());
+ secondScopedDonateChunkStatus.getStatus());
- originalScopedRegisterDonateChunk.complete(Status::OK());
+ originalScopedDonateChunk.signalComplete(Status::OK());
}
TEST_F(MoveChunkRegistration, SecondMigrationWithSameArgumentsJoinsFirst) {
- auto originalScopedRegisterDonateChunk = assertGet(_registry.registerDonateChunk(
+ auto originalScopedDonateChunk = assertGet(_registry.registerDonateChunk(
createMoveChunkRequest(NamespaceString("TestDB", "TestColl"))));
- ASSERT(originalScopedRegisterDonateChunk.mustExecute());
+ ASSERT(originalScopedDonateChunk.mustExecute());
- auto secondScopedRegisterDonateChunk = assertGet(_registry.registerDonateChunk(
+ auto secondScopedDonateChunk = assertGet(_registry.registerDonateChunk(
createMoveChunkRequest(NamespaceString("TestDB", "TestColl"))));
- ASSERT(!secondScopedRegisterDonateChunk.mustExecute());
+ ASSERT(!secondScopedDonateChunk.mustExecute());
- originalScopedRegisterDonateChunk.complete({ErrorCodes::InternalError, "Test error"});
+ originalScopedDonateChunk.signalComplete({ErrorCodes::InternalError, "Test error"});
ASSERT_EQ(Status(ErrorCodes::InternalError, "Test error"),
- secondScopedRegisterDonateChunk.waitForCompletion(getTxn()));
+ secondScopedDonateChunk.waitForCompletion(getTxn()));
}
} // namespace