From 32fc5c394126e509db6db11c9b8e32fdc6d14320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 22 Nov 2024 12:35:44 +0100 Subject: [PATCH] fix sharecache exists case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/jsoncs3-cache-fixes.md | 6 ++++++ pkg/share/manager/jsoncs3/sharecache/sharecache.go | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 changelog/unreleased/jsoncs3-cache-fixes.md diff --git a/changelog/unreleased/jsoncs3-cache-fixes.md b/changelog/unreleased/jsoncs3-cache-fixes.md new file mode 100644 index 0000000000..8aa592ad9c --- /dev/null +++ b/changelog/unreleased/jsoncs3-cache-fixes.md @@ -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 diff --git a/pkg/share/manager/jsoncs3/sharecache/sharecache.go b/pkg/share/manager/jsoncs3/sharecache/sharecache.go index f763dee0f8..518344f95e 100644 --- a/pkg/share/manager/jsoncs3/sharecache/sharecache.go +++ b/pkg/share/manager/jsoncs3/sharecache/sharecache.go @@ -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")