-
Notifications
You must be signed in to change notification settings - Fork 362
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
Use time of create MPU on backend storage as time of MPU #8311
Conversation
84c7bbd
to
2ad899c
Compare
This time is either reported by the block adapter during creation, or it can be read by stat'ting the underlying object after complete-MPU. Use the latter method on S3.
Bump timeSlippage accordingly.
7f17008
to
bb70230
Compare
Azure and GCS do _not_ use the time of create-MPU. The important thing is that the two share the same time. Anything else confuses not only people but also programs. For instance DataBricks with presigned URLs can get confused by getting one time from lakeFS and another from underlying storage.
bb70230
to
a732383
Compare
Not a customer issueThis does not match any report by a customer of an inconsistency. It's just a relevant cleanup. |
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.
Thanks!
Very elegant - some minor comments
pkg/api/controller.go
Outdated
@@ -384,6 +384,12 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht | |||
|
|||
writeTime := time.Now() | |||
checksum := httputil.StripQuotesAndSpaces(mpuResp.ETag) | |||
if mpuResp.MTime != nil { | |||
// Anything else can be _really_ wrong when the storage layer assigns the time | |||
// of MPU creation. For instance, the S3 block adapter takes sure to return an |
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.
// of MPU creation. For instance, the S3 block adapter takes sure to return an | |
// of MPU creation. For instance, the S3 block adapter makes sure to return an |
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.
Thanks
@@ -384,6 +384,12 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht | |||
|
|||
writeTime := time.Now() | |||
checksum := httputil.StripQuotesAndSpaces(mpuResp.ETag) | |||
if mpuResp.MTime != nil { |
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.
Can we put line 387 right above this line
pkg/gateway/operations/putobject.go
Outdated
@@ -309,7 +309,8 @@ func handlePut(w http.ResponseWriter, req *http.Request, o *PathOperation) { | |||
// write metadata | |||
metadata := amzMetaAsMetadata(req) | |||
contentType := req.Header.Get("Content-Type") | |||
err = o.finishUpload(req, blob.Checksum, blob.PhysicalAddress, blob.Size, true, metadata, contentType) | |||
// BUG(ariels): Read MTime from upload! |
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 think we still haven't decided if this should be fixed or not - anyway it's not related to the changes in this PR (let's track it in an issue instead?)
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.
Removed.
@@ -779,6 +779,7 @@ func (a *Adapter) CompleteMultiPartUpload(ctx context.Context, obj block.ObjectP | |||
etag := strings.Trim(aws.ToString(resp.ETag), `"`) | |||
return &block.CompleteMultiPartUploadResponse{ | |||
ETag: etag, | |||
MTime: headResp.LastModified, |
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.
👍🏽
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.
:-)
esti/multipart_test.go
Outdated
|
||
// On S3 the object should have Last-Modified time at around time of MPU creation. | ||
// Ensure lakeFS fails the test if it fakes it by using the current time. | ||
time.Sleep(2 * timeResolution) |
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.
Never too happy about hardcoded sleeps in tests but seems inevitable.
Perhaps scope it to blockstoreType == s3?
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 completely understand. Don't like it but did it, thanks!
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.
Thanks!
Pulling once Esti passes again...
esti/multipart_test.go
Outdated
|
||
// On S3 the object should have Last-Modified time at around time of MPU creation. | ||
// Ensure lakeFS fails the test if it fakes it by using the current time. | ||
time.Sleep(2 * timeResolution) |
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 completely understand. Don't like it but did it, thanks!
pkg/api/controller.go
Outdated
@@ -384,6 +384,12 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht | |||
|
|||
writeTime := time.Now() | |||
checksum := httputil.StripQuotesAndSpaces(mpuResp.ETag) | |||
if mpuResp.MTime != nil { | |||
// Anything else can be _really_ wrong when the storage layer assigns the time | |||
// of MPU creation. For instance, the S3 block adapter takes sure to return an |
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.
Thanks
@@ -779,6 +779,7 @@ func (a *Adapter) CompleteMultiPartUpload(ctx context.Context, obj block.ObjectP | |||
etag := strings.Trim(aws.ToString(resp.ETag), `"`) | |||
return &block.CompleteMultiPartUploadResponse{ | |||
ETag: etag, | |||
MTime: headResp.LastModified, |
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.
:-)
pkg/gateway/operations/putobject.go
Outdated
@@ -309,7 +309,8 @@ func handlePut(w http.ResponseWriter, req *http.Request, o *PathOperation) { | |||
// write metadata | |||
metadata := amzMetaAsMetadata(req) | |||
contentType := req.Header.Get("Content-Type") | |||
err = o.finishUpload(req, blob.Checksum, blob.PhysicalAddress, blob.Size, true, metadata, contentType) | |||
// BUG(ariels): Read MTime from upload! |
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.
Removed.
edf1449
to
5dd27ca
Compare
This time is either reported by the block adapter during completion, or it can be read by stat'ting the underlying object after complete-MPU.
Fixes #8303.