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

EVG-18372: Reimplement gridfs bucket #105

Merged
merged 9 commits into from
Oct 13, 2023

Conversation

julianedwards
Copy link
Collaborator

@julianedwards julianedwards commented Oct 11, 2023

JIRA: https://jira.mongodb.org/browse/EVG-17662

Adding back the gridfs bucket implementation to facilitate support for logs on local evergreen.
I also fixed up some tests and improved consistent usage of path separators.

@julianedwards julianedwards changed the title EVG-18372: Add back gridfs implementation EVG-18372: Reimplement gridfs bucket Oct 11, 2023
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
bucket_test.go Outdated Show resolved Hide resolved
bucket_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@Kimchelly Kimchelly left a comment

Choose a reason for hiding this comment

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

LGTM mod some non-blocking comments.

@@ -25,6 +25,10 @@ func consistentJoin(elems []string) string {
return strings.Join(out, "/")
}

func consistentTrimPrefix(key, prefix string) string {
return strings.TrimPrefix(key, prefix+"/")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this trim trailing slashes from prefix before appending a trailing slash to it to avoid double slashes in the prefix? I've had some ambiguity before where I was specifying the prefix and wasn't certain if the prefix was supposed to include the trailing slash or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is ok to leave, we can always change it later but this is only used internally.

gridfs_bucket.go Outdated
// it exists. This function is called by each operation that needs to read or
// write from the bucket to avoid read and write deadline conflicts—custom
// deadlines cannot be set on a GridFS bucket instance concurrently with other
// read or write operations that also require a custom deadlines. Setting the
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe phrase the last sentence as This function sets the read and write deadlines to allow it to respect the context timeouts passed in by the caller, since the phrasing seems to assume you already know it sets the read/write deadlines.

gridfs_bucket.go Outdated
@@ -115,6 +99,13 @@ func (b *gridfsBucket) Exists(ctx context.Context, key string) (bool, error) {

func (b *gridfsBucket) Join(elems ...string) string { return consistentJoin(elems) }

// bucket returns a new GridFS bucket configured with the context timeout, if
// it exists. This function is called by each operation that needs to read or
// write from the bucket to avoid read and write deadline conflicts—custom
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what this sentence about custom deadlines is saying. Are there deadlines other than the context deadline in play here? What do custom deadlines and other read or write operations that also require custom deadlines refer to in this case?

Would help understanding if we can clarify this sentence a little bit. 🙏

gridfs_bucket.go Outdated
// it exists. This function is called by each operation that needs to read or
// write from the bucket to avoid read and write deadline conflicts—custom
// deadlines cannot be set on a GridFS bucket instance concurrently with other
// read or write operations that also require a custom deadlines. Setting the
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: a custom deadline or custom deadlines

gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
gridfs.go Outdated Show resolved Hide resolved
@julianedwards julianedwards merged commit 56d0712 into evergreen-ci:main Oct 13, 2023
@julianedwards julianedwards deleted the EVG-18372 branch October 13, 2023 19:56
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