summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-03-09 02:34:28 -0500
committerEliot Horowitz <eliot@10gen.com>2011-03-09 02:46:41 -0500
commit2bc1b84422be1053b984d05d61869781284ae486 (patch)
tree9f50a2c5bc80c757c118ee150d76985e4826d925
parentb28116bafe07a59ef030162c4da90ef4e754f8fd (diff)
downloadmongo-2bc1b84422be1053b984d05d61869781284ae486.tar.gz
more safety for getMore yielding 180
-rw-r--r--db/clientcursor.h7
-rw-r--r--db/query.cpp5
2 files changed, 11 insertions, 1 deletions
diff --git a/db/clientcursor.h b/db/clientcursor.h
index c585bb25663..f1d107fb6d9 100644
--- a/db/clientcursor.h
+++ b/db/clientcursor.h
@@ -91,6 +91,13 @@ namespace mongo {
_c = 0;
}
}
+ /**
+ * call this if during a yield, the cursor got deleted
+ * if so, we don't want to use the point address
+ */
+ void deleted() {
+ _c = 0;
+ }
~Pointer() { release(); }
Pointer(long long cursorid) {
recursive_scoped_lock lock(ccmutex);
diff --git a/db/query.cpp b/db/query.cpp
index 7d006aba910..df09fcec51c 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -382,11 +382,14 @@ namespace mongo {
c->advance();
if ( ! cc->yieldSometimes() ) {
+ ClientCursor::erase(cursorid);
+ cursorid = 0;
cc = 0;
+ p.deleted();
break;
}
}
-
+
if ( cc ) {
cc->updateLocation();
cc->mayUpgradeStorage();