From 078acc6b8f55faa58ad794021b40ee47a528c035 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Wed, 2 Mar 2022 04:26:46 +0000 Subject: SERVER-63787 Add point-in-time functionality to replica set end-to-end tests --- src/mongo/db/catalog/database_impl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mongo') diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp index 16d77cf9f14..31c1937ead2 100644 --- a/src/mongo/db/catalog/database_impl.cpp +++ b/src/mongo/db/catalog/database_impl.cpp @@ -223,10 +223,9 @@ Status DatabaseImpl::init(OperationContext* const opCtx) { } } - // When in restore mode, views created on collections that weren't restored will be removed. - if (storageGlobalParams.restore) { - invariant(opCtx->lockState()->isW()); - + // When in restore mode, views created on collections that weren't restored will be removed. We + // only do this during startup when the global lock is held. + if (storageGlobalParams.restore && opCtx->lockState()->isW()) { // Refresh our copy of the catalog, since we may have modified it above. catalog = CollectionCatalog::get(opCtx); try { -- cgit v1.2.1