summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2020-08-10 18:32:57 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-10 22:58:34 +0000
commit13eb3cca6547bb801d1cd01f95c8e9dd564dd47c (patch)
tree30cbe43742587a2569b8224b001c1c460bc3d7ff
parent5eedf66fc4ae88a0eb0bdf42cb5b8f865379c762 (diff)
downloadmongo-13eb3cca6547bb801d1cd01f95c8e9dd564dd47c.tar.gz
SERVER-50007 Extend FlowControl with shutdown support
-rw-r--r--src/mongo/db/mongod_main.cpp2
-rw-r--r--src/mongo/db/storage/flow_control.cpp8
-rw-r--r--src/mongo/db/storage/flow_control.h5
3 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp
index 52f7fd04579..36cee8e12be 100644
--- a/src/mongo/db/mongod_main.cpp
+++ b/src/mongo/db/mongod_main.cpp
@@ -1318,6 +1318,8 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
#ifndef MONGO_CONFIG_USE_RAW_LATCHES
LatchAnalyzer::get(serviceContext).dump();
#endif
+
+ FlowControl::shutdown(serviceContext);
}
} // namespace
diff --git a/src/mongo/db/storage/flow_control.cpp b/src/mongo/db/storage/flow_control.cpp
index 7ba9d202720..294dbe53488 100644
--- a/src/mongo/db/storage/flow_control.cpp
+++ b/src/mongo/db/storage/flow_control.cpp
@@ -169,6 +169,14 @@ void FlowControl::set(ServiceContext* service, std::unique_ptr<FlowControl> flow
globalFlow = std::move(flowControl);
}
+void FlowControl::shutdown(ServiceContext* service) {
+ auto& globalFlow = getFlowControl(service);
+ if (globalFlow) {
+ globalFlow->_jobAnchor.stop();
+ globalFlow.reset();
+ }
+}
+
/**
* Returns -1.0 if there are not enough samples.
*/
diff --git a/src/mongo/db/storage/flow_control.h b/src/mongo/db/storage/flow_control.h
index d45abd15bab..4a2d66a0af9 100644
--- a/src/mongo/db/storage/flow_control.h
+++ b/src/mongo/db/storage/flow_control.h
@@ -69,6 +69,11 @@ public:
static void set(ServiceContext* service, std::unique_ptr<FlowControl> flowControl);
+ /**
+ * Shuts down the flow control job and removes it from the ServiceContext.
+ */
+ static void shutdown(ServiceContext* service);
+
/*
* Typical API call.
*