Skip to content

crimson/osd/object_context_loader: Simplify interface#56752

Closed
Matan-B wants to merge 8 commits intoceph:mainfrom
Matan-B:wip-matanb-crimson-obc-refactor
Closed

crimson/osd/object_context_loader: Simplify interface#56752
Matan-B wants to merge 8 commits intoceph:mainfrom
Matan-B:wip-matanb-crimson-obc-refactor

Conversation

@Matan-B
Copy link
Copy Markdown
Contributor

@Matan-B Matan-B commented Apr 8, 2024

Originated and blocked by: #56610
This PR includes comments, cleanups and improved readability to object_context_loader.

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

Matan-B added 7 commits April 8, 2024 08:08
Previously, only the head obc had ssc reference. Let clone obc
also reference it's head ssc.

Fixes: https://tracker.ceph.com/issues/65203
Fixes: https://tracker.ceph.com/issues/65201

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
…case

Resolve_oid on a clone object may actually return the head:
```
    // Because oid.snap > ss.seq, we are trying to read from a snapshot
    // taken after the most recent write to this object. Read from head.
```

In this case, with_clone_obc should apply `func` same as with_head_obc would have.
Meaning, with_clone_obc_only shouldn't not be called because there is no actual
clone object (yet).

Note: previously, with_clone_obc_only was called on the resolved head object.
While it didn't cause any errors, using the head_obc as clone is wrong.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
// Classic can load the obc using a given attrset, Crimson doesn't
// load obc using existing attrset yet (consults disk by default instead).

We already load the obc using `with_obc` without using `push_op.attrset`.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
ObjectContextLoader interface provides two variants:

* with_obc:
  // Use this variant by default
  // If oid is a clone object, the clone obc *and* it's
  // matching head obc will be locked and can be used in func.

* with_clone_obc_only:
  // Use this variant in the case where the head object
  // obc is already locked and only the clone obc is needed.
  // Avoid nesting with_head_obc() calls by using with_clone_obc()
  // with an already locked head.

with_clone_obc_direct variant is equal to with_obc on a clone obc
since both the head and the clone obcs will be locked and can be used.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
No change in behavior

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
No change in behavior, improved readability

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
SnapTrimObjSubEvent::remove_or_update partially resolves the to be
trimmed clone taking into account in_removed_snaps_queue.
The general resolve_oid is not suitable for this scenario.
Specifically the following check:
```
    if (std::find(
      citer->second.begin(),
      citer->second.end(),
      oid.snap) == citer->second.end()) {
       logger().debug("{} {} does not contain {} -- DNE",
                      __func__, ss.clone_snaps, oid.snap);
       return std::nullopt;
    }
```
because of earlier snap_map_modify call.

Example:
```
INFO  2024-04-07 13:44:01,118 [shard 0:main] osd - SnapTrimObjSubEvent(coid=2:e8855410:::folio011816418-576:8 snapid=8): 2:e8855410:::folio011816418-576:8 snaps [8, 7] -> {7}
DEBUG 2024-04-07 13:44:01,118 [shard 0:main] osd - snap_map_modify: soid 2:e8855410:::folio011816418-576:8, snaps {7}
...
This case will fail:
INFO  2024-04-07 13:44:04,139 [shard 0:main] osd - SnapTrimObjSubEvent(coid=2:e8855410:::folio011816418-576:8 snapid=7): 2:e8855410:::folio011816418-576:8 snaps [7] -> {} ... deleting
DEBUG 2024-04-07 13:44:04,139 [shard 0:main] osd - snap_map_remove: soid 2:e8855410:::folio011816418-576:8
```

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
@Matan-B Matan-B force-pushed the wip-matanb-crimson-obc-refactor branch from 302e6b9 to 93b0f0a Compare April 8, 2024 08:35
@Matan-B Matan-B marked this pull request as ready for review April 8, 2024 13:11
@Matan-B Matan-B requested a review from a team as a code owner April 8, 2024 13:11
@Matan-B
Copy link
Copy Markdown
Contributor Author

Matan-B commented Apr 8, 2024

jenkins test make check

@Matan-B
Copy link
Copy Markdown
Contributor Author

Matan-B commented Apr 10, 2024

Once #56610 is merged I'll go back to this PR. This component may also be a good candidate to use coroutines.

@Matan-B Matan-B added the DNM label Apr 10, 2024
@Matan-B
Copy link
Copy Markdown
Contributor Author

Matan-B commented Apr 21, 2024

Some of the changes here are essential for #56610. Moving back and closing.
@xxhdx1985126, all comments are addressed there.

@Matan-B Matan-B closed this Apr 21, 2024
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.

2 participants