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

Remove lakectl direct deprecated functionality #6623

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

nopcoder
Copy link
Contributor

Fix #6479

@nopcoder nopcoder added the include-changelog PR description should be included in next release changelog label Sep 19, 2023
@nopcoder nopcoder self-assigned this Sep 19, 2023
@github-actions
Copy link

github-actions bot commented Sep 19, 2023

♻️ PR Preview 2eec97b has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@@ -8,6 +8,8 @@ import (
"strings"
"time"

"github.com/treeverse/lakefs/pkg/api/helpers"

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@@ -1,4 +1,4 @@
package helpers
package esti
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Do we use all the functions defined here only in Esti?
  2. I'm not sure about the new file name, it says adapter_test but there are no tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The helper package had adapters that include upload direct.
All the tests that used direct were removed. Except the GC test that I wasn't sure if we like to remove this case - until we will enable different way, like presign.
I've moved the code into the system test (esti) so I've kept the name and added _test as this code should be built only when running test.

require.Equalf(t, objContent, body, "path: %s, expected: %s, actual:%s", objPath, objContent, body)
})
}
ctx, _, repo := setupTest(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated question to this PR- how do we check that everything works with pre-signed mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

presign_test.go

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that a better way to test it is to run all the tests in another suit with the pre-signed flag on so we don't have to remember to add a new test for every command/feature we add but again, it doesn't related to this PR

if direct {
stats, err := helpers.ClientUploadDirect(ctx, client, repo, branch, objPath, nil, "", strings.NewReader(objContent))
stats, err := uploadContentDirect(ctx, client, repo, branch, objPath, nil, "", strings.NewReader(objContent))
Copy link
Contributor

Choose a reason for hiding this comment

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

why you didn't remove the direct flag from the uploadFileAndReport and uploadFileRandomDataAndReport functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are specific GC tests that upload direct so I've moved the implementation and kept the test helper function.

// uploadContentDirect uploads contents as a file using client-side ("direct") access to underlying storage.
// It requires credentials both to lakeFS and to underlying storage, but considerably reduces the load on the lakeFS
// server.
func uploadContentDirect(ctx context.Context, client apigen.ClientWithResponsesInterface, repoID, branchID, objPath string, metadata map[string]string, contentType string, contents io.ReadSeeker) (*apigen.ObjectStats, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand why we still need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do not require direct upload for GC testing, I'll remove this functionality.

Copy link
Contributor

@idanovo idanovo left a comment

Choose a reason for hiding this comment

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

LGTM

@nopcoder nopcoder merged commit bbe5f47 into master Sep 20, 2023
@nopcoder nopcoder deleted the chore/rm-lakectl-direct branch September 20, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove lakectl --direct flag
2 participants