summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe/stages/loop_join.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2021-05-12 18:22:11 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-17 20:58:49 +0000
commitfcdc972cd6f64bfe710161fb3a0ffc4a5ca329d1 (patch)
tree74e51c4fca725ea747a941fbc00f3b3c399c1080 /src/mongo/db/exec/sbe/stages/loop_join.cpp
parente37ca4e197187847786b79fb1af810bbfc2a6e4d (diff)
downloadmongo-fcdc972cd6f64bfe710161fb3a0ffc4a5ca329d1.tar.gz
SERVER-56869 Various fixes for use-after-free bugs in SBE
Diffstat (limited to 'src/mongo/db/exec/sbe/stages/loop_join.cpp')
-rw-r--r--src/mongo/db/exec/sbe/stages/loop_join.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/db/exec/sbe/stages/loop_join.cpp b/src/mongo/db/exec/sbe/stages/loop_join.cpp
index 290d8523572..52e4ab73c9e 100644
--- a/src/mongo/db/exec/sbe/stages/loop_join.cpp
+++ b/src/mongo/db/exec/sbe/stages/loop_join.cpp
@@ -108,7 +108,7 @@ PlanState LoopJoinStage::getNext() {
auto optTimer(getOptTimer(_opCtx));
if (_outerGetNext) {
- auto state = _children[0]->getNext();
+ auto state = getNextOuterSide();
if (state != PlanState::ADVANCED) {
return trackPlanState(state);
}
@@ -137,7 +137,7 @@ PlanState LoopJoinStage::getNext() {
}
invariant(state == PlanState::IS_EOF);
- state = _children[0]->getNext();
+ state = getNextOuterSide();
if (state != PlanState::ADVANCED) {
return trackPlanState(state);
}
@@ -161,6 +161,15 @@ void LoopJoinStage::close() {
_children[0]->close();
}
+void LoopJoinStage::doSaveState() {
+ if (_isReadingLeftSide || _outerGetNext) {
+ // If we yield while reading the left side, there is no need to makeOwned() data held in
+ // the right side, since we will have to re-open it anyway.
+ const bool recursive = true;
+ _children[1]->disableSlotAccess(recursive);
+ }
+}
+
std::unique_ptr<PlanStageStats> LoopJoinStage::getStats(bool includeDebugInfo) const {
auto ret = std::make_unique<PlanStageStats>(_commonStats);