Skip to content

RGW: Remove RGWObjState and get_obj_state()/put_obj_state() from the SAL API - #57377

Merged
dang merged 2 commits into
ceph:mainfrom
dang:wip-dang-obj-state
May 31, 2024
Merged

dang merged 2 commits into
ceph:mainfrom
dang:wip-dang-obj-state

Conversation

@dang

@dang dang commented May 9, 2024 •

Copy link
Copy Markdown
Contributor

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@dang
dang requested a review from a team as a code owner May 9, 2024 16:24
@github-actions github-actions Bot added the rgw label May 9, 2024

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great

Comment thread src/rgw/driver/d4n/rgw_sal_d4n.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is the read-from-cache case, so i don't think we actually want to load anything from the backend here. can we call the setters below without this part?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I admit, I don't know. @samarahu do you have an opinion here? Do we need to load info from the backend or is it already in the object?

@pritha-srivastava pritha-srivastava May 10, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not needed in case of the read cache, because the attrs will anyway be fetched from the backend store (since the head/attrs are not being cached) and I believe get_obj_attrs() of the store anyway invokes get_obj_state internally.

But we need to get the object state in case of unified (write-back and read cache) where we are caching the head/attrs. If the block/object is not in the cache (could have been evicted/multipart object), we get the object from the cache get the object state, and store some state variables as part of the cached head as attrs (like object_size, mtime, epoch etc), and those attrs will be read back while reading the head in case of the next get and the the object state is set using set_obj_state. Setting the object state helps, because the ReadOp::prepare method can read the cached head now and the saved object state. The PR is is still in progress. I have a related scenario to discuss that I plan to bring up in the next d4n meeting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see that related getters/setters have been provided - they can be used in the PR that is in progress.

@samarahu samarahu May 10, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't believe this method call is integral to any of the upstreamed D4N functionality. I just added this code as a temporary implementation for handling attributes within D4N. As Pritha mentioned, she is working on this part of the unified single-node cache for the next PR and based on her most recent response, it seems we can remove the call to the get_obj_state method and replace it with specific getters and setters for handling the head metadata.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll leave this as is, and let you guys work it out in future work.

Comment thread src/rgw/rgw_sal_store.h Outdated
Comment on lines 85 to 86

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: name should be const ref

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this was copied from RGWObjState::get_attr(). I'll fix this.

Comment thread src/rgw/rgw_sal.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: name should be const ref

@mattbenjamin

Copy link
Copy Markdown
Contributor

I think aesthetically, get_obj_state() without the RGWObjState* parameter is preferable to load_obj_state(); we never had "load" operations in the codebase prior to this, and even in zipper, most code was using get_obj_state().

@dang

dang commented May 10, 2024

Copy link
Copy Markdown
Contributor Author

I think aesthetically, get_obj_state() without the RGWObjState* parameter is preferable to load_obj_state(); we never had "load" operations in the codebase prior to this, and even in zipper, most code was using get_obj_state().

My issue with this is that "get_foo" should return foo, and this is specifically not returning obj_state. "load_foo" has been added to the SAL api already in the form of "load_bucket" and "load_user", so that's why I picked this naming scheme.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@dang
dang force-pushed the wip-dang-obj-state branch from 7ef97a7 to 31fc0fb Compare May 15, 2024 14:23
@dang
dang force-pushed the wip-dang-obj-state branch from 31fc0fb to 78dc07f Compare May 21, 2024 15:14
dang added 2 commits May 28, 2024 12:22
RGWObjState is the state for the StoreObject class.  It has historically
been accessible via get_obj_state()/set_obj_state(), but the double
pointer nature of this access has caused multiple bugs, and the
RGWObjState itself is an implementation detail that doesn't need to be
exposed.

Instead, add a load_obj_state() that loads the state from the store, and
use proper getters/setters for the data.

Signed-off-by: Daniel Gryniewicz <[email protected]>
@dang
dang force-pushed the wip-dang-obj-state branch from 78dc07f to 7d4c878 Compare May 28, 2024 16:37
@dang

dang commented May 28, 2024

Copy link
Copy Markdown
Contributor Author

@cbodley

cbodley commented May 30, 2024

Copy link
Copy Markdown
Contributor

jenkins test windows

@dang
dang merged commit 63899d5 into ceph:main May 31, 2024
@dang
dang deleted the wip-dang-obj-state branch May 31, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants