diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-02-04 14:40:58 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-02-13 15:29:33 -0500 |
commit | 7286fb36c36daaa8ee4941fa5f6c225b0a25dc61 (patch) | |
tree | fcaf7e8dacc72fbae82976a8247490daa9343a98 /src/mongo/db/ops | |
parent | fccb1246e8c36cb0b79889458c8f45f637e3603f (diff) | |
download | mongo-7286fb36c36daaa8ee4941fa5f6c225b0a25dc61.tar.gz |
SERVER-17175 Use X lock for $isolated updates and deletes
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r-- | src/mongo/db/ops/parsed_delete.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/ops/parsed_delete.h | 5 | ||||
-rw-r--r-- | src/mongo/db/ops/parsed_update.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/ops/parsed_update.h | 5 |
4 files changed, 26 insertions, 8 deletions
diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp index 1eb22ebab78..64a67c50f80 100644 --- a/src/mongo/db/ops/parsed_delete.cpp +++ b/src/mongo/db/ops/parsed_delete.cpp @@ -85,10 +85,14 @@ namespace mongo { bool ParsedDelete::canYield() const { return !_request->isGod() && - PlanExecutor::YIELD_AUTO == _request->getYieldPolicy() && ( - _canonicalQuery.get() ? - !QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) : - !LiteParsedQuery::isQueryIsolated(_request->getQuery())); + PlanExecutor::YIELD_AUTO == _request->getYieldPolicy() && + !isIsolated(); + } + + bool ParsedDelete::isIsolated() const { + return _canonicalQuery.get() + ? QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) + : LiteParsedQuery::isQueryIsolated(_request->getQuery()); } bool ParsedDelete::hasParsedQuery() const { diff --git a/src/mongo/db/ops/parsed_delete.h b/src/mongo/db/ops/parsed_delete.h index c117db28cb7..cb189bfccc8 100644 --- a/src/mongo/db/ops/parsed_delete.h +++ b/src/mongo/db/ops/parsed_delete.h @@ -84,6 +84,11 @@ namespace mongo { bool canYield() const; /** + * Is this update supposed to be isolated? + */ + bool isIsolated() const; + + /** * As an optimization, we don't create a canonical query for updates with simple _id * queries. Use this method to determine whether or not we actually parsed the query. */ diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp index 8570ee212d8..d6a26fdaed2 100644 --- a/src/mongo/db/ops/parsed_update.cpp +++ b/src/mongo/db/ops/parsed_update.cpp @@ -107,10 +107,14 @@ namespace mongo { bool ParsedUpdate::canYield() const { return !_request->isGod() && - PlanExecutor::YIELD_AUTO == _request->getYieldPolicy() && ( - _canonicalQuery.get() ? - !QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) : - !LiteParsedQuery::isQueryIsolated(_request->getQuery())); + PlanExecutor::YIELD_AUTO == _request->getYieldPolicy() && + !isIsolated(); + } + + bool ParsedUpdate::isIsolated() const { + return _canonicalQuery.get() + ? QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) + : LiteParsedQuery::isQueryIsolated(_request->getQuery()); } bool ParsedUpdate::hasParsedQuery() const { diff --git a/src/mongo/db/ops/parsed_update.h b/src/mongo/db/ops/parsed_update.h index f93a264b3b8..5a7854f93fa 100644 --- a/src/mongo/db/ops/parsed_update.h +++ b/src/mongo/db/ops/parsed_update.h @@ -89,6 +89,11 @@ namespace mongo { bool canYield() const; /** + * Is this update supposed to be isolated? + */ + bool isIsolated() const; + + /** * As an optimization, we don't create a canonical query for updates with simple _id * queries. Use this method to determine whether or not we actually parsed the query. */ |