`Packages::Maven::FindOrCreatePackageService` don't use a transaction

Problem

https://gitlab.com/gitlab-org/gitlab/-/blob/3177ec13ff15b9111aef4e7d6ee2097ef9612e0a/app/services/packages/maven/find_or_create_package_service.rb is not using a single transaction to contain all the write operations.
As such, many transactions (one per write) is created. The problem is that if one of the write operation fails, the others are not rolled back = we have non coherent data.

Solution

The #execute
function should open a transaction for all the underlying logic. Then each write will automatically join this transaction if needed.
def execute
project.transaction do
# rest of the actual code here.
end
end
project.transaction(requires_new: true)
). This is known to have ~performance issues, see #338346 (closed).