forked from cs3org/reva
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: [OCISDEV-900] Connect storageprovider with coordinator instead of driver #721
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
Open
LarsJurgensen
wants to merge
8
commits into
main
Choose a base branch
from
OCISDEV-900-pr7-switchover
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+193
−1,119
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6006bb4
feat: route data-path uploads through the coordinator
f-firas f0ee164
feat: serve the tus protocol from the coordinator
f-firas 77f9cff
feat: consume postprocessing results in the coordinator
f-firas 86133fa
feat: WIP
f-firas 6b608d1
feat: handle missing node id in tus
LarsJurgensen 61dc4ab
feat: add changelog
LarsJurgensen 3dc914a
feat: make TouchFile child-link creation atomic
LarsJurgensen 79bb052
feat: add NewCoordinatorFromConfig
LarsJurgensen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| Enhancement: Extract the upload state machine into a driver-agnostic coordinator | ||
|
|
||
| The upload state machine (TUS session management, postprocessing event loop, | ||
| antivirus integration, and restart safety) has been extracted from decomposedfs | ||
| into a new coordinator in `pkg/upload`. Every storage driver now inherits TUS | ||
| chunked uploads, postprocessing, and AV scanning without reimplementing any of | ||
| it. | ||
|
|
||
| Drivers integrate by implementing four new methods on the storage interface: | ||
|
|
||
| - `MarkProcessing` sets or clears a "processing" flag on a resource so readers | ||
| see a grayed-out placeholder while bytes are in flight. Drivers that do not | ||
| need concurrent-upload protection may implement this as a no-op. | ||
| - `PrepareUpload` is called after all bytes are received and before | ||
| postprocessing begins. Decomposedfs uses this to lock the node, snapshot the | ||
| previous version, and propagate the optimistic size change. Drivers with no | ||
| such requirements may return immediately. | ||
| - `CommitUpload` writes the staged bytes to the resource and receives | ||
| pre-computed checksums. | ||
| - `RollbackUpload` is the inverse of `PrepareUpload` and is called when | ||
| postprocessing fails or is aborted. Drivers that returned immediately from | ||
| `PrepareUpload` may return nil. The `RollbackInfo` struct carries the node | ||
| identity from the upload session rather than from live node metadata, so a | ||
| rollback can still release the quota of a node whose metadata has become | ||
| unreadable (e.g. because an ancestor was trashed mid-upload). | ||
|
|
||
| The coordinator owns the upload session files for the decomposedfs driver at | ||
| the same on-disk location as before (`<root>/uploads/`), so existing in-flight | ||
| uploads continue without interruption and no migration is required. | ||
|
|
||
| **Configuration:** | ||
|
|
||
| Both storageprovider and dataprovider gain an `upload_directory` config key that | ||
| sets the local directory where temporary upload session files and staged bytes are stored. | ||
| For decomposedfs this is optional; the coordinator falls back to `<root>/uploads/` | ||
| inside the driver's own root directory. For drivers that have no local filesystem | ||
| root, `upload_directory` must be set explicitly; otherwise the service fails to start. | ||
|
|
||
| The postprocessing consumer settings (`asyncfileuploads`, `consumer_group`, | ||
| `numconsumers`, `mount_id`) are read from the driver's own config block, the | ||
| same keys decomposedfs already uses. No new top-level config is introduced. | ||
|
|
||
| https://github.com/owncloud/reva/pull/702 | ||
| https://github.com/owncloud/reva/pull/703 | ||
| https://github.com/owncloud/reva/pull/714 | ||
| https://github.com/owncloud/reva/pull/715 | ||
| https://github.com/owncloud/reva/pull/717 | ||
| https://github.com/owncloud/reva/pull/720 | ||
| https://github.com/owncloud/reva/pull/721 |
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
onPostprocessingFinished(pkg/upload/postprocessing.go:139) has no equivalent to the deleteddecomposedfs.gohandler's guard for a node going missing mid-postprocessing — a failedCommitUploadjust logs and callspublishUploadFailed, nosession.Cleanup/RollbackUpload. Session + reserved quota get stuck with no auto-recovery. Not introduced by this diff, but this call site is what first makes it reachable for dataprovider in production.Also: combined decomposedfs+dataprovider deployments now run two full-stream NATS subscriptions instead of one (decomposedfs's renamed
<group>-revisionsgroup plus this one) — each distinct group name gets a full copy of every event.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.
This is true, but intentional. The purpose is to allow followup actions from admin, i.e. CleanUpload or RestartPostprocessing. This is the same in old code:
This basically leads to
session.Cleanup(false, false, false, false), which is a noop. The upload session was kept & the processing flag is kept.Previously, all events were handled in the driver decomposedfs. We want to make it driver independent, so handle them in the coordinator now (PostprocessingFinished, PostprocessingStepFinished, RestartPostprocessing, CleanUpload). However, there is one event, which really only makes sense for decomposedfs:
RevertRevision. It's only triggered when a admin via CLI runs some cleanup script. This cleanup script is implemented very decomposedfs specific and only works for this driver. Then this script publishes this event. Having this in the coordinator is weird, because for every other driver it won't work.Probably it would be nices to implement this somehow without using events at all, so decomposedfs would not need any event handling anymore. But for the purpose of implementing the coordinator, I don't want to reimplement the decomposedfs cleanup job. So for now the decomposedfs driver is still handling one event (RevertRevision) and all other events are handled by coordinator. To make sure it does not interfere with each other, the only register an independent subset of events: