-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Fix bug when do LFS GC #36500
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
base: main
Are you sure you want to change the base?
Fix bug when do LFS GC #36500
Conversation
96a4bee to
6bf7e47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes the LFS GC hang reported in #36448 by making LFS meta-object iteration stable and monotonic (ID-based cursor), preventing repeated batches when records are updated during iteration.
Changes:
- Simplified
IterateLFSMetaObjectsForRepoOptionsby removing unused/unsafe iteration modes. - Reworked
IterateLFSMetaObjectsForRepoto page viaORDER BY id ASC+id > lastIDcursor (no offset paging). - Added regression tests covering GC autofix and iteration behavior when rows are updated mid-iteration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| services/repository/lfs.go | Stops passing the removed iteration parameters; relies on the new ID-cursor iteration behavior. |
| models/git/lfs.go | Implements ID-based cursor pagination for LFSMetaObject iteration and removes the old ordering/offset options. |
| services/repository/lfs_test.go | Adds a repo-scoped GC autofix test (and imports modules/test for mocking). |
| models/git/lfs_test.go | Adds a regression test ensuring iteration doesn’t skip/hang when meta rows are updated during the loop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.