diff options
author | Romans Kasperovics <romans.kasperovics@mongodb.com> | 2022-05-02 09:19:16 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-02 09:46:58 +0000 |
commit | 34ea442dda453616265650377d8d68404195c46f (patch) | |
tree | d21bf7c0be466bf7f797825224fa3c51898c5b5d /src/mongo/db/commands | |
parent | e9d4c080f6becd710da4a5091d226b751af10241 (diff) | |
download | mongo-34ea442dda453616265650377d8d68404195c46f.tar.gz |
SERVER-65319 Count explicit use of allowDiskUse:false
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/find_cmd.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/run_aggregate.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/commands/run_aggregate.h | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 3aabc3ddf6b..4847a7e93c4 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -559,6 +559,10 @@ public: return; } + if (!cq->getFindCommandRequest().getAllowDiskUse().value_or(true)) { + allowDiskUseFalseCounter.increment(); + } + // Check whether we are allowed to read from this node after acquiring our locks. uassertStatusOK(replCoord->checkCanServeReadsFor( opCtx, nss, ReadPreferenceSetting::get(opCtx).canRunOnSecondary())); diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp index 4a7a59f2fd1..9832ef54847 100644 --- a/src/mongo/db/commands/run_aggregate.cpp +++ b/src/mongo/db/commands/run_aggregate.cpp @@ -98,10 +98,11 @@ using std::string; using std::stringstream; using std::unique_ptr; +Counter64 allowDiskUseFalseCounter; + namespace { -Counter64 allowDiskUseCounter; -ServerStatusMetricField<Counter64> allowDiskUseMetric{"commands.aggregate.allowDiskUseTrue", - &allowDiskUseCounter}; +ServerStatusMetricField<Counter64> allowDiskUseMetric{"query.allowDiskUseFalse", + &allowDiskUseFalseCounter}; /** * If a pipeline is empty (assuming that a $cursor stage hasn't been created yet), it could mean @@ -907,8 +908,8 @@ Status runAggregate(OperationContext* opCtx, auto pipeline = Pipeline::parse(request.getPipeline(), expCtx); expCtx->stopExpressionCounters(); - if (request.getAllowDiskUse()) { - allowDiskUseCounter.increment(); + if (!request.getAllowDiskUse().value_or(true)) { + allowDiskUseFalseCounter.increment(); } // Check that the view's collation matches the collation of any views involved in the diff --git a/src/mongo/db/commands/run_aggregate.h b/src/mongo/db/commands/run_aggregate.h index bbfbf7da892..b61538fb93d 100644 --- a/src/mongo/db/commands/run_aggregate.h +++ b/src/mongo/db/commands/run_aggregate.h @@ -69,4 +69,8 @@ Status runAggregate(OperationContext* opCtx, const PrivilegeVector& privileges, rpc::ReplyBuilderInterface* result); +/** + * Tracks explicit use of allowDiskUse:false with find and aggregate commands. + */ +extern Counter64 allowDiskUseFalseCounter; } // namespace mongo |