summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 1a2e0c4652f..767bf537d1f 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -297,12 +297,10 @@ namespace mongo {
return kpBuilder.obj();
}
- static bool findShardKeyIndexPattern(OperationContext* txn,
- const string& ns,
- const BSONObj& shardKeyPattern,
- BSONObj* indexPattern ) {
-
- Client::ReadContext context(txn, ns);
+ bool findShardKeyIndexPattern( const string& ns,
+ const BSONObj& shardKeyPattern,
+ BSONObj* indexPattern ) {
+ Client::ReadContext context( ns );
Collection* collection = context.ctx().db()->getCollection( ns );
if ( !collection )
return false;
@@ -334,8 +332,7 @@ namespace mongo {
// The IndexChunk has a keyPattern that may apply to more than one index - we need to
// select the index and get the full index keyPattern here.
BSONObj indexKeyPatternDoc;
- if ( !findShardKeyIndexPattern( txn,
- ns,
+ if ( !findShardKeyIndexPattern( ns,
range.keyPattern,
&indexKeyPatternDoc ) )
{
@@ -369,7 +366,7 @@ namespace mongo {
while ( 1 ) {
// Scoping for write lock.
{
- Client::WriteContext ctx(txn, ns);
+ Client::WriteContext ctx(ns);
Collection* collection = ctx.ctx().db()->getCollection( txn, ns );
if ( !collection )
break;
@@ -479,9 +476,7 @@ namespace mongo {
// Used by migration clone step
// TODO: Cannot hook up quite yet due to _trackerLocks in shared migration code.
- // TODO: This function is not used outside of tests
- Status Helpers::getLocsInRange( OperationContext* txn,
- const KeyRange& range,
+ Status Helpers::getLocsInRange( const KeyRange& range,
long long maxChunkSizeBytes,
set<DiskLoc>* locs,
long long* numDocs,
@@ -491,7 +486,7 @@ namespace mongo {
*estChunkSizeBytes = 0;
*numDocs = 0;
- Client::ReadContext ctx(txn, ns);
+ Client::ReadContext ctx( ns );
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( !collection ) return Status( ErrorCodes::NamespaceNotFound, ns );