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

osd: dissect and abstract RMWPipeline from ECBackend for sharing it with crimson #52211

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

rzarzynski
Copy link
Contributor

Contribution Guidelines

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

@rzarzynski rzarzynski requested a review from a team as a code owner June 27, 2023 14:33
@github-actions github-actions bot added the core label Jun 27, 2023
Copy link
Contributor

@athanatos athanatos left a comment

Choose a reason for hiding this comment

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

Seems reasonable, let's use a Op::Ref or Ref rather than explicitly using std::unique_ptr each time, though.

#define dout_prefix _prefix(_dout, this)
//#define DOUT_PREFIX_ARGS this
//#undef dout_prefix
//#define dout_prefix _prefix(_dout, this)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the overload:

static ostream& _prefix(std::ostream *_dout, ECBackend::RMWPipeline *rmw_pipeline) {

&committed_to=this->committed_to,
&tid_to_op_map=this->tid_to_op_map,
cct=(CephContext*)nullptr
] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just squash this into the prior commit? It's not particularly useful for review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will squash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Squashed.

@@ -1161,30 +1161,30 @@ void ECBackend::handle_sub_write_reply(
const ECSubWriteReply &op,
const ZTracer::Trace &trace)
{
map<ceph_tid_t, Op>::iterator i = rmw_pipeline.tid_to_op_map.find(op.tid);
map<ceph_tid_t, std::unique_ptr<Op>>::iterator i = rmw_pipeline.tid_to_op_map.find(op.tid);
Copy link
Contributor

Choose a reason for hiding this comment

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

Op::ref or Ref?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to OpRef.

@@ -1557,7 +1593,10 @@ void ECBackend::submit_transaction(
)
{
ceph_assert(!rmw_pipeline.tid_to_op_map.count(tid));
Op *op = &(rmw_pipeline.tid_to_op_map[tid]);
auto concete_op = std::make_unique<ECClassicalOp>();
Copy link
Contributor

Choose a reason for hiding this comment

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

concrete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

std::set<hobject_t> *temp_added,
std::set<hobject_t> *temp_removed,
DoutPrefixProvider *dpp,
const ceph_release_t require_osd_release) override
Copy link
Contributor

Choose a reason for hiding this comment

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

final?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

DoutPrefixProvider *dpp,
const ceph_release_t require_osd_release) override
{
if (t) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can t actually be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's already dereferencec without extra checks.

@@ -1572,8 +1611,23 @@ void ECBackend::submit_transaction(
if (client_op) {
op->trace = client_op->pg_trace;
}
op->plan = ECTransaction::get_write_plan(
Copy link
Contributor

Choose a reason for hiding this comment

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

For symmetry, seems like get_write_plan should also be a an ECBackend::Op method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a static wrapper.

return plan;
}

void generate_transactions(
PGTransaction* _t,
Copy link
Contributor

Choose a reason for hiding this comment

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

We assert non-null, probably better to pass as a reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a new commit for that.

get_osdmap()->require_osd_release);
}
op->generate_transactions(
op->plan,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably remove the members from the param list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
@rzarzynski rzarzynski force-pushed the wip-crimson-ec-classical-refactor branch from a14ca6a to c5fbf12 Compare July 6, 2023 19:49
@rzarzynski rzarzynski requested a review from athanatos July 6, 2023 19:51
@rzarzynski
Copy link
Contributor Author

@athanatos: would you mind taking another look?

return ECTransaction::get_write_plan(
sinfo,
t,
std::move(get_hinfo),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

std::forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@rzarzynski rzarzynski force-pushed the wip-crimson-ec-classical-refactor branch from c5fbf12 to 7f44047 Compare July 6, 2023 20:04
@@ -1556,22 +1556,21 @@ struct ECClassicalOp : ECBackend::RMWPipeline::Op {
DoutPrefixProvider *dpp,
const ceph_release_t require_osd_release) final
{
if (t) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I think I discovered where the t-empty ops are born:

bool ECBackend::RMWPipeline::try_finish_rmw()
{
  // ...
    if (get_osdmap()->require_osd_release >= ceph_release_t::kraken) {
      if (op->version > get_parent()->get_log().get_can_rollback_to() &&
          waiting_reads.empty() &&
          waiting_commit.empty()) {
        // submit a dummy transaction to kick the rollforward
        auto tid = get_parent()->get_tid();
        Op *nop = &(tid_to_op_map[tid]);
        nop->hoid = op->hoid;
        nop->trim_to = op->trim_to;
        nop->roll_forward_to = op->version;
        nop->tid = tid;
        nop->reqid = op->reqid;
        waiting_reads.push_back(*nop);
      }

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. Ok, add a comment to that effect so that future readers won't be confused.

1. `WritePlan` doesn't hold `PGTransactionUPtr` anymore.
2. `Op` (soon `RMWPipeline::Op`) gets dynamically polymorphic
   `generate_transaction()`. The classical OSD implements this
   interface with `ECClassicalOp` which hosts `PGTransaction`.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
The intention behind this refactor is to emphasize that:
  1. callers of `start_rmw()` are supposed to create any
     concrete type of `RMWPipeline::Op`.
  2. `RMWPipeline` operates solely on the abstract `Op`
     and control its life-time.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
@rzarzynski
Copy link
Contributor Author

jenkins test api

@ljflores
Copy link
Contributor

ljflores commented Sep 8, 2023

@ljflores ljflores merged commit 81c209d into ceph:main Sep 8, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants