Skip to content

Commit a013280

Browse files
pierre-turin-mongodbMongoDB Bot
authored andcommitted
SERVER-114535 Fix checkNoCollectionsInUse failure in _findOrDeleteDoc… (#45293)
GitOrigin-RevId: 51dd8e744c9538a1b6f942c9e9d3b760925352ee
1 parent 96abde2 commit a013280

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/mongo/db/repl/storage_interface_impl.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -688,21 +688,10 @@ StatusWith<std::vector<BSONObj>> _findOrDeleteDocuments(
688688
BoundInclusion boundInclusion,
689689
std::size_t limit,
690690
FindDeleteMode mode) {
691-
auto isFind = mode == FindDeleteMode::kFind;
691+
const bool isFind = mode == FindDeleteMode::kFind;
692692
auto opStr = isFind ? "StorageInterfaceImpl::find" : "StorageInterfaceImpl::delete";
693693

694-
#ifdef MONGO_CONFIG_DEBUG_BUILD
695-
// TODO SERVER-114535: If a lock-free read is active and we enter this function the operation
696-
// could force us to abandon the snapshot opened. This could cause the acquisition held above
697-
// this call to become invalid by accident. We disable the checks temporarily until a more
698-
// permanent fix is in place.
699-
boost::optional<DisableCollectionConsistencyChecks> disableChecks;
700-
if (isFind) {
701-
disableChecks.emplace(opCtx);
702-
}
703-
#endif
704-
705-
return writeConflictRetry(opCtx, opStr, nsOrUUID, [&]() -> StatusWith<std::vector<BSONObj>> {
694+
auto doFindOrDeleteDocuments = [&]() -> StatusWith<std::vector<BSONObj>> {
706695
// We need to explicitly use this in a few places to help the type inference. Use a
707696
// shorthand.
708697
using Result = StatusWith<std::vector<BSONObj>>;
@@ -878,7 +867,10 @@ StatusWith<std::vector<BSONObj>> _findOrDeleteDocuments(
878867
}
879868

880869
return Result{docs};
881-
});
870+
};
871+
872+
return isFind ? doFindOrDeleteDocuments()
873+
: writeConflictRetry(opCtx, opStr, nsOrUUID, doFindOrDeleteDocuments);
882874
}
883875

884876
StatusWith<BSONObj> _findOrDeleteById(OperationContext* opCtx,

0 commit comments

Comments
 (0)