-
Notifications
You must be signed in to change notification settings - Fork 80
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
NSFS | versioning | calculate multipart upload version by creation time #8644
base: master
Are you sure you want to change the base?
Conversation
12445b6
to
2c10bc0
Compare
2c10bc0
to
b3b9a42
Compare
@nadavMiz I'm adding a TODO here so we will not forget - run the test on MAC as well. |
cc844df
to
7d5bf69
Compare
const create_object_upload_stat = await nb_native().fs.stat(fs_context, create_object_upload_path); | ||
//according to aws, multipart upload version time should be calculated based on creation rather then completion time. | ||
//change the files mtime to match the creation time | ||
await nb_native().fs.utimensat(fs_context, upload_path, {modtime: create_object_upload_stat.mtimeNsBigint}); |
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.
do you think we should fail the whole upload in case we were not able to set the mtime?
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 guess we can use the existing time in case it fails
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.
@guymguym WDYT? I'm not sure, since it might create a wrong .versions/ stack order, but on the other hand we probably don't want to fail on that
src/native/fs/fs_napi.cpp
Outdated
SYSCALL_OR_RETURN(utimensat(AT_FDCWD, _path.c_str(), _times, 0)); | ||
} | ||
|
||
void get_time_from_info(const Napi::Object& napi_times, const std::string& time_type, struct timespec& timeval, std::string& log_str) { |
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.
pls move helper functions to not be in the middle of the workers
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.
get_time_from_info is only relevant to utimensat, so I added it as a member function to the class. where would you propose to move it?
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 saw helper functions both at the top and at the bottom of this file, so check what you think is the best location
8c7187b
to
5bcf21d
Compare
Signed-off-by: nadav mizrahi <[email protected]>
5bcf21d
to
ba6cf8c
Compare
Explain the changes
according to aws specifications multipart upload version creation time rather than completion time. this effects version ordering as will no have the latest version if another object was uploaded after multipart upload creation but before completion
utimensat
to change access time of files. see https://man7.org/linux/man-pages/man3/futimens.3p.htmlIssues: Fixed #8411
Testing Instructions:
sudo node ./node_modules/mocha/bin/mocha src/test/unit_tests/test_nb_native_fs.js
sudo NC_CORETEST=true node ./node_modules/mocha/bin/mocha src/test/unit_tests/test_bucketspace_versioning.js