Move NuGet symbol files creation outside uploading package transaction
What does this MR do and why?
When uploading a symbol NuGet package .snupkg to the NuGet Repository, we try to extract its symbol files .pdb and upload them separately. However, this process of extracting/creating the symbol files .pdb is wrapped in the same database transaction where we wrap the main logic of uploading a new package. That means if something went wrong in symbol files creation and the transaction was aborted, the whole process will be aborted.
We don't want this to happen. We want the main package publication process to succeed even if the symbol files creation failed. So in this MR, we move the symbol files creation service outside the main transaction.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
N/A
How to set up and validate locally
- Download these 2 files and put them in one new directory
- In the root of the directory, publish the packages from your terminal:
dotnet nuget push newtonsoft.json.13.0.3.nupkg --source http://gdk.test:3000/api/v4/projects/<project_id>/packages/nuget/index.json --api-key <PAT> - In rails console, mark the package we just uploaded as
pending_destruction:Packages::Nuget::Package.last.pending_destruction! - Repeat step(2.) i.e. republish the same package. It should be published successfully.
- On master, delete the 2 recently uploaded packages in console (
Packages::Nuget::Package.last(2).each(&:destroy)) and repeat the steps starting with step(2.). When you reach to step(4.), the package republication will fail with this error in the logs:PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block (ActiveRecord::StatementInvalid)
Related to #507274 (closed)