Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the response code when DELETE and MOVE requests to the file that is still in post-processing #4776

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Dockerfile.revad-ceph
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ FROM quay.io/ceph/ceph:v18

# replace repo url with one that allows downloading the repo metadata
# if http://download.ceph.com/rpm-reef/el8/x86_64/repodata/repomd.xml works again this can be dropped
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN mkdir -p /etc/selinux/config
# RUN sed -i 's/download.ceph.com/de.ceph.com/' /etc/yum.repos.d/ceph.repo
# RUN mkdir -p /etc/selinux/config
#
# RUN dnf update --exclude=ceph-iscsi,chrony -y && dnf install -y \
# git \
# gcc \
# make \
# libcephfs-devel \
# librbd-devel \
# librados-devel

RUN dnf update --exclude=ceph-iscsi,chrony -y && dnf install -y \
RUN dnf update --exclude=ceph-iscsi -y && dnf install -y \
git \
gcc \
make \
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-postprocessing-responce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix response code for DEL file that in postprocessing

We fixed the response code when DELETE and MOVE requests to the file that is still in post-processing.

https://github.com/cs3org/reva/pull/4776
https://github.com/owncloud/ocis/issues/9432
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/cheggaaa/pb v1.0.29
github.com/coreos/go-oidc/v3 v3.4.0
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb
github.com/dgraph-io/ristretto v0.1.1
github.com/emvi/iso-639-1 v1.1.0
github.com/eventials/go-tus v0.0.0-20220610120217-05d0564bb571
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,8 @@ github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e h1:tqSPWQeueWTKnJVMJff
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e h1:Cm2l8m2riLa79eh7V2wHd1Ra7wR3TbngmeLZBJ9MxTU=
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ func (s *Service) Delete(ctx context.Context, req *provider.DeleteRequest) (*pro
if utils.ReadPlainFromOpaque(md.GetOpaque(), "status") == "processing" {
return &provider.DeleteResponse{
Status: &rpc.Status{
Code: rpc.Code_CODE_UNAVAILABLE,
Code: rpc.Code_CODE_TOO_EARLY,
Message: "file is processing",
},
Opaque: &typesv1beta1.Opaque{
Expand Down
20 changes: 20 additions & 0 deletions pkg/errtypes/errtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ func (e InsufficientStorage) Body() []byte {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507
const StatusInsufficientStorage = 507

// TooEarly is the error to use when some are not finished job over resource is still in process.
type TooEarly string

func (e TooEarly) Error() string { return "error: too early: " + string(e) }

// IsTooEarly implements the IsTooEarly interface.
func (e TooEarly) IsTooEarly() {}

// IsNotFound is the interface to implement
// to specify that a resource is not found.
type IsNotFound interface {
Expand Down Expand Up @@ -279,6 +287,12 @@ type IsInsufficientStorage interface {
IsInsufficientStorage()
}

// IsTooEarly is the interface to implement
// to specify that there is some not finished job over resource is still in process.
type IsTooEarly interface {
IsTooEarly()
}

// NewErrtypeFromStatus maps a rpc status to an errtype
func NewErrtypeFromStatus(status *rpc.Status) error {
switch status.Code {
Expand Down Expand Up @@ -313,6 +327,8 @@ func NewErrtypeFromStatus(status *rpc.Status) error {
return InsufficientStorage(status.Message)
case rpc.Code_CODE_INVALID_ARGUMENT, rpc.Code_CODE_OUT_OF_RANGE:
return BadRequest(status.Message)
case rpc.Code_CODE_TOO_EARLY:
return TooEarly(status.Message)
default:
return InternalError(status.Message)
}
Expand Down Expand Up @@ -345,6 +361,8 @@ func NewErrtypeFromHTTPStatusCode(code int, message string) error {
return BadRequest(message)
case http.StatusPartialContent:
return PartialContent(message)
case http.StatusTooEarly:
return TooEarly(message)
case StatusChecksumMismatch:
return ChecksumMismatch(message)
default:
Expand Down Expand Up @@ -379,6 +397,8 @@ func NewHTTPStatusCodeFromErrtype(err error) int {
return http.StatusBadRequest
case PartialContent:
return http.StatusPartialContent
case TooEarly:
return http.StatusTooEarly
case ChecksumMismatch:
return StatusChecksumMismatch
default:
Expand Down
1 change: 1 addition & 0 deletions pkg/rgrpc/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ var httpStatusCode = map[rpc.Code]int{
rpc.Code_CODE_UNIMPLEMENTED: http.StatusNotImplemented,
rpc.Code_CODE_UNKNOWN: http.StatusInternalServerError,
rpc.Code_CODE_LOCKED: http.StatusLocked,
rpc.Code_CODE_TOO_EARLY: http.StatusTooEarly,
}

// HTTPStatusFromCode returns an HTTP status code for the rpc code. It returns
Expand Down
Loading