diff options
Diffstat (limited to 'src/mongo/dbtests/runner_registry.cpp')
-rw-r--r-- | src/mongo/dbtests/runner_registry.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/dbtests/runner_registry.cpp b/src/mongo/dbtests/runner_registry.cpp index b7c5981a27f..a6c2b4dfac6 100644 --- a/src/mongo/dbtests/runner_registry.cpp +++ b/src/mongo/dbtests/runner_registry.cpp @@ -60,6 +60,12 @@ namespace RunnerRegistry { } } + ~RunnerRegistryBase() { + if (_ctx.get()) { + _ctx->commit(); + } + } + /** * Return a runner that is going over the collection in ns(). */ @@ -270,6 +276,7 @@ namespace RunnerRegistry { // Drop a DB that's not ours. We can't have a lock at all to do this as dropping a DB // requires a "global write lock." + _ctx->commit(); _ctx.reset(); _client.dropDatabase("somesillydb"); _ctx.reset(new Client::WriteContext(&_opCtx, ns())); @@ -286,6 +293,7 @@ namespace RunnerRegistry { registerRunner(run.get()); // Drop our DB. Once again, must give up the lock. + _ctx->commit(); _ctx.reset(); _client.dropDatabase("unittests"); _ctx.reset(new Client::WriteContext(&_opCtx, ns())); @@ -293,6 +301,8 @@ namespace RunnerRegistry { // Unregister and restore state. deregisterRunner(run.get()); run->restoreState(&_opCtx); + _ctx->commit(); + _ctx.reset(); // Runner was killed. ASSERT_EQUALS(Runner::RUNNER_DEAD, run->getNext(&obj, NULL)); |