Repository navigation
fix: release failed staging upload batches for retry - #1854
Draft
perfloop-agent wants to merge 1 commit into
Draft
perfloop-agent wants to merge 1 commit into
perfloop-agent wants to merge 1 commit into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai> Signed-off-by: Tomás Senart <ts@perfloop.ai>
Comment on lines
+1258
to
+1259
| for path in parquet_paths { | ||
| ACTIVE_OBJECT_STORE_SYNC_FILES.remove(path); |
There was a problem hiding this comment.
Retries inflate storage totals
When one file uploads successfully but a sibling fails, update_storage_metrics has already counted the successful file. Releasing every claim here leaves that file staged and eligible for retry. The next attempt uploads and counts it again, even though it overwrites the same remote file. Releasing claims after snapshot failures causes the same problem.
Repeated failures inflate stored-byte totals and the parquet counts sent to BillingMetricsCollector. Keep retries, but make these increments happen once per staged file.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/storage/object_storage.rs
Line: 1258-1259
Comment:
**Retries inflate storage totals**
When one file uploads successfully but a sibling fails, `update_storage_metrics` has already counted the successful file. Releasing every claim here leaves that file staged and eligible for retry. The next attempt uploads and counts it again, even though it overwrites the same remote file. Releasing claims after snapshot failures causes the same problem.
Repeated failures inflate stored-byte totals and the parquet counts sent to `BillingMetricsCollector`. Keep retries, but make these increments happen once per staged file.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
perfloop-agent
marked this pull request as draft
November 11, 2026 08:27
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.
Fixes #1853.
Description
The active-upload claims introduced in #1633 can leave healthy staged files ineligible for later uploads when a sibling fails. Repeated failures can prevent the cleanup sweep that would eventually release those claims.
Keep the selected batch paths until every upload task finishes, then release the whole batch on an I/O or join error while returning the first error. Also release validated files' claims when snapshot publication fails. Size-rejected files remain staged without contributing descriptors, and successful publication still precedes field statistics and local deletion.
LocalFS fault-injection checks reach recovery on later attempts for both file-role assignments after I/O, task-join and snapshot read/write failures. They also cover repeated validation rejection and retry after an existing manifest was updated. The collector regression test is in
src/storage/object_storage.rs.Cargo's upload-batch and staged-file cleanup tests passed (respectively 2 and 1 passed, with 0 failed or ignored). Rustfmt passed for the changed file. Clippy reports pre-existing diagnostics on both revisions and remains for CI.
Failed collections still do not partially publish. Error returns now wait for outstanding upload tasks, and retries may repeat completed remote uploads. Production fault frequency and affected batch sizes remain unknown.
This PR has:
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart. To ask for a change, comment or review in plain words. How Perfloop handles pull requests.
Fix repeated storage and billing counts before merging.
Fix with agent prompt
Summary
This PR makes failed upload batches eligible for retry.
Acknowledged behavior: perfloop-agent states that error returns wait for outstanding uploads and retries may repeat completed remote uploads.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Claim staged files] --> B[Upload and validate files] B --> C[Increase storage and billing metrics] C --> D{Any task failed?} D -->|Yes| E[Wait for all tasks and release batch claims] D -->|No| F{Publish snapshot} F -->|Failure| G[Release successful file claims] E --> H[Retry staged files] G --> H H --> B F -->|Success| I[Calculate field stats and delete staged files]Reviews (1) · Last reviewed commit: "fix: release failed staging upload batch..." · Reviewed by Greptile