Repository navigation
Description
On posix a synchronous upload still goes mark -> commit -> unmark: PrepareUpload switches the node and marks it processing:<session id>, CommitUpload writes the bytes and only then MarkProcessing(false) removes the mark (
reva/pkg/upload/coordinator.go
Lines 631 to 657 in f134c0d
| func (c *coordinator) commit(ctx context.Context, session Session) (*provider.ResourceInfo, error) { | |
| ref := session.Reference() | |
| f, err := os.Open(session.BinPath()) | |
| if err != nil { | |
| return nil, err | |
| } | |
| // The verdict rides along with the bytes, so a committed blob always carries | |
| // the one it was cleared under. Empty on the inline path, which never scans. | |
| scanResult, scanDate := session.ScanData() | |
| // CommitUpload does not own the body; we opened it, so we close it. The path | |
| // lets a driver that can move the staged file into place skip the copy. | |
| err = c.fs.CommitUpload(ctx, &ref, session.ID(), storage.UploadSource{ | |
| Body: f, | |
| Path: session.BinPath(), | |
| Length: session.Size(), | |
| ScanResult: scanResult, | |
| ScanDate: scanDate, | |
| }) | |
| f.Close() | |
| if err != nil { | |
| return nil, err | |
| } | |
| // Not unmarkProcessing: the commit succeeded, so a missing node is unexpected. | |
| if err := c.fs.MarkProcessing(ctx, &ref, false, session.ID()); err != nil { |
TooEarly ... forever.
#976 fixed this for decomposed and decomposeds3 by storing the blob before the node points to it, and by healing stuck nodes on download. #1001 brings the same to the coordinator. Both skip posix on purpose: the posix blobstore writes to the node's live path, so there is no "blob first", and the recovery bails out early:
// https://github.com/opencloud-eu/reva/blob/f134c0d9f72f362b25389a9fc37b3d13c52a841f/pkg/storage/pkg/decomposedfs/recover.go#L35
if !fs.separateBlobs || fs.o.AsyncFileUploads {
// processing markers are expected here, postprocessing removes them
return false
}The bytes are not lost: the coordinator session (<upload dir>/<id> and <id>.info) survives the crash. So posix could heal the node from the session the same way, on download or when the coordinator starts:
- if the node is
processing:<id>, its blob id is<id>and the session is old enough, commit the staged bytes and remove the mark - if the session is gone, restore the snapshot revision
PrepareUploadtook, or at least drop the mark so the file can be deleted
The same is true on main, where the legacy upload path also only stores the blob first for separate blobstores.
related: opencloud-eu/opencloud#3879 (same symptom after a crash, but for async postprocessing), opencloud-eu/opencloud#3870
Activity