summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/count_scan.cpp
diff options
context:
space:
mode:
authorDavid Percy <david.percy@mongodb.com>2014-09-15 15:17:38 -0400
committerBenety Goh <benety@mongodb.com>2014-09-18 14:09:35 -0400
commitccacca83853931e2d03c8670c1745dfac515e119 (patch)
tree34f9166bbfe540febf0e748b49f9e448dbf51000 /src/mongo/db/exec/count_scan.cpp
parent55415503b722848d51fe45fc2de2d47cee4db952 (diff)
downloadmongo-ccacca83853931e2d03c8670c1745dfac515e119.tar.gz
SERVER-15187 Update saved OperationContext in all PlanStages
Every stage that has a field of type OperationContext* should be updating it when ::restoreState(OperationContext*) is called. Otherwise it is retaining a reference to deleted memory. This bug hasn't surfaced before because: 1. the OperationContext used to be stack allocated, so it would have the same address every time 2. mmapv1 doesn't always need to dereference the OperationContext Closes #781 Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'src/mongo/db/exec/count_scan.cpp')
-rw-r--r--src/mongo/db/exec/count_scan.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp
index daaed0fd545..4658ab9f759 100644
--- a/src/mongo/db/exec/count_scan.cpp
+++ b/src/mongo/db/exec/count_scan.cpp
@@ -155,6 +155,7 @@ namespace mongo {
}
void CountScan::restoreState(OperationContext* opCtx) {
+ _txn = opCtx;
++_commonStats.unyields;
if (_hitEnd || (NULL == _btreeCursor.get())) { return; }