Skip to content

mds: find a new head for the batch ops when the head is dead#56941

Merged
vshankar merged 1 commit intoceph:mainfrom
lxbsz:wip-65536
May 16, 2024
Merged

mds: find a new head for the batch ops when the head is dead#56941
vshankar merged 1 commit intoceph:mainfrom
lxbsz:wip-65536

Conversation

@lxbsz
Copy link
Member

@lxbsz lxbsz commented Apr 17, 2024

If the batch head request is already dead and then we need to choose a new batch head anyways and release the reference for the current batch head request. Else it will be reported as slow request.

Fixes: https://tracker.ceph.com/issues/65536

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

@lxbsz lxbsz requested a review from a team April 17, 2024 08:00
@github-actions github-actions bot added the cephfs Ceph File System label Apr 17, 2024
@lxbsz lxbsz force-pushed the wip-65536 branch 3 times, most recently from ca8437a to e4f14a2 Compare April 17, 2024 09:37
Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

If the batch head request is already dead and then we need to choose
a new batch head anyways and release the reference for the current
batch head request. Else it will be reported as slow request.

Fixes: https://tracker.ceph.com/issues/65536
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Copy link
Contributor

@dparmar18 dparmar18 left a comment

Choose a reason for hiding this comment

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

LGTM

@vshankar
Copy link
Contributor

I'll run this through tests this week (was on PTO last week)

@lxbsz
Copy link
Member Author

lxbsz commented Apr 30, 2024

I'll run this through tests this week (was on PTO last week)

Sure, thanks @vshankar

vshankar added a commit to vshankar/ceph that referenced this pull request May 6, 2024
* refs/pull/56941/head:
	mds: find a new head for the batch ops when the head is dead

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Dhairya Parmar <dparmar@redhat.com>
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
@vshankar
Copy link
Contributor

vshankar commented May 9, 2024

https://pulpito.ceph.com/vshankar-2024-05-07_03:44:24-fs-wip-vshankar-testing-20240506.153513-testing-default-smithi/

(unfortunately, failed are infra issues related to cephadm - would need a rebuild)

@vshankar
Copy link
Contributor

vshankar commented May 9, 2024

This PR is under test in https://tracker.ceph.com/issues/65882.

@batrick
Copy link
Member

batrick commented May 16, 2024

jenkins test make check

@batrick
Copy link
Member

batrick commented May 16, 2024

jenkins test make check arm64

dout(10) << __func__ << ": dead " << *mdr << dendl;
//if the mdr is a "batch_op" and it has followers, pick a follower as
//the new "head of the batch ops" and go on processing the new one.
if (mdr->client_request && mdr->is_batch_head()) {
Copy link
Member

Choose a reason for hiding this comment

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

I understand why this works but it is weird not to select a new batch head in ::request_cleanup. I would have preferred that but I think this PR needs to be merged urgently. Maybe in a follow-up cleanup?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it really need ?

 2079 void Server::respond_to_request(const MDRequestRef& mdr, int r)
 2080 {
 2081   mdr->result = r;
 2082   if (mdr->client_request) {
 2083     if (mdr->is_batch_head()) {
 2084       dout(20) << __func__ << ": batch head " << *mdr << dendl;
 2085       mdr->release_batch_op()->respond(r);                                                                                                                                                                                                              
 2086     } else {
 2087      reply_client_request(mdr, make_message<MClientReply>(*mdr->client_request, r));
 2088     }
 2089   } else if (mdr->internal_op > -1) { 
 2090     dout(10) << __func__ << ": completing with result " << cpp_strerror(r) << " on internal " << *mdr << dendl;
 2091     auto c = mdr->internal_op_finish;   
 2092     if (!c)
 2093       ceph_abort_msg("trying to respond to internal op without finisher");
 2094     mdcache->request_finish(mdr);
 2095     c->complete(r);
 2096   }
 2097 }

We can see in Line#2085 it will cleanup all the batch requests when the batch head finishes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me have a check carefully and try to improve the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

@batrick please confirm that the if (dead) check only applies to internal requests, and can be moved after the client and peer conditional dispatches

Copy link
Member

Choose a reason for hiding this comment

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


We can see in Line#2085 it will cleanup all the batch requests when the batch head finishes.

In this case, Server::respond_to_request is not called because the request was killed (that's why dead == true). This logic for batch_head handling in ::respond_to_request and now MDCache::dispatch_request should be uniformly handled in a single location: MDCache::request_cleanup.

Copy link
Contributor

Choose a reason for hiding this comment

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

right, this is what @lxbsz had also figured out. So my question then is, shouldn't we just move that new if(dead) check into the else?

Copy link
Member

Choose a reason for hiding this comment

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

No, I think we need to make a better effort unify handling of requests in the MDS. A dead request should not be dispatched no matter its type.

Copy link
Member Author

Choose a reason for hiding this comment

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

@batrick But in the case when the sessions are killed and then all the corresponding requests will be marked killed too. Is that fine if we just remove the queued requests from the finisher queue directly ? If not then we cannot avoid this IMO, because the killed requests maybe still in the finisher queue and not dispatched yet.

But we can just choose a batch head directly when the a batch head request is being killed instead of doing this when the request is being dispatched.

Copy link
Member

Choose a reason for hiding this comment

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

@batrick But in the case when the sessions are killed and then all the corresponding requests will be marked killed too. Is that fine if we just remove the queued requests from the finisher queue directly ? If not then we cannot avoid this IMO, because the killed requests maybe still in the finisher queue and not dispatched yet.

I understand. I am probably being confusing. It's okay that a dead request is re-dispatched through MDCache::dispatch_request but if it's marked dead, do nothing else and return;.

But we can just choose a batch head directly when the a batch head request is being killed instead of doing this when the request is being dispatched.

Yes!

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try to improve it. Thanks @batrick @leonid-s-usov

Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

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

@batrick
Copy link
Member

batrick commented May 16, 2024

@vshankar
Copy link
Contributor

https://pulpito.ceph.com/?branch=wip-vshankar-testing-20240509.114851-debug

https://tracker.ceph.com/issues/65882

(Note @vshankar I like to link to the qa run ticket as it's a SSOT.)

Isn't that already done by ptl-tool when including a PR in a branch? Why relink it again? (If there are more than one QA trackers due to rebuild, etc., the last QA tracker linked is the SSOT).

@batrick
Copy link
Member

batrick commented May 17, 2024

https://pulpito.ceph.com/?branch=wip-vshankar-testing-20240509.114851-debug

https://tracker.ceph.com/issues/65882
(Note @vshankar I like to link to the qa run ticket as it's a SSOT.)

Isn't that already done by ptl-tool when including a PR in a branch? Why relink it again? (If there are more than one QA trackers due to rebuild, etc., the last QA tracker linked is the SSOT).

Well, actually, I like to link to the comment in the ticket where I approved the run which usually includes a link to the wiki for the full breakdown of failures. Sometimes a PR may also not have a comment linking to the ticket because it was added to a run after the QA ticket was already created; --update-qa does not add comments to PRs (to avoid spam).

(Ultimately this is just a nit but I thought I'd share my thinking on it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants