summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2022-09-26 21:29:05 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-26 22:31:01 +0000
commitf9aabba521c1d44e276d8d15556d51691817af35 (patch)
treee83fbdcf5ed5a06dd21de850dac690dd2d107978
parent3e4634f54f17b661165423f344311fba520d4008 (diff)
downloadmongo-f9aabba521c1d44e276d8d15556d51691817af35.tar.gz
SERVER-69983 Add busy idents to the drop pending reaper to retry dropping later
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp27
1 files 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<StorageEngine::ReconcileResult> 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<Ident>(toRemove), /*onDrop=*/nullptr);
}
wuow.commit();
}
@@ -784,7 +782,14 @@ StatusWith<StorageEngine::ReconcileResult> 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<Ident>(indexIdent), /*onDrop=*/nullptr);
+ }
indexesToDrop.push_back(indexName.toString());
continue;
}
@@ -814,7 +819,13 @@ StatusWith<StorageEngine::ReconcileResult> 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<Ident>(temp), /*onDrop=*/nullptr);
+ }
wuow.commit();
}