From 1bb26e23c16f3f43ef477fc91cacabdf962d16f0 Mon Sep 17 00:00:00 2001 From: Josef Ahmad Date: Wed, 22 Dec 2021 11:47:44 +0000 Subject: SERVER-62210 Fix dbCheck progress meter for dropped and recreated collections --- src/mongo/db/commands/dbcheck.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp index 03317dd132e..145c792b808 100644 --- a/src/mongo/db/commands/dbcheck.cpp +++ b/src/mongo/db/commands/dbcheck.cpp @@ -299,9 +299,6 @@ protected: private: void _doCollection(OperationContext* opCtx, const DbCheckCollectionInfo& info) { - // The collection was confirmed as existing in singleCollectionRun(). - // runBatch() will handle the case of the collection having been dropped since then. - if (_done) { return; } @@ -314,6 +311,14 @@ private: stdx::unique_lock lk(*opCtx->getClient()); progress.set(CurOp::get(opCtx)->setProgress_inlock(StringData(curOpMessage), coll->numRecords(opCtx))); + } else { + const auto entry = dbCheckWarningHealthLogEntry( + info.nss, + "abandoning dbCheck batch because collection no longer exists", + OplogEntriesEnum::Batch, + Status(ErrorCodes::NamespaceNotFound, "collection not found")); + HealthLog::get(Client::getCurrent()->getServiceContext()).log(*entry); + return; } } -- cgit v1.2.1