Repository navigation
fix: prevent CleanOrphanUploadFiles from skipping records during offset pagination - #1642
Open
Asthenia0412 wants to merge 1 commit into
Open
Asthenia0412 wants to merge 1 commit into
Asthenia0412 wants to merge 1 commit into
Conversation
…et pagination CleanOrphanUploadFiles queried file records with offset-based pagination (page=1,2,3,...) while simultaneously deleting orphan records that dropped out of the Status=Available filter. After a batch deletes N records, the remaining result set shrinks and records that were at positions page*pageSize and above slide into earlier slots. Advancing the page counter then skips past those shifted rows, leaving eligible orphans unprocessed for a later cleanup run. Track deletions in the current batch. When any deletions occur the result set has changed, so reset page to 1 and re-scan the front of the result. When no deletions occur the Available set is stable and incrementing the page counter is safe. Closes: apache#1631 Signed-off-by: yancy <[email protected]>
Author
|
@LinkinStars @kumfo @sy-records 各位大佬好,我是 yancy (Asthenia0412),来贡献一个修复 PR。 问题issue #1631 — 修复在每批处理中跟踪
验证
麻烦帮忙 review 一下,感谢 🙏 |
LinkinStars
self-requested a review
October 14, 2026 03:14
This branch has not been deployed
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.
Summary
Fixes issue #1631
CleanOrphanUploadFilesqueries file records with offset-based pagination (page=1,2,3,...) while simultaneously deleting orphan records that drop out of theStatus = Availablefilter. After a batch deletes N records, the remaining result set shrinks and records at positionspage*pageSizeand above slide into earlier slots. Advancing the page counter then skips past those shifted rows, leaving eligible orphans unprocessed until the next cleanup run.Changes
deletedInBatchcounter during each page iterationpageto1so the next query rescans the front of the current Available setpagenormallyVerification
go build ./...— full project builds cleanlygo test ./internal/service/file_record/...— package has no test filesAuthor
Signed-off-by: yancy [email protected]
Co-authored by: Asthenia0412
Closes: #1631