Skip to content

fix: [stable-8.0][OCISDEV-1714] keep the connection error of a metadata download - #820

Open
2403905 wants to merge 1 commit into
stable-8.0from
fix/8.0/OCISDEV-1714
Open

2403905 wants to merge 1 commit into
stable-8.0from
fix/8.0/OCISDEV-1714

Conversation

@2403905

@2403905 2403905 commented Nov 18, 2026 •

Copy link
Copy Markdown

Description

The function Download in pkg/storage/utils/metadata/cs3.go changed each error of InitiateFileDownload to errtypes.NotFound. InitiateFileDownload does not read the file. It only returns the download URL (internal/grpc/services/storageprovider/storageprovider.go, InitiateFileDownload). So an error from this call is a connection error, for example Unavailable from a dead replica. For a missing file, the GET request that comes next gets HTTP 404, and that gives NotFound.

A caller that gets NotFound continues as if the file does not exist:

  • ocis settings: ListRoleAssignments skips the assignment and returns an empty role list. The proxy then assigns the default role "User". WriteRoleAssignment deletes the old assignments first, so an Admin becomes a User without an error.
  • jsoncs3: providercache, sharecache and receivedsharecache go to cas.DecideNotFoundReset and reset the cache to empty.

The trigger is a partial failure of storage-system: Authenticate reaches a good replica, and InitiateFileDownload reaches a bad replica. The pool selects a replica for each RPC.

Changes

  • Return the error of InitiateFileDownload without a change.
  • Change a non-OK status of InitiateFileDownload to the matching typed error (errtypes.NewErrtypeFromStatus).
  • Add tests in pkg/storage/utils/metadata/cs3_download_test.go. A fake storage provider returns Unavailable or PERMISSION_DENIED. Without the fix, the tests get errtypes.NotFound and the message "metadata storage doesn't support the spaces download protocol".

Effect on the callers

  • jsoncs3: the default branch returns the error. syncWithRetry retries, because cas.IsSyncTransient detects the raw gRPC error. Each retry selects a replica again.
  • ocis settings: the default branch returns the error. The role does not change.
  • No caller treats an error as "the file is new, so create it".

Related issue

  • OCISDEV-1714
  • The ocis PR for stable-8.0 adds protections in the settings service. A reva bump follows after this PR is merged.

How has this been tested?

  • go test ./pkg/storage/utils/metadata/...
  • go test ./pkg/share/manager/jsoncs3/... ./pkg/share/manager/cs3/... ./pkg/publicshare/manager/... ./pkg/storage/utils/indexer/...
  • The ocis settings and proxy tests pass with this reva through a local go.work.

🤖 Generated with Claude Code

@kw-security

kw-security commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

…ta download

The function Download in pkg/storage/utils/metadata/cs3.go changed each
error of InitiateFileDownload to errtypes.NotFound. InitiateFileDownload
does not read the file. It only returns the download URL. So an error
from this call is a connection error, for example Unavailable from a
dead replica. A caller that gets NotFound continues as if the file does
not exist:

- The settings service skips the role assignment and returns an empty
  role list. The proxy then assigns the default role "User" and so
  removes the old role, for example Admin.
- The jsoncs3 share manager resets a share cache to empty.

Changes:

- Return the error of InitiateFileDownload without a change.
- Change a non-OK status of InitiateFileDownload to the matching typed
  error.
- Add tests in pkg/storage/utils/metadata/cs3_download_test.go with a
  fake storage provider.

For a missing file, the GET request gets HTTP 404, and that still gives
NotFound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@2403905
2403905 force-pushed the fix/8.0/OCISDEV-1714 branch from adb14c8 to bdbc4f4 Compare November 18, 2026 17:25
@2403905 2403905 changed the title fix: [stable-8.0][OCISDEV-1714] keep the transport error of a metadata download fix: [stable-8.0][OCISDEV-1714] keep the connection error of a metadata download Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants