diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-12-09 13:16:54 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-12-09 20:22:59 -0500 |
commit | 326d27c5fb249f9d372cb46fd8b97d725b31553a (patch) | |
tree | 065b6bc2e02a33bde3bff7983799bf4e71946db4 /src/mongo/db/commands/mr.cpp | |
parent | 5b44e4b489ef6a8eca4e48d3124665f404cc2c92 (diff) | |
download | mongo-326d27c5fb249f9d372cb46fd8b97d725b31553a.tar.gz |
SERVER-16429 Add ScopedTransaction to AutoGetCollectionForRead and Map-reduce
Diffstat (limited to 'src/mongo/db/commands/mr.cpp')
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index d2a24ae5a04..c9755ee3e38 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1341,7 +1341,7 @@ namespace mongo { const NamespaceString nss(config.ns); // Need lock and context to use it - scoped_ptr<Lock::DBRead> lock(new Lock::DBRead(txn->lockState(), nss.db())); + scoped_ptr<AutoGetDb> scopedAutoDb(new AutoGetDb(txn, nss.db(), MODE_S)); const WhereCallbackReal whereCallback(txn, nss.db()); @@ -1357,7 +1357,7 @@ namespace mongo { } std::auto_ptr<CanonicalQuery> cq(cqRaw); - Database* db = dbHolder().get(txn, nss.db()); + Database* db = scopedAutoDb->getDb(); Collection* coll = state.getCollectionOrUassert(db, config.ns); invariant(coll); @@ -1405,14 +1405,14 @@ namespace mongo { // state and yield inside the reduceAndSpillInMemoryState method, so // it only happens if necessary. exec->saveState(); - lock.reset(); + scopedAutoDb.reset(); state.reduceAndSpillInMemoryStateIfNeeded(); - lock.reset(new Lock::DBRead(txn->lockState(), nss.db())); + scopedAutoDb.reset(new AutoGetDb(txn, nss.db(), MODE_S)); exec->restoreState(txn); // Need to reload the database, in case it was dropped after we // released the lock - db = dbHolder().get(txn, nss.db()); + db = scopedAutoDb->getDb(); if (db == NULL) { // Database was deleted after we freed the lock StringBuilder sb; |