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

feat: add optional sidecar files for metadata #522

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

benmcclelland
Copy link
Member

This adds the option to store metadata for objects and buckets within a hidden folder alongside the bucket or object:
bucket: .vgw_meta.
object: .vgw_meta.

Example invocation:
./versitygw -a myaccess -s mysecret posix --sidecar /tmp/gw

The attributes are stored by name within the hidden directory.

@benmcclelland benmcclelland marked this pull request as draft April 17, 2024 00:09
@benmcclelland benmcclelland force-pushed the ben/sidecar_meta branch 2 times, most recently from 1ca6ca3 to 2bd301a Compare April 24, 2024 15:53
@howff
Copy link

howff commented Nov 30, 2024

Thank you very much for this PR, it's just what I need! (backing filesystem is beegfs without xattr)

My initial tests of this PR show that it is working.

The example invocation above is wrong, it doesn't understand posix --sidecar DIR, you need posix --metadata sidecar and it might be writing to a hidden .vgw_meta directory.

Is there any chance this PR could be merged?

@howff
Copy link

howff commented Dec 2, 2024

I've merged current main into this branch ben/sidecar_meta by making the necessary changes. I don't think I have permission or know how to add commits to your PR though.

@benmcclelland
Copy link
Member Author

Thank you very much for this PR, it's just what I need! (backing filesystem is beegfs without xattr)

My initial tests of this PR show that it is working.

The example invocation above is wrong, it doesn't understand posix --sidecar DIR, you need posix --metadata sidecar and it might be writing to a hidden .vgw_meta directory.

Is there any chance this PR could be merged?

The main issue with this PR is that it can become out of sync somewhat unexpectedly. For instance if you upload a file through the gateway then change the file directly in the filesystem, the attributes (such as etag/checksum, etc) may be stale without any clear indication of why. And metadata could be orphaned if the file was directly deleted. Maybe this is fine if the use case is to only have access through the gateway. There is a file data version in scoutfs that we can check to see if inode/data_version changed and then throw out the potentially stale attrs. But I'm not aware of a generic way to support this for all filesystems.

I could be convinced that this behavior is acceptable and just needs documentation on the caveats, but I was concerned about getting bug reports that metadata was getting reported for older versions of files in these cases.

@howff
Copy link

howff commented Dec 3, 2024

That's a valid concern. I think it could be addressed in one or more of:

  • document it, and issue a warning upon start-up
  • make it default to read-only (as per your other branch) and have an option to enable writes
  • merge it as-is, and address the consistency issues in additional PRs further down the road

@rkm
Copy link

rkm commented Dec 3, 2024

Just commenting to say that I've rebased the changes from this PR so it is up-to-date with the main branch: SMI#1.

The use-case @howff and I have necessitates read-only access to objects, so luckily (for us) we can avoid much of the detail around updates to objects and metadata. I wonder if this is a common enough case for a simpler implementation to be acceptable and easier to maintain? Something like posix --metadata read-only?

If not, we would be happy to contribute clarifications and documentation as @howff suggests that would make the existing changes more palatable and minimise the maintenance burden.

@benmcclelland benmcclelland force-pushed the ben/sidecar_meta branch 2 times, most recently from bcf5777 to a2a9363 Compare December 16, 2024 23:42
@benmcclelland
Copy link
Member Author

Since there is sufficient interest in this, I can fixup this PR and merge in. And I'll probably update documentation for this with the known caveats. I dont think this needs to be read only as long as the limitations are understood.

@benmcclelland benmcclelland force-pushed the ben/sidecar_meta branch 2 times, most recently from 000a20d to ff68b8c Compare January 7, 2025 17:16
@benmcclelland benmcclelland marked this pull request as ready for review January 7, 2025 17:20
This adds the option to store metadata for objects and buckets
within a specified directory:
bucket: <sidecar dir>/<bucket>/meta/<attribute>
object: <sidecar dir>/bucket/<object>/meta/<attribute>

Example invocation:
./versitygw -a myaccess -s mysecret posix --sidecar /tmp/sidecar /tmp/gw

The attributes are stored by name within the hidden directory.
@benmcclelland benmcclelland merged commit 5e35f89 into main Jan 9, 2025
26 checks passed
@benmcclelland benmcclelland deleted the ben/sidecar_meta branch January 9, 2025 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants