summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2022-03-29 14:43:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-18 19:36:25 +0000
commita317c9b75dbd84687acc53af4f4c3c5afa6dcc7e (patch)
tree75cef8d1424ea4ac35e9284e77b471b011c5d63a
parent7abe05fdceb8bca948a45352c85189e60fe44e6f (diff)
downloadmongo-a317c9b75dbd84687acc53af4f4c3c5afa6dcc7e.tar.gz
SERVER-63271 Skip appending the watchdog section to serverStatus if watchdog is not enabled
(cherry picked from commit 6d429374fbe31b67ec0303151ebc5ec01159eee5) (cherry picked from commit 80187a3dd27d3ee77f9f73f2afa51c1c5728d9d5)
-rw-r--r--src/mongo/watchdog/watchdog_mongod.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/watchdog/watchdog_mongod.cpp b/src/mongo/watchdog/watchdog_mongod.cpp
index 77c87b087b5..793d173e41b 100644
--- a/src/mongo/watchdog/watchdog_mongod.cpp
+++ b/src/mongo/watchdog/watchdog_mongod.cpp
@@ -117,9 +117,13 @@ public:
}
BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const {
- BSONObjBuilder result;
+ if (!watchdogEnabled) {
+ return BSONObj();
+ }
+ BSONObjBuilder result;
WatchdogMonitor* watchdog = getWatchdogMonitor(opCtx->getServiceContext()).get();
+ invariant(watchdog);
result.append("checkGeneration", watchdog->getCheckGeneration());
result.append("monitorGeneration", watchdog->getMonitorGeneration());