summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/storage_engine_init.cpp
diff options
context:
space:
mode:
authorJordi Olivares Provencio <jordi.olivares-provencio@mongodb.com>2023-01-16 14:27:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-16 15:52:08 +0000
commit85d7113ec73c259487e344a868858ceb833aeb86 (patch)
treeae2bf685f3ab53e1f799da0fc428a260bd718f4d /src/mongo/db/storage/storage_engine_init.cpp
parent708be04d957045dc94673d32be87632044141f0d (diff)
downloadmongo-85d7113ec73c259487e344a868858ceb833aeb86.tar.gz
SERVER-72072 Integrate TicketBroker with PriorityTicketHolder
Diffstat (limited to 'src/mongo/db/storage/storage_engine_init.cpp')
-rw-r--r--src/mongo/db/storage/storage_engine_init.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mongo/db/storage/storage_engine_init.cpp b/src/mongo/db/storage/storage_engine_init.cpp
index d93e307b8fc..c33cdfccf9c 100644
--- a/src/mongo/db/storage/storage_engine_init.cpp
+++ b/src/mongo/db/storage/storage_engine_init.cpp
@@ -162,14 +162,30 @@ StorageEngine::LastShutdownState initializeStorageEngine(OperationContext* opCtx
auto svcCtx = opCtx->getServiceContext();
if (feature_flags::gFeatureFlagDeprioritizeLowPriorityOperations.isEnabledAndIgnoreFCV()) {
+ std::unique_ptr<TicketHolderManager> ticketHolderManager;
+#ifdef __linux__
LOGV2_DEBUG(6902900, 1, "Using Priority Queue-based ticketing scheduler");
auto lowPriorityBypassThreshold = gLowPriorityAdmissionBypassThreshold.load();
- auto ticketHolderManager = std::make_unique<TicketHolderManager>(
+ ticketHolderManager = std::make_unique<TicketHolderManager>(
std::make_unique<PriorityTicketHolder>(
readTransactions, lowPriorityBypassThreshold, svcCtx),
std::make_unique<PriorityTicketHolder>(
writeTransactions, lowPriorityBypassThreshold, svcCtx));
+#else
+ LOGV2_DEBUG(7207201, 1, "Using semaphore-based ticketing scheduler");
+
+ // PriorityTicketHolder is implemented using an equivalent mechanism to
+ // std::atomic::wait which isn't available until C++20. We've implemented it in Linux
+ // using futex calls. As this hasn't been implemented in non-Linux platforms we fallback
+ // to the existing semaphore implementation even if the feature flag is enabled.
+ //
+ // TODO SERVER-72616: Remove the ifdefs once TicketBroker is implemented with atomic
+ // wait.
+ ticketHolderManager = std::make_unique<TicketHolderManager>(
+ std::make_unique<SemaphoreTicketHolder>(readTransactions, svcCtx),
+ std::make_unique<SemaphoreTicketHolder>(writeTransactions, svcCtx));
+#endif
TicketHolderManager::use(svcCtx, std::move(ticketHolderManager));
} else {
auto ticketHolderManager = std::make_unique<TicketHolderManager>(