Geo: FileRemovalService leaves orphaned LFS entries around
On GPRD, I noticed there are about 2145 file_registry
LFS entries leftover, while there are only 222 entries in the lfs_objects
table:
objects = LfsObject.where('file_store = 1 OR file_store is NULL'); objects.count
=> 222
Geo::FileRegistry.where(file_type: 'lfs').count
=> 2145
If I sample a random objects, I think it has been deleted in the lfs_objects
table:
irb(main):051:0> Geo::FileRegistry.where(file_type: 'lfs').sample
=> #<Geo::FileRegistry id: 8482346, file_type: "lfs", file_id: 3588777, bytes: 35248, sha256: nil, created_at: "2018-03-02 05:20:19", success: true, retry_count: nil, retry_at: nil, missing_on_primary: false>
irb(main):052:0> LfsObject.find(3588777)
ActiveRecord::RecordNotFound: Couldn't find LfsObject with 'id'=3588777
/cc: @toon