Repository navigation
fix(decomposedfs): release the quota of orphaned upload sessions - #951
Merged
Merged
Conversation
This was referenced Oct 29, 2026
dragonchaser
approved these changes
Nov 3, 2026
Port of owncloud#692, adapted to our diverged decomposedfs copies: - Add an Orphaned upload session filter to storage.UploadSessionFilter, evaluated last in ListUploadSessions of both copies because it reads the node metadata of every session. - Add IsOrphaned and syntheticNode to OcisSession and DecomposedFsSession. - Extract the node reverting from upload.Cleanup into revertNode and run it before the bin and info files are removed, so a failure leaves a recoverable session instead of a deleted one. The readable-node branch keeps our local RevertUpload/Purge logic (upstream has RevertCurrentRevision). When the node metadata is unreadable, revert the optimistic size propagation from a node built out of the session's SpaceID/NodeID/NodeParentID and remove the orphaned node, so the space quota is released; the upload is kept when the quota cannot be released. In the pkg fork the orphaned node is removed via lu.PurgeNode and its metadata via the MetadataNode-based backend Purge. - Clean up orphaned sessions on PostprocessingFinished instead of returning early and leaving them to be retried forever. - Add the regression test to both upload_async_test.go copies. Changelog is maintained in the ready-release-go PR, not per commit. Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
- Add node.ErrMissingParentID and treat a session as orphaned only when reading its node fails with it. Other read errors, e.g. an unavailable cache, are logged and leave the session untouched. - On PostprocessingFinished, only drop the bytes and info of an orphaned session when postprocessing asked to delete the upload. - Clear and persist the session's sizeDiff before reverting it, so a repeated cleanup does not release the quota twice. - Remove the bytes even if reverting the node failed, so infected files do not stay on disk. Only the info is kept for a retry. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Cleaning up an orphaned upload removed the node without checking whether the upload created it. For an upload that overwrites a file the node holds the previous version, on posix the user's file itself, so it got deleted. We now only revert the size diff for an existing node. A node the upload created is removed only while it is still empty: the uploaded bytes only get there when the upload is finalized. If it has content, something outside of us wrote it, e.g. an editor saving atomically on posix before the watcher assimilated the file, so we keep it. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
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.
Before the coordinator takes over: an upload session whose node metadata can no longer be read kept its optimistically propagated size forever, so the space quota never came back.
We now have an
Orphanedfilter onstorage.UploadSessionFilter, evaluated last inListUploadSessionsbecause it reads the node metadata of every session. Cleaning up an orphaned session reverts the size propagation from the ids stored in the session and removes the node, but only a node the upload created. The node is reverted before the bin and info files are removed, so a failure leaves a session that can be retried instead of a lost one.PostprocessingFinishednow cleans up orphaned sessions instead of leaving them to be retried forever.Review focus:
upload/upload.gorevertNodein both copies: the "only remove a node the upload created" check, and that the quota is released exactly onceIsOrphaned: what counts as orphaned (exists, but metadata unreadable) vs. simply goneReplaces #896 (fork branch, GitHub stacks need all branches in this repository). The reviews are over there.
Assisted by Claude Code (claude-opus-5-5): it adapted the changes, split them into this stack and wrote this description.