Fix bug when do LFS GC (#36500)#36608
Merged
silverwind merged 2 commits intogo-gitea:release/v1.25from Feb 13, 2026
Merged
Conversation
Fix go-gitea#36448 Removed unnecessary parameters from the LFS GC process and switched to an ORDER BY id ASC strategy with a last-ID cursor to avoid missing or duplicating meta object IDs. --------- Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lunny
approved these changes
Feb 13, 2026
lunny
approved these changes
Feb 13, 2026
Member
|
BTW "Fix bug when do X" is broken english but it's too late to fix now. "Fix bug during X" would be much better. |
silverwind
approved these changes
Feb 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This backport fixes an LFS GC hang/loop bug by switching LFSMetaObject iteration to a stable, cursor-based pagination strategy so rows aren’t missed/duplicated when their timestamps are updated during GC.
Changes:
- Removed unused iteration parameters and standardized LFSMetaObject iteration on
ORDER BY id ASCwith alastIDcursor. - Updated the LFS GC service to use the simplified iterator options.
- Added regression tests covering iteration while updating rows and GC autofix behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| services/repository/lfs.go | Drops the removed iterator options when invoking LFSMetaObject iteration during GC. |
| models/git/lfs.go | Reworks IterateLFSMetaObjectsForRepo to paginate by id using a lastID cursor and removes the old offset/updated-order logic. |
| services/repository/lfs_test.go | Fixes test isolation by mocking setting.LFS.StartServer and adds an autofix GC test for a single repo. |
| models/git/lfs_test.go | Adds a regression test ensuring iteration doesn’t skip when rows’ updated_unix are modified during iteration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport #36500 by @lunny
Fix #36448
Removed unnecessary parameters from the LFS GC process and switched to an ORDER BY id ASC strategy with a last-ID cursor to avoid missing or duplicating meta object IDs.