Skip to content

Rake task `gitlab:uploads:migrate` failed to migrate some uploads

A small percentage of uploads were not migrated to object storage. Re-running the migrate tasks did not succeed for most uploads.

I was able to migrate many more uploads in Rails console, for example like so:

remaining_project_file_uploads = Upload.with_files_stored_locally.where(uploader: 'FileUploader', model_type: 'Project')
remaining_project_file_uploads.each_slice(50) do |batch|
  begin
    ObjectStorage::MigrateUploadsWorker.new.perform(batch.map(&:id), 'Project', nil, ObjectStorage::Store::REMOTE)
  rescue => e
    puts e
    puts "Continuing on..."
  end
end

And similar code worked for other uploader and model types.

So there is probably a bug in the rake task or its dependencies upstream of using MigrateUploadsWorker.