summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/collection_cloner.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2018-09-13 12:07:06 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2018-09-21 10:13:20 -0400
commit71d65cbf5daaae442d7b1d28142b7b76a9b2e83b (patch)
tree908d2e58e484a37aff5ae8192025e7d5a865693c /src/mongo/db/repl/collection_cloner.cpp
parent44290425aebb3e6db398a55169c6c5864a48829c (diff)
downloadmongo-71d65cbf5daaae442d7b1d28142b7b76a9b2e83b.tar.gz
SERVER-36536 Add a server parameter to not use exhaust option for initial sync.
Diffstat (limited to 'src/mongo/db/repl/collection_cloner.cpp')
-rw-r--r--src/mongo/db/repl/collection_cloner.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp
index fac7cec4235..f8761c32c38 100644
--- a/src/mongo/db/repl/collection_cloner.cpp
+++ b/src/mongo/db/repl/collection_cloner.cpp
@@ -71,6 +71,8 @@ MONGO_EXPORT_SERVER_PARAMETER(numInitialSyncCollectionCountAttempts, int, 3);
MONGO_EXPORT_SERVER_PARAMETER(numInitialSyncListIndexesAttempts, int, 3);
// The number of attempts for the find command, which gets the data.
MONGO_EXPORT_SERVER_PARAMETER(numInitialSyncCollectionFindAttempts, int, 3);
+// Whether to use the "exhaust cursor" feature when retrieving collection data.
+MONGO_EXPORT_STARTUP_SERVER_PARAMETER(collectionClonerUsesExhaust, bool, true);
} // namespace
// Failpoint which causes initial sync to hang before establishing its cursor to clone the
@@ -554,7 +556,8 @@ void CollectionCloner::_runQuery(const executor::TaskExecutor::CallbackArgs& cal
NamespaceStringOrUUID(_sourceNss.db().toString(), *_options.uuid),
Query(),
nullptr /* fieldsToReturn */,
- QueryOption_NoCursorTimeout | QueryOption_SlaveOk,
+ QueryOption_NoCursorTimeout | QueryOption_SlaveOk |
+ (collectionClonerUsesExhaust ? QueryOption_Exhaust : 0),
_collectionClonerBatchSize);
} catch (const DBException& e) {
auto queryStatus = e.toStatus().withContext(str::stream() << "Error querying collection '"