summaryrefslogtreecommitdiff
path: root/src/mongo/db/index
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2017-04-05 11:35:23 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2017-04-13 16:15:20 -0400
commitcc954e9e1d88b30d1ab89ee3bbbd9db0bb15263d (patch)
tree37df000f0d37d17bc82d5d1ad5436b4911249e4b /src/mongo/db/index
parentb02b7f7bb78d4fd0bb006591769faaa216e6f8a7 (diff)
downloadmongo-cc954e9e1d88b30d1ab89ee3bbbd9db0bb15263d.tar.gz
SERVER-25694 Eliminate race in PlanExecutor cleanup.
Ensures that a collection lock is held in at least MODE_IS while deregistering a PlanExecutor from the cursor manager. Introduces new PlanExecutor::dispose() and ClientCursor::dispose() methods that must be called before destruction of those classes, and ensures they are called before destruction. These calls will thread an OperationContext all the way through to DocumentSource::dispose() for each stage in a Pipeline, which will give DocumentSourceCursor a chance to acquire locks and deregister its PlanExecutor if necessary.
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r--src/mongo/db/index/haystack_access_method.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mongo/db/index/haystack_access_method.cpp b/src/mongo/db/index/haystack_access_method.cpp
index 213c9f05baa..8d80fdc5363 100644
--- a/src/mongo/db/index/haystack_access_method.cpp
+++ b/src/mongo/db/index/haystack_access_method.cpp
@@ -110,14 +110,13 @@ void HaystackAccessMethod::searchCommand(OperationContext* opCtx,
unordered_set<RecordId, RecordId::Hasher> thisPass;
- unique_ptr<PlanExecutor> exec(
- InternalPlanner::indexScan(opCtx,
- collection,
- _descriptor,
- key,
- key,
- BoundInclusion::kIncludeBothStartAndEndKeys,
- PlanExecutor::YIELD_MANUAL));
+ auto exec = InternalPlanner::indexScan(opCtx,
+ collection,
+ _descriptor,
+ key,
+ key,
+ BoundInclusion::kIncludeBothStartAndEndKeys,
+ PlanExecutor::NO_YIELD);
PlanExecutor::ExecState state;
BSONObj obj;
RecordId loc;