summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorCraig Harris <craig.harris@10gen.com>2014-06-25 17:06:03 -0400
committerCraigHarris <craig.harris@10gen.com>2014-07-08 10:53:53 -0400
commit0450a0f25d4509f6515e939a5ef3a671f744cc2a (patch)
treebd5004de51df5ebe4923a6af0863ab5c4b10f8fc /src/mongo/db/commands
parentb1048dc6f42e184c08853fe98c21a90ecfb40d6b (diff)
downloadmongo-0450a0f25d4509f6515e939a5ef3a671f744cc2a.tar.gz
SERVER-14387 Propogate OperationContext through calls requiring document read locks, without doing the locking.
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp7
-rw-r--r--src/mongo/db/commands/count.cpp9
-rw-r--r--src/mongo/db/commands/count.h3
-rw-r--r--src/mongo/db/commands/dbhash.cpp8
-rw-r--r--src/mongo/db/commands/distinct.cpp4
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp4
-rw-r--r--src/mongo/db/commands/geonear.cpp4
-rw-r--r--src/mongo/db/commands/group.cpp4
-rw-r--r--src/mongo/db/commands/list_collections.cpp4
-rw-r--r--src/mongo/db/commands/mr.cpp4
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp2
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp5
-rw-r--r--src/mongo/db/commands/rename_collection.cpp6
-rw-r--r--src/mongo/db/commands/test_commands.cpp5
14 files changed, 38 insertions, 31 deletions
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index e7859976de0..d2dbf60e565 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -1,7 +1,7 @@
// collection_to_capped.cpp
/**
-* Copyright (C) 2013 10gen Inc.
+* Copyright (C) 2013-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -81,9 +81,10 @@ namespace mongo {
// datasize and extentSize can't be compared exactly, so add some padding to 'size'
long long excessSize =
static_cast<long long>( fromCollection->dataSize() -
- ( toCollection->getRecordStore()->storageSize() * 2 ) );
+ ( toCollection->getRecordStore()->storageSize( txn ) * 2 ) );
- scoped_ptr<Runner> runner( InternalPlanner::collectionScan(fromNs,
+ scoped_ptr<Runner> runner( InternalPlanner::collectionScan(txn,
+ fromNs,
fromCollection,
InternalPlanner::FORWARD ) );
diff --git a/src/mongo/db/commands/count.cpp b/src/mongo/db/commands/count.cpp
index aa43882ea78..9c901e71025 100644
--- a/src/mongo/db/commands/count.cpp
+++ b/src/mongo/db/commands/count.cpp
@@ -98,7 +98,7 @@ namespace mongo {
limit = -limit;
}
- uassertStatusOK(getRunnerCount(collection, query, hintObj, &rawRunner));
+ uassertStatusOK(getRunnerCount(txn, collection, query, hintObj, &rawRunner));
auto_ptr<Runner> runner(rawRunner);
// Store the plan summary string in CurOp.
@@ -177,7 +177,7 @@ namespace mongo {
// Get an executor for the command and use it to generate the explain output.
CanonicalQuery* rawCq;
PlanExecutor* rawExec;
- Status execStatus = parseCountToExecutor(cmdObj, dbname, ns, collection,
+ Status execStatus = parseCountToExecutor(txn, cmdObj, dbname, ns, collection,
&rawCq, &rawExec);
if (!execStatus.isOK()) {
return execStatus;
@@ -189,7 +189,8 @@ namespace mongo {
return Explain::explainStages(exec.get(), cq.get(), verbosity, out);
}
- Status CmdCount::parseCountToExecutor(const BSONObj& cmdObj,
+ Status CmdCount::parseCountToExecutor(OperationContext* txn,
+ const BSONObj& cmdObj,
const std::string& dbname,
const std::string& ns,
Collection* collection,
@@ -229,7 +230,7 @@ namespace mongo {
auto_ptr<CanonicalQuery> autoCq(cq);
- Status execStat = getExecutor(collection, cq, execOut,
+ Status execStat = getExecutor(txn, collection, cq, execOut,
QueryPlannerParams::PRIVATE_IS_COUNT);
if (!execStat.isOK()) {
return execStat;
diff --git a/src/mongo/db/commands/count.h b/src/mongo/db/commands/count.h
index eeaaac204f1..f6dcc19c535 100644
--- a/src/mongo/db/commands/count.h
+++ b/src/mongo/db/commands/count.h
@@ -98,7 +98,8 @@ namespace mongo {
* TODO: the regular run() command for count should call this instead of getting
* a runner.
*/
- Status parseCountToExecutor(const BSONObj& cmdObj,
+ Status parseCountToExecutor(OperationContext* txn,
+ const BSONObj& cmdObj,
const std::string& dbname,
const std::string& ns,
Collection* collection,
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 9b4a2a385aa..47405dd9888 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -1,7 +1,7 @@
// dbhash.cpp
/**
-* Copyright (C) 2013 10gen Inc.
+* Copyright (C) 2013-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -84,7 +84,8 @@ namespace mongo {
auto_ptr<Runner> runner;
if ( desc ) {
- runner.reset(InternalPlanner::indexScan(collection,
+ runner.reset(InternalPlanner::indexScan(opCtx,
+ collection,
desc,
BSONObj(),
BSONObj(),
@@ -93,7 +94,8 @@ namespace mongo {
InternalPlanner::IXSCAN_FETCH));
}
else if ( collection->isCapped() ) {
- runner.reset(InternalPlanner::collectionScan(fullCollectionName,
+ runner.reset(InternalPlanner::collectionScan(opCtx,
+ fullCollectionName,
collection));
}
else {
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index 9e35ef3b0c7..ce582933d7a 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -1,7 +1,7 @@
// distinct.cpp
/**
-* Copyright (C) 2012 10gen Inc.
+* Copyright (C) 2012-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -115,7 +115,7 @@ namespace mongo {
}
Runner* rawRunner;
- Status status = getRunnerDistinct(collection, query, key, &rawRunner);
+ Status status = getRunnerDistinct(txn, collection, query, key, &rawRunner);
if (!status.isOK()) {
uasserted(17216, mongoutils::str::stream() << "Can't get runner for query "
<< query << ": " << status.toString());
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index 125826760a0..f242327f935 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -1,7 +1,7 @@
// find_and_modify.cpp
/**
-* Copyright (C) 2012 10gen Inc.
+* Copyright (C) 2012-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -153,7 +153,7 @@ namespace mongo {
Runner* rawRunner;
massert(17384, "Could not get runner for query " + queryOriginal.toString(),
- getRunner(collection, cq, &rawRunner, QueryPlannerParams::DEFAULT).isOK());
+ getRunner(txn, collection, cq, &rawRunner, QueryPlannerParams::DEFAULT).isOK());
auto_ptr<Runner> runner(rawRunner);
diff --git a/src/mongo/db/commands/geonear.cpp b/src/mongo/db/commands/geonear.cpp
index bbcc5ab19f5..f994004e2b2 100644
--- a/src/mongo/db/commands/geonear.cpp
+++ b/src/mongo/db/commands/geonear.cpp
@@ -1,5 +1,5 @@
/**
-* Copyright (C) 2012 10gen Inc.
+* Copyright (C) 2012-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -187,7 +187,7 @@ namespace mongo {
}
Runner* rawRunner;
- if (!getRunner(collection, cq, &rawRunner, 0).isOK()) {
+ if (!getRunner(txn, collection, cq, &rawRunner, 0).isOK()) {
errmsg = "can't get query runner";
return false;
}
diff --git a/src/mongo/db/commands/group.cpp b/src/mongo/db/commands/group.cpp
index b65f4f85fcd..519a5989dd1 100644
--- a/src/mongo/db/commands/group.cpp
+++ b/src/mongo/db/commands/group.cpp
@@ -1,7 +1,7 @@
// group.cpp
/**
-* Copyright (C) 2012 10gen Inc.
+* Copyright (C) 2012-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -147,7 +147,7 @@ namespace mongo {
}
Runner* rawRunner;
- if (!getRunner(collection, cq, &rawRunner).isOK()) {
+ if (!getRunner(txn,collection, cq, &rawRunner).isOK()) {
uasserted(17213, "Can't get runner for query " + query.toString());
return 0;
}
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index 46667c1a319..f7c32549627 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -1,7 +1,7 @@
// list_collections.cpp
/**
-* Copyright (C) 2014 10gen Inc.
+* Copyright (C) 2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -83,7 +83,7 @@ namespace mongo {
b.append( "name", nsToCollectionSubstring( ns ) );
CollectionOptions options =
- dbEntry->getCollectionCatalogEntry( txn, ns )->getCollectionOptions();
+ dbEntry->getCollectionCatalogEntry( txn, ns )->getCollectionOptions(txn);
b.append( "options", options.toBSON() );
arr.append( b.obj() );
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index a55597b58b2..b319dbd9e8a 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -981,7 +981,7 @@ namespace mongo {
whereCallback).isOK());
Runner* rawRunner;
- verify(getRunner(ctx->ctx().db()->getCollection(_txn, _config.incLong),
+ verify(getRunner(_txn, ctx->ctx().db()->getCollection(_txn, _config.incLong),
cq, &rawRunner, QueryPlannerParams::NO_TABLE_SCAN).isOK());
auto_ptr<Runner> runner(rawRunner);
@@ -1324,7 +1324,7 @@ namespace mongo {
}
Runner* rawRunner;
- if (!getRunner(ctx->db()->getCollection(txn, config.ns), cq, &rawRunner).isOK()) {
+ if (!getRunner(txn, ctx->db()->getCollection(txn, config.ns), cq, &rawRunner).isOK()) {
uasserted(17239, "Can't get runner for query " + config.filter.toString());
return 0;
}
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 4f41daa71f1..c10cf053534 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -185,7 +185,7 @@ namespace mongo {
"numCursors has to be between 1 and 10000" <<
" was: " << numCursors ) );
- OwnedPointerVector<RecordIterator> iterators(collection->getManyIterators());
+ OwnedPointerVector<RecordIterator> iterators(collection->getManyIterators(txn));
if (iterators.size() < numCursors) {
numCursors = iterators.size();
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 6e5232d4c12..5033dd05da7 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2011 10gen Inc.
+ * Copyright (c) 2011-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -324,7 +324,8 @@ namespace {
// This does mongod-specific stuff like creating the input Runner and adding to the
// front of the pipeline if needed.
- boost::shared_ptr<Runner> input = PipelineD::prepareCursorSource(collection,
+ boost::shared_ptr<Runner> input = PipelineD::prepareCursorSource(txn,
+ collection,
pPipeline,
pCtx);
pPipeline->stitch();
diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp
index a878e8222f1..904041aa648 100644
--- a/src/mongo/db/commands/rename_collection.cpp
+++ b/src/mongo/db/commands/rename_collection.cpp
@@ -1,7 +1,7 @@
// rename_collection.cpp
/**
-* Copyright (C) 2013 10gen Inc.
+* Copyright (C) 2013-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -181,7 +181,7 @@ namespace mongo {
indexesInProg = stopIndexBuilds( txn, srcCtx.db(), cmdObj );
capped = sourceColl->isCapped();
if ( capped ) {
- size = sourceColl->getRecordStore()->storageSize();
+ size = sourceColl->getRecordStore()->storageSize( txn );
}
}
}
@@ -252,7 +252,7 @@ namespace mongo {
{
Client::Context srcCtx(txn, source);
sourceColl = srcCtx.db()->getCollection( txn, source );
- sourceIt.reset( sourceColl->getIterator( DiskLoc(), false, CollectionScanParams::FORWARD ) );
+ sourceIt.reset( sourceColl->getIterator( txn, DiskLoc(), false, CollectionScanParams::FORWARD ) );
}
Collection* targetColl = NULL;
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 8f7e91d04f0..9036445a88b 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -1,7 +1,7 @@
// test_commands.cpp
/**
-* Copyright (C) 2013 10gen Inc.
+* Copyright (C) 2013-2014 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
@@ -150,7 +150,8 @@ namespace mongo {
Collection* collection = ctx.ctx().db()->getCollection( txn, nss.ns() );
massert( 13417, "captrunc collection not found or empty", collection);
- boost::scoped_ptr<Runner> runner(InternalPlanner::collectionScan(nss.ns(),
+ boost::scoped_ptr<Runner> runner(InternalPlanner::collectionScan(txn,
+ nss.ns(),
collection,
InternalPlanner::BACKWARD));
DiskLoc end;