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

WIP: add option to disable versioning in EOS upon PUT request #4864

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jessegeens
Copy link
Contributor

@jessegeens jessegeens commented Sep 24, 2024

Fix for #4855

This PR introduces a new HTTP header for PUT requests, X-Disable-Versioning. When this header is added to a PUT request, the EOS storage driver will turn off versioning for this particular save. This is particularly useful for applications that perform automatic saves every x minutes: disabling versioning on these automatic saves ensures that the version history of these files is not polluted

Copy link

update-docs bot commented Sep 24, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jessegeens jessegeens force-pushed the feature/disable-versioning branch 2 times, most recently from 41e988f to a1186bd Compare September 30, 2024 09:34
Copy link
Contributor

@diocas diocas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First commit! Thanks.

I've made some comments. Please clean up the commit history to split the feature (and its tests) and all the other things you had to do to be able to do the tests (like updates and registering the gw?).
I'm not able to evaluate if the tests are ok like this. I'll wait for more knowledgeable people.

changelog/unreleased/disable-versioning.md Show resolved Hide resolved
pkg/eosclient/eosbinary/eosbinary.go Outdated Show resolved Hide resolved
pkg/eosclient/eosgrpc/eoshttp.go Outdated Show resolved Hide resolved
pkg/rgrpc/todo/pool/pool.go Show resolved Hide resolved
@jessegeens jessegeens force-pushed the feature/disable-versioning branch 6 times, most recently from b7a8ad1 to 0a396f9 Compare October 4, 2024 08:06
@jessegeens jessegeens force-pushed the feature/disable-versioning branch 3 times, most recently from c218967 to 63387a0 Compare October 4, 2024 08:40
diocas
diocas previously approved these changes Oct 4, 2024
@jessegeens jessegeens force-pushed the feature/disable-versioning branch 2 times, most recently from a801001 to 287333f Compare October 23, 2024 07:13
@jessegeens jessegeens force-pushed the feature/disable-versioning branch 2 times, most recently from 2360468 to f04100c Compare October 28, 2024 13:17
@@ -278,6 +278,9 @@ func (s *svc) handlePut(ctx context.Context, w http.ResponseWriter, r *http.Requ
httpReq.Header.Set(HeaderLockHolder, lockholder)
}

// Set Content-Length
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should add a few more comments here. The bug in EOS is fixed, but it's still recommended to always pass the length.

@@ -26,6 +26,7 @@ import (
"strconv"

provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/internal/http/services/owncloud/ocdav"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually, do you thing ocdav is the correct place to have the content length header? It seems to be that it should be in some less specific place, used both inside the ocdav code and here.

Jesse Geens added 3 commits October 29, 2024 16:04
Implemented a new function to register a GatewayServiceClient. Previously, this could only be done by passing an actual connection. However, that is unnecessarily limiting. Introducing the RegisterGatewayServiceClient allows us to register mocked gateways for unit testing
This commit introduces a new header, `X-Disable-Versioning`, that is available on PUT requests. This header will disable versioning for this file save if the storage backend is EOS.

Additionally, this commit introduces two unit tests related to this functionality:
- TestDisableVersioningLeadsToCorrectQueryParams: test whether disabling versioning leads to correct query parameteers for the EOS HTTP / GRPC client
- TestDisableVersioningHeaderPassedAlong: test whether a header passed to the initial endpoint is propagated to the actual upload endpoint

Finally, this commit also fixes a bug that was already present, where
the app was not passed along in the case of token-based authz
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