-
Notifications
You must be signed in to change notification settings - Fork 360
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
Fix gcs walker relative key for import #5114
Conversation
@@ -23,6 +23,10 @@ func NewGCSWalker(client *storage.Client) *gcsWalker { | |||
|
|||
func (w *gcsWalker) Walk(ctx context.Context, storageURI *url.URL, op WalkOptions, walkFn func(e ObjectStoreEntry) error) error { | |||
prefix := strings.TrimLeft(storageURI.Path, "/") | |||
var basePath string | |||
if idx := strings.LastIndex(prefix, "/"); idx != -1 { | |||
basePath = prefix[:idx+1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what we want? I asked to import gs://foo/bar
and you'll import gs://foo/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it supports the case of a single file and directory
@@ -51,7 +54,7 @@ func (w *gcsWalker) Walk(ctx context.Context, storageURI *url.URL, op WalkOption | |||
} | |||
if err := walkFn(ObjectStoreEntry{ | |||
FullKey: attrs.Name, | |||
RelativeKey: strings.TrimPrefix(attrs.Name, prefix), | |||
RelativeKey: strings.TrimPrefix(attrs.Name, basePath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we okay with this being empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty string does nothing to the original value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get why it works for the bugs we have opened. I'm afraid of 2 things:
- Regression in some other flow. It doesn't seem like our ingest/import tests cover the slashes bug well enough.
- Inconsistency with other block adapters. Minor, but still.
Approving to unblock, please consider addressing these in followup issues.
Thanks @itaiad200 - tested from the UI and lakectl
|
Fix #5104
Fix #5102
Fix #5113