From f9aabba521c1d44e276d8d15556d51691817af35 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Mon, 26 Sep 2022 21:29:05 +0000 Subject: SERVER-69983 Add busy idents to the drop pending reaper to retry dropping later --- src/mongo/db/storage/storage_engine_impl.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index a73de55a3fa..b23928455f5 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -653,12 +653,10 @@ StatusWith StorageEngineImpl::reconcileCatalogAn WriteUnitOfWork wuow(opCtx); Status status = _engine->dropIdent(opCtx->recoveryUnit(), toRemove); if (!status.isOK()) { - // This function is called during startup recovery or after rollback to stable is - // finished. At these points there should be no concurrent operations accessing these - // idents as the exclusive global lock is held. If this fails, it signifies that there's - // an operation holding an open data handle on the ident. - opCtx->getServiceContext()->getStorageEngine()->dump(); - fassert(40591, status); + // A concurrent operation, such as a checkpoint could be holding an open data handle on + // the ident. Handoff the ident drop to the ident reaper to retry later. + addDropPendingIdent( + Timestamp::min(), std::make_shared(toRemove), /*onDrop=*/nullptr); } wuow.commit(); } @@ -784,7 +782,14 @@ StatusWith StorageEngineImpl::reconcileCatalogAn if (!indexMetaData.ready && !indexMetaData.isBackgroundSecondaryBuild) { LOGV2(22256, "Dropping unfinished index", logAttrs(nss), "index"_attr = indexName); // Ensure the `ident` is dropped while we have the `indexIdent` value. - fassert(50713, _engine->dropIdent(opCtx->recoveryUnit(), indexIdent)); + Status status = _engine->dropIdent(opCtx->recoveryUnit(), indexIdent); + if (!status.isOK()) { + // A concurrent operation, such as a checkpoint could be holding an open data + // handle on the ident. Handoff the ident drop to the ident reaper to retry + // later. + addDropPendingIdent( + Timestamp::min(), std::make_shared(indexIdent), /*onDrop=*/nullptr); + } indexesToDrop.push_back(indexName.toString()); continue; } @@ -814,7 +819,13 @@ StatusWith StorageEngineImpl::reconcileCatalogAn for (auto&& temp : internalIdentsToDrop) { LOGV2(22257, "Dropping internal ident", "ident"_attr = temp); WriteUnitOfWork wuow(opCtx); - fassert(51067, _engine->dropIdent(opCtx->recoveryUnit(), temp)); + Status status = _engine->dropIdent(opCtx->recoveryUnit(), temp); + if (!status.isOK()) { + // A concurrent operation, such as a checkpoint could be holding an open data handle on + // the ident. Handoff the ident drop to the ident reaper to retry later. + addDropPendingIdent( + Timestamp::min(), std::make_shared(temp), /*onDrop=*/nullptr); + } wuow.commit(); } -- cgit v1.2.1