summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context_d_test_fixture.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-06-26 14:29:03 -0400
committerLouis Williams <louis.williams@mongodb.com>2018-07-10 15:31:33 -0400
commitca2b902002110013479af34f0ce6dee9906d9ad9 (patch)
tree1d30c86aac8ea372ee9fbf6d8d1fde02b41f2669 /src/mongo/db/service_context_d_test_fixture.cpp
parentacd9fd112d1c2f591f04a31ed6489d9f4b0ec0e8 (diff)
downloadmongo-ca2b902002110013479af34f0ce6dee9906d9ad9.tar.gz
SERVER-28734 Provide a way to recover data files when lacking WiredTiger metadata, but have _mdb_catalog data
Diffstat (limited to 'src/mongo/db/service_context_d_test_fixture.cpp')
-rw-r--r--src/mongo/db/service_context_d_test_fixture.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/service_context_d_test_fixture.cpp b/src/mongo/db/service_context_d_test_fixture.cpp
index 8f444a5a17c..5eec5cb6a24 100644
--- a/src/mongo/db/service_context_d_test_fixture.cpp
+++ b/src/mongo/db/service_context_d_test_fixture.cpp
@@ -51,11 +51,16 @@ namespace mongo {
ServiceContextMongoDTest::ServiceContextMongoDTest()
: ServiceContextMongoDTest("ephemeralForTest") {}
-ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine) {
+ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine)
+ : ServiceContextMongoDTest(engine, RepairAction::kNoRepair) {}
+
+ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine, RepairAction repair) {
_stashedStorageParams.engine = std::exchange(storageGlobalParams.engine, std::move(engine));
_stashedStorageParams.engineSetByUser =
std::exchange(storageGlobalParams.engineSetByUser, true);
+ _stashedStorageParams.repair =
+ std::exchange(storageGlobalParams.repair, (repair == RepairAction::kRepair));
auto const serviceContext = getServiceContext();
serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongod>(serviceContext));
@@ -86,6 +91,7 @@ ServiceContextMongoDTest::~ServiceContextMongoDTest() {
shutdownGlobalStorageEngineCleanly(getGlobalServiceContext());
std::swap(storageGlobalParams.engine, _stashedStorageParams.engine);
std::swap(storageGlobalParams.engineSetByUser, _stashedStorageParams.engineSetByUser);
+ std::swap(storageGlobalParams.repair, _stashedStorageParams.repair);
}
} // namespace mongo