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

Add update object metadata API #8253

Merged
merged 8 commits into from
Oct 1, 2024

Conversation

arielshaqed
Copy link
Contributor

This is an experimental feature. When reviewing please comment about its usability, but focus mainly on correctness.

The code in the controller re-uses an existing physical address, which is supposedly a no-no. However this case is fine: the physical address is used by the same object being updated. So the only way for UGC to remove it would be to lose these races:

  • Thread 1 gets object metadata
  • Thread 2 deletes the object
  • 👉🏽 Thread 3 performs UGC and cleans up the physical object
  • Thread 1 writes a new entry for the object with the same physical address
    Thread 3 is UGC so it only cleans up objects that were abandoned several hours ago. Our UGC model allows us to lose the object in this (extreme) case - this is not a new lossage.

Fixes #8251.

@arielshaqed arielshaqed requested review from N-o-Z and ozkatz September 30, 2024 16:49
@arielshaqed
Copy link
Contributor Author

@ozkatz for API

(@N-o-Z for API and correctness and code and ..., of course)

Copy link

github-actions bot commented Sep 30, 2024

♻️ PR Preview 9a17670 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@arielshaqed arielshaqed added area/cataloger Improvements or additions to the cataloger area/API Improvements or additions to the API include-changelog PR description should be included in next release changelog labels Sep 30, 2024
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

E2E Test Results - Quickstart

11 passed

Copy link
Collaborator

@ozkatz ozkatz left a comment

Choose a reason for hiding this comment

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

Looks great to me! Just wondering on 201 successful response for a PUT request

schema:
$ref: "#/components/schemas/UpdateObjectUserMetadata"
responses:
201:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is 201 Created customary for a PUT that updates an existing resource? (not asking that you'd change it, legitimately asking!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MDN says we're good:

If the target resource does have a current representation and that representation is successfully modified with the state in the request, the origin server must send either a 200 OK or a 204 No Content to indicate successful completion of the request

Here we're always on the modification flow, you cannot PUT this is the object doesn't exist.


var errExpectedKV = errors.New("expected <key>=<value>")

var fsUpdateUserMetadataCmd = &cobra.Command{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Going above and beyond!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Easiest way to develop the code:-)

Copy link
Contributor Author

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks!
@N-o-Z ... can you review or should I get someone else on this?

schema:
$ref: "#/components/schemas/UpdateObjectUserMetadata"
responses:
201:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MDN says we're good:

If the target resource does have a current representation and that representation is successfully modified with the state in the request, the origin server must send either a 200 OK or a 204 No Content to indicate successful completion of the request

Here we're always on the modification flow, you cannot PUT this is the object doesn't exist.


var errExpectedKV = errors.New("expected <key>=<value>")

var fsUpdateUserMetadataCmd = &cobra.Command{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Easiest way to develop the code:-)

@arielshaqed arielshaqed requested review from guy-har and removed request for N-o-Z October 1, 2024 06:43
@arielshaqed
Copy link
Contributor Author

@guy-har please review as I missed @N-o-Z' working hours 😭

Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks!

api/swagger.yml Outdated
- objects
- experimental
operationId: updateObjectUserMetadata
summary: update object metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should mention this will override the current metadata

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

Copy link
Contributor Author

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks, pulling...

api/swagger.yml Outdated
- objects
- experimental
operationId: updateObjectUserMetadata
summary: update object metadata
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

@arielshaqed arielshaqed enabled auto-merge (squash) October 1, 2024 08:46
@arielshaqed arielshaqed merged commit 04b82c1 into master Oct 1, 2024
39 checks passed
@arielshaqed arielshaqed deleted the feature/8251-update-object-metadata branch October 1, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API Improvements or additions to the API area/cataloger Improvements or additions to the cataloger include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add API to update user metadata
3 participants