Skip to content

Commit

Permalink
fix sharecache exists case
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Nov 22, 2024
1 parent 4f31fd9 commit 32fc5c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/jsoncs3-cache-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: jsoncs3 cache fixes

The jsoncs3 share manager now retries persisting if the file already existed and picks up the etag of the upload response in all cases.

https://github.com/cs3org/reva/pull/4968
https://github.com/cs3org/reva/pull/4532
5 changes: 5 additions & 0 deletions pkg/share/manager/jsoncs3/sharecache/sharecache.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ func (c *Cache) Remove(ctx context.Context, userid, shareID string) error {
log.Debug().Msg("precondition failed when persisting removed share: etag changed. retrying...")
// actually, this is the wrong status code and we treat it like errtypes.Aborted because of inconsistencies on the server side
// continue with sync below
case errtypes.AlreadyExists:
log.Debug().Msg("file already existed when persisting removed share. retrying...")
// CS3 uses an already exists error instead of precondition failed when using an If-None-Match=* header / IfExists flag in the InitiateFileUpload call.
// Thas happens when the cache thinks there is no file.
// continue with sync below
default:
span.SetStatus(codes.Error, fmt.Sprintf("persisting removed share failed. giving up: %s", err.Error()))
log.Error().Err(err).Msg("persisting removed share failed")
Expand Down

0 comments on commit 32fc5c3

Please sign in to comment.