summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_applier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/oplog_applier.cpp')
-rw-r--r--src/mongo/db/repl/oplog_applier.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/repl/oplog_applier.cpp b/src/mongo/db/repl/oplog_applier.cpp
index 35b888194d9..51d3134d565 100644
--- a/src/mongo/db/repl/oplog_applier.cpp
+++ b/src/mongo/db/repl/oplog_applier.cpp
@@ -139,6 +139,13 @@ const OplogApplier::Options& OplogApplier::getOptions() const {
std::unique_ptr<ThreadPool> makeReplWriterPool() {
// Reduce content pinned in cache by single oplog batch on small machines by reducing the number
// of threads of ReplWriter to reduce the number of concurrent open WT transactions.
+ if (replWriterThreadCount < replWriterMinThreadCount) {
+ LOGV2_FATAL_NOTRACE(
+ 5605400,
+ "replWriterMinThreadCount must be less than or equal to replWriterThreadCount",
+ "replWriterMinThreadCount"_attr = replWriterMinThreadCount,
+ "replWriterThreadCount"_attr = replWriterThreadCount);
+ }
auto numberOfThreads =
std::min(replWriterThreadCount, 2 * static_cast<int>(ProcessInfo::getNumAvailableCores()));
return makeReplWriterPool(numberOfThreads);
@@ -154,7 +161,9 @@ std::unique_ptr<ThreadPool> makeReplWriterPool(int threadCount,
ThreadPool::Options options;
options.threadNamePrefix = name + "-";
options.poolName = name + "ThreadPool";
- options.maxThreads = options.minThreads = static_cast<size_t>(threadCount);
+ options.minThreads =
+ replWriterMinThreadCount < threadCount ? replWriterMinThreadCount : threadCount;
+ options.maxThreads = static_cast<size_t>(threadCount);
options.onCreateThread = [isKillableByStepdown](const std::string&) {
Client::initThread(getThreadName());
auto client = Client::getCurrent();