Skip to content

jsoncs3: rebuild received.json when its blob is missing #4100

Open

Description

@butonic

When the blob of a user's received.json in the share manager metadata is missing and the node is not marked as processing, that user is stuck for good:

  • Download skips recoverInterruptedUpload() and ReadBlob fails with a wrapped os.Open error, not NotFound
  • receivedsharecache.syncWithLock() only tolerates NotFound and NotModified, so it returns the error
  • ListReceivedShares fails on every request and Add fails as well, because it syncs first
	dlres, err := c.storage.Download(ctx, metadata.DownloadRequest{
		Path:        jsonPath,
		IfNoneMatch: []string{rss.etag},
	})
	switch err.(type) {
	case nil:
		span.AddEvent("updating local cache")
	case errtypes.NotFound:
		span.SetStatus(codes.Ok, "")
		return nil
	case errtypes.NotModified:
		span.SetStatus(codes.Ok, "")
		return nil
	default:
		// ...
		return err
	}

Admins have no proper way out. received.json lives in the system storage, so there is no API for it. opencloud decomposedfs metadata can only get and set attributes, and storage-users uploads delete-stale-nodes only handles processing nodes in the users storage. The only workaround is stopping opencloud and either writing {} to the blob path or deleting the node by hand. Both lose the share states, and direct user shares vanish from the recipient's "shared with me" until they are shared again.

How the blob went missing in the first place is still open. In oCIS it was a full disk during the upload; with opencloud-eu/reva#976 the system storage writes the blob before pointing the node to it, so this might only affect nodes left over from older versions.

We could rebuild the received states from the providercache, because the <spaceID>.json files contain all shares with their grantees:

The original state (accepted, hidden, mountpoint) is lost either way. Rebuilt shares would come back as pending, or accepted if auto accept is on.

  • map ReadBlob on a missing blob to a dedicated error in decomposedfs
  • rebuild the received states from the providercache
  • test with a received.json node pointing to a missing blob

related: https://github.com/opencloud-eu/omega/issues/783

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions