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

NSFS | content dir versioning LIST and tagging operations #8814

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nadavMiz
Copy link
Contributor

@nadavMiz nadavMiz commented Feb 19, 2025

Explain the changes

  1. change list-object-versions to work with content directory objects
  2. change tagging functions to use _find_version_path in order to get the correct path
  3. remove configuration variable to enable content dir versioning, as it should be completed
  4. add documentation about content dir versioning
  5. add unit test

Issues: Fixed #xxx / Gap #xxx

Content-dir versioning issue: #8531
continuation of #8773

####GAPS

Testing Instructions:

  • Doc added/updated
  • Tests added

Comment on lines 58 to 60
content dir structure has two modes:
1. versioning disabled mode,at this mode xattr are located at the directory. we create `.folder` file inside the directory only if the object has data in it. in that case `.folder` file contains the objects body.
example bucket tree:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would give some more background and organize it a bit more. This is an example for disabled mode, we need the same for the other modes

Suggested change
content dir structure has two modes:
1. versioning disabled mode,at this mode xattr are located at the directory. we create `.folder` file inside the directory only if the object has data in it. in that case `.folder` file contains the objects body.
example bucket tree:
Versioning related xattr -
1. `user.noobaa.version_id` - stores the version_id string.
2. `user.noobaa.delete_marker` - boolean.
3. `user.noobaa.content_dir` - stores the size of the directory object.
Directory object / content directory filesystem structure has two modes -
1. versioning disabled mode -
On this mode, the object body and the xattr (extended attributes) are splitted. The data of the directory object will be stored in `<dir_path>/.folder`, while the xattr of the directory object will be stored on the directory itself - <dir_path>. `<dir_path>/.folder` file is created only if the object's data size > 0. When size = 0, only the xattr will be stored in `<dir_path>`.

const fs_context = this.prepare_fs_context(object_sdk);
const file_path = await this._find_version_path(fs_context, params, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you checked that this change is compatible to S3? especially when versioning is suspended, delete tagging from the version id file is expected per the protocol?

Copy link
Contributor Author

@nadavMiz nadavMiz Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there shouldn't be a difference between enabled and suspended mode. but I will validate this. I will also check what happens if we are in disabled mode and have version as a parameter

const key_list_versions = list_res.Versions.filter(v => v.Key === key);
assert.equal(key_list_versions.length, version_ids.size);
key_list_versions.forEach(v => {
assert(version_ids.has(v.VersionId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an assert of the key and the version id do not contain .folder?


await s3_uid6.putBucketVersioning({ Bucket: content_dir_bucket_name, VersioningConfiguration: { MFADelete: 'Disabled', Status: 'Enabled' } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after validating the behavior on AWS, can you add a test for suspended mode as well?

});

mocha.it('content directory - list object versions', async function() {
const key = "list_key/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need a test of list object versions versioning suspended?

const key = "list_key/";
const version_ids = new Set();
let push_res = await s3_uid6.putObject({ Bucket: content_dir_bucket_name, Key: key, Body: body1 });
version_ids.add(push_res.VersionId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add a delete marker of content dir in this test / another test?

@romayalon
Copy link
Contributor

@nadavMiz please add a link in the description to all the content directory PRs the original issue, I think it's 8531

@nadavMiz nadavMiz force-pushed the directory-object-list-operation branch from 573c2d1 to 629a556 Compare March 26, 2025 12:45
@nadavMiz nadavMiz force-pushed the directory-object-list-operation branch from 629a556 to b59fbb2 Compare April 2, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants