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

NC | UploadPart | finish_upload | stat(part-{num}) should not check ctime due to concurrency part uploads of the same part. #8017

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,8 @@ class NamespaceFS {
const part_upload = file_path === upload_path;
const same_inode = params.copy_source && copy_res === copy_status_enum.SAME_INODE;
const is_dir_content = this._is_directory_content(file_path, params.key);
let stat = await target_file.stat(fs_context);
// upload_part should disable ctime_check because we update the same part-file on concurrent put part
let stat = await target_file.stat({ ...fs_context, disable_ctime_check: part_upload });
this._verify_encryption(params.encryption, this._get_encryption_info(stat));

// handle xattr
Expand Down Expand Up @@ -1309,7 +1310,7 @@ class NamespaceFS {
if (params.copy_source) fs_xattr = await this._get_copy_source_xattr(params, fs_context, fs_xattr);
await this._assign_dir_content_to_xattr(fs_context, fs_xattr, { ...params, size: stat.size }, copy_xattr);
}
stat = await nb_native().fs.stat(fs_context, file_path);
stat = await nb_native().fs.stat({ ...fs_context, disable_ctime_check: part_upload }, file_path);
const upload_info = this._get_upload_info(stat, fs_xattr && fs_xattr[XATTR_VERSION_ID]);
return upload_info;
}
Expand Down