Docs feedback: Documentation to clean up/delete references to remote uploads is missing
Link the doc and describe what is wrong with it.
Link to doc: Clean Up
Problem: Documentation to clean up/delete references to remote uploads is missing
Current documentation only covers for: Clean up project upload files if they don’t exist in GitLab database. It does not cover scenario of the remote object has been deleted permanently but still exists in GitLab database.
Background/Use Case
ZD ticket (Internal Use)
Customer faced the problem of deleting references to remote uploads that were deleted externally from AWS S3. This can be seen when running the integrity check:
Example:
gitlab-rake gitlab:uploads:check VERBOSE=1
Checking integrity of Uploads
- 100..434: Failures: 2
- Upload: 100: Remote object does not exist
- Upload: 101: Remote object does not exist
Done!
Workaround/Solution
Since there is no rake task to remove the entries in GitLab, we came up with a workaround to remove the references through Rail console:
uploads_deleted=0
Upload.find_each do |upload|
next if upload.retrieve_uploader.file.exists?
uploads_deleted=uploads_deleted + 1
p upload ### allow verification before destroy
# p upload.destroy! ### uncomment to actually destroy
end
p "#{uploads_deleted} were destroyed."
Moving Forward
Moving forward, it would be ideal to have a documentation of solving similar use case so we created an issue to address this problem.
-
Open an MR to add the workaround to Integrity check Rake Task. -
Open a feature request to add a clean up rake task to delete references to remote uploads.