summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2023-04-24 17:36:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-24 18:49:17 +0000
commitab76fd41a4dba99f711baa064ceb452045e3e5c6 (patch)
treeaafb2feb9d8f7d32044ed95ad7b231d439a43322 /src/mongo/util
parentdf1428dfe4fc4fa1dc7234aedce81344ebd9b609 (diff)
downloadmongo-ab76fd41a4dba99f711baa064ceb452045e3e5c6.tar.gz
SERVER-75908 Disable execution control if user manually set concurrency
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/concurrency/SConscript1
-rw-r--r--src/mongo/util/concurrency/ticketholder.cpp21
-rw-r--r--src/mongo/util/concurrency/ticketholder.h5
3 files changed, 23 insertions, 4 deletions
diff --git a/src/mongo/util/concurrency/SConscript b/src/mongo/util/concurrency/SConscript
index 3a9380483ee..acc81c451b4 100644
--- a/src/mongo/util/concurrency/SConscript
+++ b/src/mongo/util/concurrency/SConscript
@@ -33,6 +33,7 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/service_context',
+ '$BUILD_DIR/mongo/db/storage/concurrency_adjustment_parameters',
# TODO (SERVER-67104): Remove this dependency.
'$BUILD_DIR/mongo/db/storage/storage_engine_feature_flags',
'$BUILD_DIR/third_party/shim_boost',
diff --git a/src/mongo/util/concurrency/ticketholder.cpp b/src/mongo/util/concurrency/ticketholder.cpp
index e78fa1ce64e..dd527f9e177 100644
--- a/src/mongo/util/concurrency/ticketholder.cpp
+++ b/src/mongo/util/concurrency/ticketholder.cpp
@@ -29,7 +29,9 @@
#include "mongo/util/concurrency/ticketholder.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/storage/execution_control/concurrency_adjustment_parameters_gen.h"
#include "mongo/db/storage/storage_engine_feature_flags_gen.h"
+#include "mongo/db/storage/storage_engine_parameters_gen.h"
#include "mongo/util/concurrency/admission_context.h"
#include <iostream>
@@ -63,6 +65,22 @@ void updateQueueStatsOnTicketAcquisition(ServiceContext* serviceContext,
}
} // namespace
+TicketHolder::TicketHolder(int32_t numTickets, ServiceContext* svcCtx)
+ : _outof(numTickets), _serviceContext(svcCtx) {
+
+ auto concurrencyAlgorithm = StorageEngineConcurrencyAdjustmentAlgorithm_parse(
+ IDLParserContext{"storageEngineConcurrencyAdjustmentAlgorithm"},
+ gStorageEngineConcurrencyAdjustmentAlgorithm);
+
+ // (Ignore FCV check): This feature flag doesn't have upgrade/downgrade concern.
+ _usingDynamicConcurrencyAdjustment =
+ (!feature_flags::gFeatureFlagExecutionControl.isEnabledAndIgnoreFCVUnsafe() ||
+ concurrencyAlgorithm ==
+ StorageEngineConcurrencyAdjustmentAlgorithmEnum::kFixedConcurrentTransactions)
+ ? false
+ : true;
+}
+
void TicketHolder::resize(int32_t newSize) noexcept {
stdx::lock_guard<Latch> lk(_resizeMutex);
@@ -150,8 +168,7 @@ int32_t TicketHolder::getAndResetPeakUsed() {
}
void TicketHolder::_updatePeakUsed() {
- // (Ignore FCV check): This feature flag doesn't have upgrade/downgrade concern.
- if (!feature_flags::gFeatureFlagExecutionControl.isEnabledAndIgnoreFCVUnsafe()) {
+ if (!_usingDynamicConcurrencyAdjustment) {
return;
}
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h
index 6eb66bbc0b5..45a068d45ce 100644
--- a/src/mongo/util/concurrency/ticketholder.h
+++ b/src/mongo/util/concurrency/ticketholder.h
@@ -53,8 +53,8 @@ class TicketHolder {
friend class Ticket;
public:
- TicketHolder(int32_t numTickets, ServiceContext* svcCtx)
- : _outof(numTickets), _serviceContext(svcCtx){};
+ TicketHolder(int32_t numTickets, ServiceContext* svcCtx);
+
virtual ~TicketHolder(){};
/**
@@ -191,6 +191,7 @@ private:
AtomicWord<int32_t> _outof;
AtomicWord<int32_t> _peakUsed;
AtomicWord<std::int64_t> _immediatePriorityAdmissionsCount;
+ bool _usingDynamicConcurrencyAdjustment;
protected:
/**