summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/count.cpp
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-11-14 10:15:58 -0500
committerGreg Studer <greg@10gen.com>2014-11-17 15:58:56 -0500
commit002c8f028ac27701a530db139a72cbc504c94f35 (patch)
tree37e2cac930cee2e9e7bcfc5c6e904fb5b5738c78 /src/mongo/db/commands/count.cpp
parentba895ea2965bf99a14f16f2d94657417bf7c6ab1 (diff)
downloadmongo-002c8f028ac27701a530db139a72cbc504c94f35.tar.gz
SERVER-15541 preserve chunk ranges during long-running yielding count/geoNear
Diffstat (limited to 'src/mongo/db/commands/count.cpp')
-rw-r--r--src/mongo/db/commands/count.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/commands/count.cpp b/src/mongo/db/commands/count.cpp
index 8687a56c184..38df9b45286 100644
--- a/src/mongo/db/commands/count.cpp
+++ b/src/mongo/db/commands/count.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/exec/count.h"
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/explain.h"
+#include "mongo/db/range_preserver.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/util/log.h"
@@ -82,6 +83,10 @@ namespace mongo {
AutoGetCollectionForRead ctx(txn, request.ns);
Collection* collection = ctx.getCollection();
+ // Prevent chunks from being cleaned up during yields - this allows us to only check the
+ // version on initial entry into count.
+ RangePreserver preserver(collection);
+
PlanExecutor* rawExec;
Status getExecStatus = getExecutorCount(txn,
collection,
@@ -114,6 +119,10 @@ namespace mongo {
AutoGetCollectionForRead ctx(txn, request.ns);
Collection* collection = ctx.getCollection();
+ // Prevent chunks from being cleaned up during yields - this allows us to only check the
+ // version on initial entry into count.
+ RangePreserver preserver(collection);
+
PlanExecutor* rawExec;
Status getExecStatus = getExecutorCount(txn,
collection,