Skip to content

Fix bug when do LFS GC (#36500)#36608

Merged
silverwind merged 2 commits intogo-gitea:release/v1.25from
GiteaBot:backport-36500-v1.25
Feb 13, 2026
Merged

Fix bug when do LFS GC (#36500)#36608
silverwind merged 2 commits intogo-gitea:release/v1.25from
GiteaBot:backport-36500-v1.25

Conversation

@GiteaBot
Copy link
Copy Markdown
Collaborator

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.

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>
@GiteaBot GiteaBot added modifies/go Pull requests that update Go code type/bug labels Feb 13, 2026
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 13, 2026
@GiteaBot GiteaBot added this to the 1.25.5 milestone Feb 13, 2026
@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 Feb 13, 2026
@silverwind silverwind requested a review from Copilot February 13, 2026 04:00
@silverwind
Copy link
Copy Markdown
Member

silverwind commented Feb 13, 2026

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.

@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 Feb 13, 2026
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 13, 2026
@silverwind silverwind enabled auto-merge (squash) February 13, 2026 04:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ASC with a lastID cursor.
  • 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.

@silverwind silverwind merged commit 76b7306 into go-gitea:release/v1.25 Feb 13, 2026
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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 type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants