summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/mr.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-12-09 13:16:54 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-12-09 20:22:59 -0500
commit326d27c5fb249f9d372cb46fd8b97d725b31553a (patch)
tree065b6bc2e02a33bde3bff7983799bf4e71946db4 /src/mongo/db/commands/mr.cpp
parent5b44e4b489ef6a8eca4e48d3124665f404cc2c92 (diff)
downloadmongo-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.cpp10
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;