Skip to content

Commit

Permalink
Merge pull request #4481 from butonic/distinguish-failure-and-node-me…
Browse files Browse the repository at this point in the history
…tadata-reversal

distinguish failure and node metadata reversal
  • Loading branch information
butonic authored Jan 26, 2024
2 parents 3439ff9 + 6ec06a5 commit c9e4a3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: distinguish failure and node metadata reversal

When the final blob move fails we must not remove the node metadata to be able to restart the postprocessing process.

https://github.com/cs3org/reva/pull/4481
10 changes: 7 additions & 3 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}

var (
failed bool
keepUpload bool
failed bool
revertNodeMetadata bool
keepUpload bool
)
unmarkPostprocessing := true

Expand All @@ -297,12 +298,14 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
fallthrough
case events.PPOutcomeAbort:
failed = true
revertNodeMetadata = true
keepUpload = true
metrics.UploadSessionsAborted.Inc()
case events.PPOutcomeContinue:
if err := session.Finalize(); err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not finalize upload")
failed = true
revertNodeMetadata = false
keepUpload = true
// keep postprocessing status so the upload is not deleted during housekeeping
unmarkPostprocessing = false
Expand All @@ -311,6 +314,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}
case events.PPOutcomeDelete:
failed = true
revertNodeMetadata = true
metrics.UploadSessionsDeleted.Inc()
}

Expand All @@ -337,7 +341,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}
}

fs.sessionStore.Cleanup(ctx, session, failed, keepUpload, unmarkPostprocessing)
fs.sessionStore.Cleanup(ctx, session, revertNodeMetadata, keepUpload, unmarkPostprocessing)

// remove cache entry in gateway
fs.cache.RemoveStatContext(ctx, ev.ExecutingUser.GetId(), &provider.ResourceId{SpaceId: n.SpaceID, OpaqueId: n.ID})
Expand Down

0 comments on commit c9e4a3b

Please sign in to comment.