Deleting a package does not affect project statistics
Related to gitlab-org/gitlab-ee#12581 packages files are deleted by DB cascade deletion on the foreign key, so it will never run the UpdateProjectStatistics
after_destroy
callback resulting in not updating project statistics.
Proposed fix
Adding dependent: :destroy
to the Package
-PackageFile
relation should be enough to fix both this and gitlab-org/gitlab-ee#12581 because it will enable after_destroy
callbacks for both UpdateProjectStatistics
and CarrierWave
Impact
Other than the Cloud Spend implications exposed in gitlab-org/gitlab-ee#12581, not updating statistics will prevent users to do any write operation once &886 will be completed
Development log
Status
-
backend MR gitlab-org/gitlab-ee!15634
Decisions
- @nolith volunteered to fix the ongoing problem, leaving data integrity to ~"group::package"
The next iteration
- Refresh packages_size on project_statistics table gitlab-org/gitlab-ee#14029
Edited by Alessio Caiazza