Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish LFS object errors to ignore missing objects during migration (#31702) #31745

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

GiteaBot
Copy link
Contributor

Backport #31702 by @wolfogre

Fix #31137.

Replace #31623 #31697.

When migrating LFS objects, if there's any object that failed (like some objects are losted, which is not really critical), Gitea will stop migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the LFS api doc.

LFS object error codes should match HTTP status codes where possible:

  • 404 - The object does not exist on the server.
  • 409 - The specified hash algorithm disagrees with the server's acceptable options.
  • 410 - The object was removed by the owner.
  • 422 - Validation error.

If the error is 404, it's safe to ignore it and continue migration. Otherwise, stop the migration and mark it as failed to ensure data integrity of LFS objects.

And maybe we should also ignore others errors (maybe 410? I'm not sure what's the difference between "does not exist" and "removed by the owner".), we can add it later when some users report that they have failed to migrate LFS because of an error which should be ignored.

…ion (go-gitea#31702)

Fix go-gitea#31137.

Replace go-gitea#31623 go-gitea#31697.

When migrating LFS objects, if there's any object that failed (like some
objects are losted, which is not really critical), Gitea will stop
migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the [LFS api
doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses).

> LFS object error codes should match HTTP status codes where possible:
> 
> - 404 - The object does not exist on the server.
> - 409 - The specified hash algorithm disagrees with the server's
acceptable options.
> - 410 - The object was removed by the owner.
> - 422 - Validation error.

If the error is `404`, it's safe to ignore it and continue migration.
Otherwise, stop the migration and mark it as failed to ensure data
integrity of LFS objects.

And maybe we should also ignore others errors (maybe `410`? I'm not sure
what's the difference between "does not exist" and "removed by the
owner".), we can add it later when some users report that they have
failed to migrate LFS because of an error which should be ignored.
@GiteaBot GiteaBot added modifies/go Pull requests that update Go code topic/lfs type/bug labels Jul 31, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 31, 2024
@GiteaBot GiteaBot added this to the 1.22.2 milestone Jul 31, 2024
@GiteaBot GiteaBot requested review from delvh and lunny July 31, 2024 10:29
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 31, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 31, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 31, 2024
@lunny lunny merged commit 6203ae7 into go-gitea:release/v1.22 Jul 31, 2024
26 checks passed
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/lfs type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants