SERVER-114536 Remove writeConflictRetry in getTagsFromStorage (#45213)

GitOrigin-RevId: 4e9dbddadb41b926de7bb5b30d95e2d5f812f97f
This commit is contained in:
Gabriel Marks 2025-12-16 10:34:49 -05:00 committed by MongoDB Bot
parent e62f34cd30
commit 627ca12e79
1 changed files with 46 additions and 66 deletions

View File

@ -529,22 +529,9 @@ std::vector<std::vector<FLEEdgeCountInfo>> getTagsFromStorage(
const NamespaceStringOrUUID& nsOrUUID,
const std::vector<std::vector<FLEEdgePrfBlock>>& escDerivedFromDataTokens,
FLETagQueryInterface::TagQueryType type) {
auto opStr = "getTagsFromStorage"_sd;
#ifdef MONGO_CONFIG_DEBUG_BUILD
// TODO SERVER-114536: If a lock-free read is active and we enter this function the operation
// could force us to abandon the snapshot opened. This could cause the acquisition held above
// this call to become invalid by accident. We disable the checks temporarily until a more
// permanent fix is in place.
DisableCollectionConsistencyChecks disableChecks{opCtx};
#endif
return writeConflictRetry(
opCtx, opStr, nsOrUUID, [&]() -> std::vector<std::vector<FLEEdgeCountInfo>> {
const auto collectionAcquisition = acquireCollectionMaybeLockFree(
opCtx,
CollectionAcquisitionRequest::fromOpCtx(
opCtx, nsOrUUID, AcquisitionPrerequisites::kRead));
CollectionAcquisitionRequest::fromOpCtx(opCtx, nsOrUUID, AcquisitionPrerequisites::kRead));
const auto& collectionPtr = collectionAcquisition.getCollectionPtr();
@ -569,8 +556,7 @@ std::vector<std::vector<FLEEdgeCountInfo>> getTagsFromStorage(
.firstElement()
.fieldNameStringData() == "_id"_sd) {
StorageEngineClusteredCollectionReader reader(
opCtx, docCount, nsOrUUID, cursor.get());
StorageEngineClusteredCollectionReader reader(opCtx, docCount, nsOrUUID, cursor.get());
return ESCCollection::getTags(reader, escDerivedFromDataTokens, type);
}
@ -597,18 +583,12 @@ std::vector<std::vector<FLEEdgeCountInfo>> getTagsFromStorage(
auto indexCatalogEntry = indexEntry->shared_from_this();
auto sdi = indexCatalogEntry->accessMethod()->asSortedData();
auto indexCursor =
sdi->newCursor(opCtx, *shard_role_details::getRecoveryUnit(opCtx), true);
auto indexCursor = sdi->newCursor(opCtx, *shard_role_details::getRecoveryUnit(opCtx), true);
StorageEngineIndexCollectionReader reader(opCtx,
docCount,
nsOrUUID,
cursor.get(),
sdi->getSortedDataInterface(),
indexCursor.get());
StorageEngineIndexCollectionReader reader(
opCtx, docCount, nsOrUUID, cursor.get(), sdi->getSortedDataInterface(), indexCursor.get());
return ESCCollection::getTags(reader, escDerivedFromDataTokens, type);
});
}
} // namespace mongo