diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2023-03-16 13:35:11 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-29 16:31:50 +0000 |
commit | 3f24d5d25363a17963027526a8531202e8f3cd6e (patch) | |
tree | df16d819e279ebce6de9ea0afd6078fc631ec519 | |
parent | b2e62a90e39c2ede741c5c92e78f85d192bb9d68 (diff) | |
download | mongo-3f24d5d25363a17963027526a8531202e8f3cd6e.tar.gz |
SERVER-74895 Expect command errors in validation when querying $collStatsr5.0.16-rc0r5.0.16
(cherry picked from commit 80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5)
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 93de718940e..f7a4fe0cbf8 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -39,6 +39,7 @@ #include "mongo/db/query/internal_plans.h" #include "mongo/db/storage/record_store.h" #include "mongo/logv2/log.h" +#include "mongo/rpc/get_status_from_command_result.h" #include "mongo/util/fail_point.h" #include "mongo/util/scopeguard.h" #include "mongo/util/testing_proctor.h" @@ -112,10 +113,12 @@ void logCollStats(OperationContext* opCtx, const NamespaceString& nss) { BSONObj collStatsResult; try { // Run $collStats via aggregation. - // Any command errors will throw and be caught in the 'catch'. client.runCommand(nss.db().toString(), makeCollStatsCommand(nss.coll()), collStatsResult /* command return results */); + // Logging $collStats information is best effort. If the collection doesn't exist, for + // example, then the $collStats query will fail and the failure reason will be logged. + uassertStatusOK(getStatusFromWriteCommandReply(collStatsResult)); verifyCommandResponse(collStatsResult); LOGV2_OPTIONS(7463200, |