summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/database_cloner.cpp
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2017-06-07 16:38:10 -0400
committerJason Chan <jason.chan@mongodb.com>2017-06-14 14:03:12 -0400
commit737f017aa7eb2b53f9f8533a2dae291691adc6e5 (patch)
treec2dd54e8fd8b7ae36ac38af26ed4ef971e6a8b8d /src/mongo/db/repl/database_cloner.cpp
parente4fa1f1ebb8a41475c6cbf6f1a1e23f4333ad57e (diff)
downloadmongo-737f017aa7eb2b53f9f8533a2dae291691adc6e5.tar.gz
SERVER-29400 Make OplogFetcher and CollectionCloner batchSize configurable
Diffstat (limited to 'src/mongo/db/repl/database_cloner.cpp')
-rw-r--r--src/mongo/db/repl/database_cloner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp
index 30e5f087a3d..0ebaf66e098 100644
--- a/src/mongo/db/repl/database_cloner.cpp
+++ b/src/mongo/db/repl/database_cloner.cpp
@@ -59,6 +59,11 @@ const char* kNameFieldName = "name";
const char* kOptionsFieldName = "options";
const char* kInfoFieldName = "info";
const char* kUUIDFieldName = "uuid";
+// 16MB max batch size / 12 byte min doc size * 10 (for good measure) = defaultBatchSize to use.
+const auto defaultBatchSize = (16 * 1024 * 1024) / 12 * 10;
+
+// The batchSize to use for the find/getMore queries called by the CollectionCloner
+MONGO_EXPORT_STARTUP_SERVER_PARAMETER(collectionClonerBatchSize, int, defaultBatchSize);
// The number of attempts for the listCollections commands.
MONGO_EXPORT_SERVER_PARAMETER(numInitialSyncListCollectionsAttempts, int, 3);
@@ -358,7 +363,8 @@ void DatabaseCloner::_listCollectionsCallback(const StatusWith<Fetcher::QueryRes
options,
stdx::bind(
&DatabaseCloner::_collectionClonerCallback, this, stdx::placeholders::_1, nss),
- _storageInterface);
+ _storageInterface,
+ collectionClonerBatchSize);
} catch (const UserException& ex) {
_finishCallback_inlock(lk, ex.toStatus());
return;