From fb97757aed27a719ca48e0794f29006dec1a7dac Mon Sep 17 00:00:00 2001 From: Siyuan Zhou Date: Wed, 8 May 2019 23:24:06 -0400 Subject: Revert "SERVER-41006 Make replBatchLimitBytes configurable" This reverts commit e0726e830cca9f4971722616eeb24b56321fe4b8. --- src/mongo/db/repl/initial_syncer.cpp | 2 +- src/mongo/db/repl/oplog_applier.cpp | 2 +- src/mongo/db/repl/oplog_applier.h | 5 +++++ src/mongo/db/repl/repl_server_parameters.idl | 13 ------------- src/mongo/db/repl/sync_tail.cpp | 6 +++--- 5 files changed, 10 insertions(+), 18 deletions(-) (limited to 'src/mongo/db/repl') diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index e87bf3915c7..4733e69ea10 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -1685,7 +1685,7 @@ StatusWith InitialSyncer::_getNextApplierBatch_inlock() { // Obtain next batch of operations from OplogApplier. auto opCtx = makeOpCtx(); OplogApplier::BatchLimits batchLimits; - batchLimits.bytes = OplogApplier::calculateBatchLimitBytes(opCtx.get(), _storage); + batchLimits.bytes = OplogApplier::replBatchLimitBytes; batchLimits.ops = OplogApplier::getBatchLimitOperations(); return _oplogApplier->getNextApplierBatch(opCtx.get(), batchLimits); } diff --git a/src/mongo/db/repl/oplog_applier.cpp b/src/mongo/db/repl/oplog_applier.cpp index a44cb2ab410..7e6010aa77c 100644 --- a/src/mongo/db/repl/oplog_applier.cpp +++ b/src/mongo/db/repl/oplog_applier.cpp @@ -77,7 +77,7 @@ std::size_t OplogApplier::calculateBatchLimitBytes(OperationContext* opCtx, auto oplogMaxSizeResult = storageInterface->getOplogMaxSize(opCtx, NamespaceString::kRsOplogNamespace); auto oplogMaxSize = fassert(40301, oplogMaxSizeResult); - return std::min(oplogMaxSize / 10, std::size_t(replBatchLimitBytes.load())); + return std::min(oplogMaxSize / 10, std::size_t(replBatchLimitBytes)); } OplogApplier::OplogApplier(executor::TaskExecutor* executor, diff --git a/src/mongo/db/repl/oplog_applier.h b/src/mongo/db/repl/oplog_applier.h index 0966ec3b960..49477ac03ec 100644 --- a/src/mongo/db/repl/oplog_applier.h +++ b/src/mongo/db/repl/oplog_applier.h @@ -103,6 +103,11 @@ public: using GetNextApplierBatchFn = stdx::function( OperationContext* opCtx, const BatchLimits& batchLimits)>; + /** + * Lower bound of batch limit size (in bytes) returned by calculateBatchLimitBytes(). + */ + static const unsigned int replBatchLimitBytes = 100 * 1024 * 1024; + /** * Creates thread pool for writer tasks. */ diff --git a/src/mongo/db/repl/repl_server_parameters.idl b/src/mongo/db/repl/repl_server_parameters.idl index ba56ea21c4d..b7b2447649a 100644 --- a/src/mongo/db/repl/repl_server_parameters.idl +++ b/src/mongo/db/repl/repl_server_parameters.idl @@ -237,16 +237,3 @@ server_parameters: lte: expr: 1000 * 1000 - replBatchLimitBytes: - description: The maximum oplog application batch size in bytes - set_at: [ startup, runtime ] - cpp_vartype: AtomicWord - cpp_varname: replBatchLimitBytes - default: - expr: 100 * 1024 * 1024 - validator: - gte: - expr: 16 * 1024 * 1024 - lte: - expr: 100 * 1024 * 1024 - diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 0b93b7d373b..a3dcb97e410 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -633,16 +633,16 @@ private: Client::initThread("ReplBatcher"); BatchLimits batchLimits; + batchLimits.bytes = OplogApplier::calculateBatchLimitBytes( + cc().makeOperationContext().get(), _storageInterface); while (true) { MONGO_FAIL_POINT_PAUSE_WHILE_SET(rsSyncApplyStop); batchLimits.slaveDelayLatestTimestamp = _calculateSlaveDelayLatestTimestamp(); - // Check the limits once per batch since users can change them at runtime. + // Check this once per batch since users can change it at runtime. batchLimits.ops = OplogApplier::getBatchLimitOperations(); - batchLimits.bytes = OplogApplier::calculateBatchLimitBytes( - cc().makeOperationContext().get(), _storageInterface); OpQueue ops(batchLimits.ops); { -- cgit v1.2.1