diff options
-rw-r--r-- | src/mongo/dbtests/oplogstarttests.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp index a7d1da383e0..3f4c725521d 100644 --- a/src/mongo/dbtests/oplogstarttests.cpp +++ b/src/mongo/dbtests/oplogstarttests.cpp @@ -31,9 +31,12 @@ #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/replication_server_status.h" #include "mongo/db/catalog/collection.h" +#include "mongo/util/fail_point_service.h" namespace OplogStartTests { + static const char* kCollscanFetchFpName = "collscanInMemorySucceed"; + class Base { public: Base() : _context(ns()) { @@ -42,10 +45,21 @@ namespace OplogStartTests { c = _context.db()->createCollection(ns()); } c->getIndexCatalog()->ensureHaveIdIndex(); + + // We want everything in the collscan to be in memory to avoid spurious fetch + // requests. + FailPointRegistry* registry = getGlobalFailPointRegistry(); + FailPoint* failPoint = registry->getFailPoint(kCollscanFetchFpName); + failPoint->setMode(FailPoint::alwaysOn); } ~Base() { client()->dropCollection(ns()); + + // Undo fail point set in ctor. + FailPointRegistry* registry = getGlobalFailPointRegistry(); + FailPoint* failPoint = registry->getFailPoint(kCollscanFetchFpName); + failPoint->setMode(FailPoint::off); } protected: |