summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/count.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.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.cpp')
-rw-r--r--src/mongo/db/exec/count.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp
index 077ec43db73..9f76ae10d1b 100644
--- a/src/mongo/db/exec/count.cpp
+++ b/src/mongo/db/exec/count.cpp
@@ -165,6 +165,7 @@ namespace mongo {
}
void CountStage::restoreState(OperationContext* opCtx) {
+ _txn = opCtx;
++_commonStats.unyields;
if (_child.get()) {
_child->restoreState(opCtx);