diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2022-09-02 14:25:41 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-02 16:33:20 +0000 |
commit | bf9c77c2330f0414cde0c83e83dc5e7dd38cb312 (patch) | |
tree | b98face3948a651342e974873b674b85d72f6373 /src/mongo/db/stats | |
parent | e05c628e0bb27cffcd57a796e3a328b219ab36f2 (diff) | |
download | mongo-bf9c77c2330f0414cde0c83e83dc5e7dd38cb312.tar.gz |
SERVER-67611 Remove storage usages of `ErrorCategory::Interruption`
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r-- | src/mongo/db/stats/storage_stats.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mongo/db/stats/storage_stats.cpp b/src/mongo/db/stats/storage_stats.cpp index 2be6bd5af8f..497285f940e 100644 --- a/src/mongo/db/stats/storage_stats.cpp +++ b/src/mongo/db/stats/storage_stats.cpp @@ -68,15 +68,25 @@ Status appendCollectionStorageStats(OperationContext* opCtx, const auto collNss = (isTimeseries && !nss.isTimeseriesBucketsCollection()) ? std::move(bucketNss) : nss; + auto failed = [&](const DBException& ex) { + LOGV2_DEBUG(3088801, + 2, + "Failed to retrieve storage statistics", + logAttrs(collNss), + "error"_attr = ex); + return Status::OK(); + }; + boost::optional<AutoGetCollectionForReadCommandMaybeLockFree> autoColl; try { autoColl.emplace(opCtx, collNss, AutoGetCollectionViewMode::kViewsForbidden, waitForLock ? Date_t::max() : Date_t::now()); - } catch (const ExceptionForCat<ErrorCategory::Interruption>&) { - LOGV2_DEBUG(3088801, 2, "Failed to retrieve storage statistics", logAttrs(collNss)); - return Status::OK(); + } catch (const ExceptionFor<ErrorCodes::LockTimeout>& ex) { + return failed(ex); + } catch (const ExceptionFor<ErrorCodes::MaxTimeMSExpired>& ex) { + return failed(ex); } const auto& collection = autoColl->getCollection(); // Will be set if present |