diff options
Diffstat (limited to 'src/mongo/db/repl/rs_sync.cpp')
-rw-r--r-- | src/mongo/db/repl/rs_sync.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp index 7c49b89ad70..3c71b075bd3 100644 --- a/src/mongo/db/repl/rs_sync.cpp +++ b/src/mongo/db/repl/rs_sync.cpp @@ -257,6 +257,8 @@ namespace replset { OpTime ts = applyGTE; time_t start = time(0); + time_t now = start; + unsigned long long n = 0, lastN = 0; while( ts < minValid ) { @@ -266,6 +268,15 @@ namespace replset { if (tryPopAndWaitForMore(&ops)) { break; } + + // apply replication batch limits + now = time(0); + if (!ops.empty()) { + if (now > replBatchLimitSeconds) + break; + if (ops.getDeque().size() > replBatchLimitOperations) + break; + } } setOplogVersion(ops.getDeque().front()); @@ -274,7 +285,6 @@ namespace replset { n += ops.getDeque().size(); if ( n > lastN + 1000 ) { - time_t now = time(0); if (now - start > 10) { // simple progress metering log() << "replSet initialSyncOplogApplication applied " << n << " operations, synced to " |