summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/repltests.cpp
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2019-08-06 23:00:28 -0400
committerA. Jesse Jiryu Davis <jesse@mongodb.com>2019-08-21 11:55:02 -0400
commit609e2697c2619925073d4ac0f57f33e789d05100 (patch)
tree0c94a13d998f40b9cd16f4da272e98744d6bb98b /src/mongo/dbtests/repltests.cpp
parent08f836390d61726235e583f46012f43995695c85 (diff)
downloadmongo-609e2697c2619925073d4ac0f57f33e789d05100.tar.gz
SERVER-42022 Remove missing-document fetcher
Diffstat (limited to 'src/mongo/dbtests/repltests.cpp')
-rw-r--r--src/mongo/dbtests/repltests.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 95d016a523d..0712c4e7b88 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -1356,96 +1356,6 @@ public:
}
};
-class SyncTest : public SyncTail {
-public:
- bool returnEmpty;
- explicit SyncTest(OplogApplier::Observer* observer)
- : SyncTail(observer,
- nullptr,
- nullptr,
- SyncTail::MultiSyncApplyFunc(),
- nullptr,
- OplogApplier::Options(OplogApplication::Mode::kInitialSync)),
- returnEmpty(false) {}
- virtual ~SyncTest() {}
- BSONObj getMissingDoc(OperationContext* opCtx, const OplogEntry& oplogEntry) override {
- if (returnEmpty) {
- BSONObj o;
- return o;
- }
- return BSON("_id"
- << "on remote"
- << "foo"
- << "baz");
- }
-};
-
-class FetchAndInsertMissingDocumentObserver : public OplogApplier::Observer {
-public:
- void onBatchBegin(const OplogApplier::Operations&) final {}
- void onBatchEnd(const StatusWith<OpTime>&, const OplogApplier::Operations&) final {}
- void onMissingDocumentsFetchedAndInserted(const std::vector<FetchInfo>&) final {
- fetched = true;
- }
- bool fetched = false;
-};
-
-class FetchAndInsertMissingDocument : public Base {
-public:
- void run() {
- // Replication is not supported by mobile SE.
- if (mongo::storageGlobalParams.engine == "mobile") {
- return;
- }
- bool threw = false;
- auto oplogEntry = makeOplogEntry(OpTime(Timestamp(100, 1), 1LL), // optime
- OpTypeEnum::kUpdate, // op type
- NamespaceString(ns()), // namespace
- BSON("foo"
- << "bar"), // o
- BSON("_id"
- << "in oplog"
- << "foo"
- << "bar")); // o2
-
- Lock::GlobalWrite lk(&_opCtx);
-
- // this should fail because we can't connect
- try {
- OplogApplier::Options options(OplogApplication::Mode::kInitialSync);
- options.allowNamespaceNotFoundErrorsOnCrudOps = true;
- options.missingDocumentSourceForInitialSync = HostAndPort("localhost", 123);
- SyncTail badSource(
- nullptr, nullptr, nullptr, SyncTail::MultiSyncApplyFunc(), nullptr, options);
-
- OldClientContext ctx(&_opCtx, ns());
- badSource.getMissingDoc(&_opCtx, oplogEntry);
- } catch (DBException&) {
- threw = true;
- }
- verify(threw);
-
- // now this should succeed
- FetchAndInsertMissingDocumentObserver observer;
- SyncTest t(&observer);
- t.fetchAndInsertMissingDocument(&_opCtx, oplogEntry);
- ASSERT(observer.fetched);
- verify(!_client
- .findOne(ns(),
- BSON("_id"
- << "on remote"))
- .isEmpty());
-
- // Reset flag in observer before next test case.
- observer.fetched = false;
-
- // force it not to find an obj
- t.returnEmpty = true;
- t.fetchAndInsertMissingDocument(&_opCtx, oplogEntry);
- ASSERT_FALSE(observer.fetched);
- }
-};
-
class All : public Suite {
public:
All() : Suite("repl") {}
@@ -1503,7 +1413,6 @@ public:
add<Idempotence::ReplaySetPreexistingNoOpPull>();
add<Idempotence::ReplayArrayFieldNotAppended>();
add<DeleteOpIsIdBased>();
- add<FetchAndInsertMissingDocument>();
}
};