Skip to content

Fix pull lfs files issue

MAO Chao requested to merge gitlab-jh/jh-team/gitlab:fix-pull-lfs-files into master

What does this MR do and why?

related #422486 (closed)

This mr do two things:

make project import state status correct

previously LFS update error did not fail project import state, which show correct mirror information in project homepage, which will confuse user. The reason is as below code shows, error was comment and ignored. And funny thing is, the comment tell us should uncomment code to raise error if #61834 closed, however error is still ignored even issue was closed, not sure we forgot it or keep the comment intended. Even we keep the uncomment and ignore the error, I still think we should remove the comment and raise error when LFS update failed because user needs to know the correct import status of the project.

      if result[:status] == :error
        log_error(result[:message])
        # Uncomment once https://gitlab.com/gitlab-org/gitlab-foss/issues/61834 is closed
        # raise UpdateError, result[:message]
      end

Do not skip update LFS file even repo not changed

Let's say there was network issue in last update mirror, so some LFS files were not downloaded in repo, which cause user pull/clone crash. So project maintainer may decide to trigger update mirror manually to retry the LFS file download. However update LFS file was skipped because existing logic found repo.checksum not changed.

      # Updating LFS objects is expensive since it requires scanning for blobs with pointers.
      # Let's skip this if the repository hasn't changed.
      update_lfs_objects if project.repository.checksum != checksum_before

I do understand we need faster update mirror, but in this case we do need update lfs file to retry the download. On the other hand, method update_lfs_object is not so expensive if all LFS file are downloaded already, because it will find out all missing_lfs_files first then try to download the missing one. So update_lfs_objects will skip download if all LFS files are downloaded already.

Merge request reports