-
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: Copy object mtime #8291
Fix: Copy object mtime #8291
Conversation
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!
Not approving, but I do not wish to block this PR either.
Also, please change the title to "Fix: change object mtime after blockstore copy" or something a bit more indicative
@@ -2741,6 +2740,9 @@ func (c *Catalog) CopyEntry(ctx context.Context, srcRepository, srcRef, srcPath, | |||
return nil, err | |||
} | |||
|
|||
// Update creation date only after actual copy!!! |
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.
// Update creation date only after actual copy!!! | |
// Update creation date only after actual copy to prevent potential discrepancy between lakefs and the underlying blockstore mtimes |
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.
This comment is incorrect, it does not prevent any discrepancy
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.
Huh, this is kind of what I understood from reading the issue description. Maybe "prevent" isn't accurate, as this fix aims to minimise the time difference rather than making it equal, but maybe I got it all wrong 😄
In any case, my point is to add a why to this comment, not only what.
@@ -2741,6 +2740,9 @@ func (c *Catalog) CopyEntry(ctx context.Context, srcRepository, srcRef, srcPath, | |||
return nil, err | |||
} | |||
|
|||
// Update creation date only after actual copy!!! | |||
dstEntry.CreationDate = time.Now() |
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 wonder - shouldn't we use the blockstore's mtime instead of time.Now
? Is this even possible?
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.
Out of scope for this fix. Your suggestion is a valid question which has implications that we are currently evaluating since it requires another call to the underlying storage
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.
Approving with couple of suggestions:
- Include
CompletePresignMultipartUpload
&StageObject
similar fixes in this PR (or at the very least open an issue for the same phenomena) - If there's some easy way to test it I'd add that timestamp validation there. We know it causes bug for users, so it's best to try and prevent regressions.
@itaiad200 StageObject is irrelevant since no writes to the storage are being performed. Modified the code in |
Gave up on adding tests - too complicated and does not justify the overhead. Tested manually |
Closes #8290