summaryrefslogtreecommitdiff
path: root/src/mongo
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>2022-03-29 17:02:21 +0000
commit6d429374fbe31b67ec0303151ebc5ec01159eee5 (patch)
treec445a360099f61cd0ce32d0d7eb2ff2a8bcfc44a /src/mongo
parent5157deaa6adcce380f01f4736efbdf3c473e11bf (diff)
downloadmongo-6d429374fbe31b67ec0303151ebc5ec01159eee5.tar.gz
SERVER-63271 Skip appending the watchdog section to serverStatus if watchdog is not enabled
Diffstat (limited to 'src/mongo')
-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 2c7d96075c0..07ad1c93f5e 100644
--- a/src/mongo/watchdog/watchdog_mongod.cpp
+++ b/src/mongo/watchdog/watchdog_mongod.cpp
@@ -116,9 +116,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());