Geo: Migrating uploads to object storage should not leave behind local files

A dry run of gitlab-rake gitlab:cleanup:project_uploads on GPRD revealed 3.1M orphaned upload files.

A spot check showed that these files also exist in object storage and the object stored files are properly tracked in the uploads table.

So the 3.1M files seem to be legitimately orphaned. We will be cleaning this up on GitLab.com with the rake task (so resolving this bug is not necessary for GCP Migration.

Possible solutions

I see that there are still 3.8M attachment rows in file_registry, yet Geo::AttachmentRegistryFinder#find_migrated_local returns 0 rows. Perhaps there is bug in the scope. I think it should be returning all the rows since we have migrated nearly all uploads to object storage. If fixed, then perhaps MigratedLocalFilesCleanUpWorker will clean up the registries and their files.

Edited by Michael Kozono