diff options
Diffstat (limited to 'src/mongo/db/commands/plan_cache_commands.cpp')
-rw-r--r-- | src/mongo/db/commands/plan_cache_commands.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 67b244d6bb3..4cd4ca26992 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -58,7 +58,7 @@ using namespace mongo; /** * Retrieves a collection's plan cache from the database. */ -static Status getPlanCache(OperationContext* txn, +static Status getPlanCache(OperationContext* opCtx, Collection* collection, const string& ns, PlanCache** planCacheOut) { @@ -110,14 +110,14 @@ PlanCacheCommand::PlanCacheCommand(const string& name, ActionType actionType) : Command(name), helpText(helpText), actionType(actionType) {} -bool PlanCacheCommand::run(OperationContext* txn, +bool PlanCacheCommand::run(OperationContext* opCtx, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); - Status status = runPlanCacheCommand(txn, nss.ns(), cmdObj, &result); + Status status = runPlanCacheCommand(opCtx, nss.ns(), cmdObj, &result); return appendCommandStatus(result, status); } @@ -152,7 +152,7 @@ Status PlanCacheCommand::checkAuthForCommand(Client* client, } // static -StatusWith<unique_ptr<CanonicalQuery>> PlanCacheCommand::canonicalize(OperationContext* txn, +StatusWith<unique_ptr<CanonicalQuery>> PlanCacheCommand::canonicalize(OperationContext* opCtx, const string& ns, const BSONObj& cmdObj) { // query - required @@ -208,8 +208,8 @@ StatusWith<unique_ptr<CanonicalQuery>> PlanCacheCommand::canonicalize(OperationC qr->setSort(sortObj); qr->setProj(projObj); qr->setCollation(collationObj); - const ExtensionsCallbackReal extensionsCallback(txn, &nss); - auto statusWithCQ = CanonicalQuery::canonicalize(txn, std::move(qr), extensionsCallback); + const ExtensionsCallbackReal extensionsCallback(opCtx, &nss); + auto statusWithCQ = CanonicalQuery::canonicalize(opCtx, std::move(qr), extensionsCallback); if (!statusWithCQ.isOK()) { return statusWithCQ.getStatus(); } @@ -222,15 +222,15 @@ PlanCacheListQueryShapes::PlanCacheListQueryShapes() "Displays all query shapes in a collection.", ActionType::planCacheRead) {} -Status PlanCacheListQueryShapes::runPlanCacheCommand(OperationContext* txn, +Status PlanCacheListQueryShapes::runPlanCacheCommand(OperationContext* opCtx, const string& ns, BSONObj& cmdObj, BSONObjBuilder* bob) { // This is a read lock. The query cache is owned by the collection. - AutoGetCollectionForRead ctx(txn, NamespaceString(ns)); + AutoGetCollectionForRead ctx(opCtx, NamespaceString(ns)); PlanCache* planCache; - Status status = getPlanCache(txn, ctx.getCollection(), ns, &planCache); + Status status = getPlanCache(opCtx, ctx.getCollection(), ns, &planCache); if (!status.isOK()) { // No collection - return results with empty shapes array. BSONArrayBuilder arrayBuilder(bob->subarrayStart("shapes")); @@ -274,24 +274,24 @@ PlanCacheClear::PlanCacheClear() "Drops one or all cached queries in a collection.", ActionType::planCacheWrite) {} -Status PlanCacheClear::runPlanCacheCommand(OperationContext* txn, +Status PlanCacheClear::runPlanCacheCommand(OperationContext* opCtx, const std::string& ns, BSONObj& cmdObj, BSONObjBuilder* bob) { // This is a read lock. The query cache is owned by the collection. - AutoGetCollectionForRead ctx(txn, NamespaceString(ns)); + AutoGetCollectionForRead ctx(opCtx, NamespaceString(ns)); PlanCache* planCache; - Status status = getPlanCache(txn, ctx.getCollection(), ns, &planCache); + Status status = getPlanCache(opCtx, ctx.getCollection(), ns, &planCache); if (!status.isOK()) { // No collection - nothing to do. Return OK status. return Status::OK(); } - return clear(txn, planCache, ns, cmdObj); + return clear(opCtx, planCache, ns, cmdObj); } // static -Status PlanCacheClear::clear(OperationContext* txn, +Status PlanCacheClear::clear(OperationContext* opCtx, PlanCache* planCache, const string& ns, const BSONObj& cmdObj) { @@ -302,7 +302,7 @@ Status PlanCacheClear::clear(OperationContext* txn, // - clear plans for single query shape when a query shape is described in the // command arguments. if (cmdObj.hasField("query")) { - auto statusWithCQ = PlanCacheCommand::canonicalize(txn, ns, cmdObj); + auto statusWithCQ = PlanCacheCommand::canonicalize(opCtx, ns, cmdObj); if (!statusWithCQ.isOK()) { return statusWithCQ.getStatus(); } @@ -351,30 +351,30 @@ PlanCacheListPlans::PlanCacheListPlans() "Displays the cached plans for a query shape.", ActionType::planCacheRead) {} -Status PlanCacheListPlans::runPlanCacheCommand(OperationContext* txn, +Status PlanCacheListPlans::runPlanCacheCommand(OperationContext* opCtx, const std::string& ns, BSONObj& cmdObj, BSONObjBuilder* bob) { - AutoGetCollectionForRead ctx(txn, NamespaceString(ns)); + AutoGetCollectionForRead ctx(opCtx, NamespaceString(ns)); PlanCache* planCache; - Status status = getPlanCache(txn, ctx.getCollection(), ns, &planCache); + Status status = getPlanCache(opCtx, ctx.getCollection(), ns, &planCache); if (!status.isOK()) { // No collection - return empty plans array. BSONArrayBuilder plansBuilder(bob->subarrayStart("plans")); plansBuilder.doneFast(); return Status::OK(); } - return list(txn, *planCache, ns, cmdObj, bob); + return list(opCtx, *planCache, ns, cmdObj, bob); } // static -Status PlanCacheListPlans::list(OperationContext* txn, +Status PlanCacheListPlans::list(OperationContext* opCtx, const PlanCache& planCache, const std::string& ns, const BSONObj& cmdObj, BSONObjBuilder* bob) { - auto statusWithCQ = canonicalize(txn, ns, cmdObj); + auto statusWithCQ = canonicalize(opCtx, ns, cmdObj); if (!statusWithCQ.isOK()) { return statusWithCQ.getStatus(); } |