Deleted User records leave behind orphaned Upload records (avatar uploads)
Summary
When User records are deleted, their associated Upload records (typically avatar uploads) are not always cleaned up. This leaves orphaned uploads in the database that fail Geo verification with:
Skipping transfer due to validation error: The model which owns this upload is missing. upload ID#?, User ID#?
Impact
- No user-facing impact — the users have been deleted.
- Causes noise in Geo replication failure metrics on GitLab Dedicated (currently 18 orphaned records across tenants).
- Similar issues have been filed and fixed for other model types:
Vulnerabilities::Remediation(#497516 (closed)),DesignManagement::Action(#497517),ImportExportUpload(#554288 (closed)).
Expected behaviour
Deleting a User should also destroy all associated Upload records.
Workaround
On the primary Rails console, run the documented delete_orphaned_uploads method:
https://docs.gitlab.com/administration/geo/replication/troubleshooting/synchronization_verification/#failed-verification-of-uploads-on-the-primary-geo-site
References
- Dedicated tracking: https://gitlab.com/groups/gitlab-com/gl-infra/gitlab-dedicated/-/work_items/991
Edited by 🤖 GitLab Bot 🤖