diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-04-27 14:30:39 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-04-27 17:18:55 -0400 |
commit | 835526400293597afaae23d39781278cc4684a09 (patch) | |
tree | 6745b9130679f317b359c849f51adc5266b0d52c /src/mongo | |
parent | c7f55cf871a8fabab1506e02bd573febd42bd946 (diff) | |
download | mongo-835526400293597afaae23d39781278cc4684a09.tar.gz |
SERVER-23496 changes to ServiceContextDTestFixture::_dropAllDBs
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/service_context_d_test_fixture.cpp | 16 | ||||
-rw-r--r-- | src/mongo/db/service_context_d_test_fixture.h | 9 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/mongo/db/service_context_d_test_fixture.cpp b/src/mongo/db/service_context_d_test_fixture.cpp index a588a708ca5..396c74778f4 100644 --- a/src/mongo/db/service_context_d_test_fixture.cpp +++ b/src/mongo/db/service_context_d_test_fixture.cpp @@ -59,23 +59,23 @@ void ServiceContextMongoDTest::setUp() { } void ServiceContextMongoDTest::tearDown() { - _dropAllDBs(); + auto txn = cc().makeOperationContext(); + _dropAllDBs(txn.get()); } -void ServiceContextMongoDTest::_dropAllDBs() { - const auto txn = cc().makeOperationContext(); - dropAllDatabasesExceptLocal(txn.get()); +void ServiceContextMongoDTest::_dropAllDBs(OperationContext* txn) { + dropAllDatabasesExceptLocal(txn); - ScopedTransaction transaction(txn.get(), MODE_X); + ScopedTransaction transaction(txn, MODE_X); Lock::GlobalWrite lk(txn->lockState()); - AutoGetDb autoDBLocal(txn.get(), "local", MODE_X); + AutoGetDb autoDBLocal(txn, "local", MODE_X); const auto localDB = autoDBLocal.getDb(); if (localDB) { MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { // Do not wrap in a WriteUnitOfWork until SERVER-17103 is addressed. - autoDBLocal.getDb()->dropDatabase(txn.get(), localDB); + autoDBLocal.getDb()->dropDatabase(txn, localDB); } - MONGO_WRITE_CONFLICT_RETRY_LOOP_END(txn.get(), "_dropAllDBs", "local"); + MONGO_WRITE_CONFLICT_RETRY_LOOP_END(txn, "_dropAllDBs", "local"); } } diff --git a/src/mongo/db/service_context_d_test_fixture.h b/src/mongo/db/service_context_d_test_fixture.h index 065b7f254f1..2cfb6f1cb89 100644 --- a/src/mongo/db/service_context_d_test_fixture.h +++ b/src/mongo/db/service_context_d_test_fixture.h @@ -32,6 +32,8 @@ namespace mongo { +class OperationContext; + /** * Test fixture class for tests that use either the "ephemeralForTest" or "devnull" storage engines. */ @@ -43,14 +45,15 @@ protected: void setUp() override; /** - * Clear all databases + * Clear all databases. */ void tearDown() override; /** - * Drops all databases. + * Drops all databases. Call this before global ReplicationCoordinator is destroyed -- it is + * used to drop the databases. */ - void _dropAllDBs(); + void _dropAllDBs(OperationContext* txn); }; } // namespace mongo |