Skip to content

Commit

Permalink
NSFS | versioning | add comment and documentation about multipart upl…
Browse files Browse the repository at this point in the history
…oad version-id

Signed-off-by: nadav mizrahi <[email protected]>
  • Loading branch information
nadavMiz committed Feb 13, 2025
1 parent a3bc7dd commit 20c3d8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/design/NsfsVersioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ In the figure, each original directory contains a hidden .versions/ sub- directo
* The version ID will be attached as an xattr of the file.
* When a latest version is moved to past versions directory, the file name will be changed from key to key_{version_id}.

#### Multipart upload version order
according to AWS specifications multipart upload version time should be calcluated based on multipart upload creation time rather then completion time. For directory buckets, the object creation time is the completion date of the multipart upload. In our design the version-id time is calculated based on completion time. see https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#distributedmpupload https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-using-multipart-upload.html#s3-express-distributedmpupload

### Delete marker
* A dummy file that will be created under the hidden .versions/ sub-directory on DELETE latest request.
* When A delete marker is the latest version of an object, it indicates that the object is deleted.
Expand Down
9 changes: 7 additions & 2 deletions src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1824,15 +1824,20 @@ class NamespaceFS {
}
}

// iterate over multiparts array -
// iterate over multiparts array -
// 1. if num of unique sizes is 1
// 1.1. if this is the last part - link the size file and break the loop
// 1.2. else, continue the loop
// 2. if num of unique sizes is 2
// 2.1. if should_copy_file_prefix
// 2.1.1. if the cur part is the last, link the previous part file to upload_path and copy the last part (tail) to upload_path
// 2.1.1. if the cur part is the last, link the previous part file to upload_path and copy the last part (tail) to upload_path
// 2.1.2. else - copy the prev part size file prefix to upload_path
// 3. copy bytes of the current's part size file
// NOTE on versioning - according to general aws specifications, the version_id time should be based on when we created the upload.
// for directory buckets, on AWS, the object creation time is the completion date of the multipart upload
// on our design we desided to do it based on when the upload was completed.
// see https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#distributedmpupload
// see https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-using-multipart-upload.html#s3-express-distributedmpupload
async complete_object_upload(params, object_sdk) {
const part_size_to_fd_map = new Map(); // { size: fd }
let read_file;
Expand Down

0 comments on commit 20c3d8e

Please sign in to comment.