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

Fix: Copy object mtime #8291

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Fix: Copy object mtime #8291

merged 2 commits into from
Oct 22, 2024

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Oct 18, 2024

Closes #8290

@N-o-Z N-o-Z added bug Something isn't working include-changelog PR description should be included in next release changelog labels Oct 18, 2024
@N-o-Z N-o-Z requested a review from a team October 18, 2024 21:33
@N-o-Z N-o-Z self-assigned this Oct 18, 2024
Copy link

E2E Test Results - Quickstart

11 passed

Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link
Contributor

@yonipeleg33 yonipeleg33 left a 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!!!
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
// 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

Copy link
Member Author

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

Copy link
Contributor

@yonipeleg33 yonipeleg33 Oct 19, 2024

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()
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

@itaiad200 itaiad200 left a 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.

@N-o-Z
Copy link
Member Author

N-o-Z commented Oct 21, 2024

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 CompletePresignMultipartUpload though in reality it's not an issue.
Added tests

@N-o-Z
Copy link
Member Author

N-o-Z commented Oct 22, 2024

Gave up on adding tests - too complicated and does not justify the overhead. Tested manually

@N-o-Z N-o-Z merged commit ec2e72a into master Oct 22, 2024
37 checks passed
@N-o-Z N-o-Z deleted the fix/copy-object-mtime-8290 branch October 22, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: CopyObject: modified time updated before actual blockstore copy
3 participants