summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/cloner_test_fixture.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2020-03-27 14:50:35 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 19:19:44 +0000
commitb70908c4898c4b02d8c70df3f796fa3e8cfe5bdd (patch)
treed29354ae8cf4931f7956de2eabd5bd56219027fc /src/mongo/db/repl/cloner_test_fixture.cpp
parentdc7724efa185a1b64f95fc84d0f7794dbc2fcdae (diff)
downloadmongo-b70908c4898c4b02d8c70df3f796fa3e8cfe5bdd.tar.gz
SERVER-46085 Fail initial sync attempt if sync source is in initial sync
Diffstat (limited to 'src/mongo/db/repl/cloner_test_fixture.cpp')
-rw-r--r--src/mongo/db/repl/cloner_test_fixture.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repl/cloner_test_fixture.cpp b/src/mongo/db/repl/cloner_test_fixture.cpp
index 0a6191fc171..e588748e7cc 100644
--- a/src/mongo/db/repl/cloner_test_fixture.cpp
+++ b/src/mongo/db/repl/cloner_test_fixture.cpp
@@ -31,6 +31,7 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/repl/cloner_test_fixture.h"
+#include "mongo/db/repl/replication_consistency_markers_impl.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/repl/storage_interface_mock.h"
#include "mongo/db/service_context_test_fixture.h"
@@ -74,6 +75,11 @@ void ClonerTestFixture::setUp() {
// Required by CollectionCloner::listIndexesStage() and IndexBuildsCoordinator.
getServiceContext()->setStorageEngine(std::make_unique<StorageEngineMock>());
+
+ // Set the initial sync ID on the mock server.
+ _mockServer->insert(
+ ReplicationConsistencyMarkersImpl::kDefaultInitialSyncIdNamespace.toString(),
+ BSON("_id" << _initialSyncId));
}
void ClonerTestFixture::tearDown() {
@@ -84,5 +90,11 @@ void ClonerTestFixture::tearDown() {
unittest::Test::tearDown();
}
+void ClonerTestFixture::setInitialSyncId() {
+ stdx::lock_guard<InitialSyncSharedData> lk(*_sharedData);
+ _sharedData->setSyncSourceWireVersion(lk, WireVersion::RESUMABLE_INITIAL_SYNC);
+ _sharedData->setInitialSyncSourceId(lk, _initialSyncId);
+}
+
} // namespace repl
} // namespace mongo