From f05b9437fbdc53deecf55ed3c20e36af3d733953 Mon Sep 17 00:00:00 2001 From: Charlie Swanson Date: Thu, 2 Mar 2017 13:54:24 -0500 Subject: SERVER-22541 Refactor RAII locking helpers. Removes the class 'ScopedTransaction' and moves the responsibility of abandoning the snapshot onto the GlobalLock class. Also renames the AutoGetCollectionForRead class to AutoGetCollectionForReadCommand, and adds a new AutoGetCollectionForRead class. Unlike AutoGetCollectionForReadCommand, this new class will not update the namespace on the CurrentOp object, nor will it add an entry to Top. --- src/mongo/db/dbhelpers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/dbhelpers.cpp') diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index 265687697ff..ae26b591272 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -209,7 +209,7 @@ RecordId Helpers::findById(OperationContext* opCtx, } bool Helpers::getSingleton(OperationContext* opCtx, const char* ns, BSONObj& result) { - AutoGetCollectionForRead ctx(opCtx, NamespaceString(ns)); + AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns)); unique_ptr exec(InternalPlanner::collectionScan( opCtx, ns, ctx.getCollection(), PlanExecutor::YIELD_MANUAL)); PlanExecutor::ExecState state = exec->getNext(&result, NULL); @@ -228,7 +228,7 @@ bool Helpers::getSingleton(OperationContext* opCtx, const char* ns, BSONObj& res } bool Helpers::getLast(OperationContext* opCtx, const char* ns, BSONObj& result) { - AutoGetCollectionForRead autoColl(opCtx, NamespaceString(ns)); + AutoGetCollectionForReadCommand autoColl(opCtx, NamespaceString(ns)); unique_ptr exec(InternalPlanner::collectionScan(opCtx, ns, autoColl.getCollection(), @@ -319,7 +319,7 @@ long long Helpers::removeRange(OperationContext* opCtx, BSONObj max; { - AutoGetCollectionForRead ctx(opCtx, nss); + AutoGetCollectionForReadCommand ctx(opCtx, nss); Collection* collection = ctx.getCollection(); if (!collection) { warning(LogComponent::kSharding) -- cgit v1.2.1