Repository navigation
mon: mark OSD beacons and pg_create messages as no_reply - #20517
Conversation
Fixes: http://tracker.ceph.com/issues/22114 Reported-by: Hongpeng Lu <[email protected]> Signed-off-by: Greg Farnum <[email protected]>
| auto m = static_cast<MOSDPGCreated*>(op->get_req()); | ||
| dout(10) << __func__ << " " << *m << dendl; | ||
| auto session = m->get_session(); | ||
| mon->no_reply(op); |
There was a problem hiding this comment.
both the leader and the proxy (peon) monitor will call this method when handling a pg-created. how about calling mon->no_reply(op) in OSDMonitor::prepare_pg_created() and OSDMonitor::prepare_beacon() instead ?
There was a problem hiding this comment.
Given the function itself even mentions (at the bottom) we "always forward" to the leader, then I agree with @tchaikov that we should have this only on the prepare functions (which are essentially only called on the leader), for both the pg create and the osd beacon.
There was a problem hiding this comment.
I considered it but actually don’t like that:
- marking it only in prepare means any future changes to the function that should apply to the follower mons won’t.
- you’ll notice there are some error cases where we actually handle the op in preprocess, and if that turns up in the leader but not the follower we will still leak. (Yes, this would indicate another bug as well, but still.)
- if we always mark no_reply in preprocess it’s less cognitive overhead to make sure it’s set correctly.
There was a problem hiding this comment.
marking it only in prepare means any future changes to the function that should apply to the follower mons won’t.
i don't follow you. mon->no_reply(op) will reply the proxy mon, which will in turn remove the the routed request from its routed_requests map. if there will be any future message which we don't need reply to the party who sent the request. we should call mon->no_reply(op) in the leader mon.
you’ll notice there are some error cases where we actually handle the op in preprocess, and if that turns up in the leader but not the follower we will still leak. (Yes, this would indicate another bug as well, but still.)
yeah, i did notice the error case handling in the preprocess. there are two cases
- it's the leader who received the original MOSDPGCreated message: since the message is not routed, it is not added to the
routed_requestsmap, and the message's life cycle is managed by MonOpRequestRef, which is able to take care of itself just fine, evenmon->no_reply()does nothing in this case other thanmark_event("no_reply"). - it's the peon who received the original MOSDPGCreated message: the message is routed, and it's added to the
routed_requestsmap. ifmon->no_reply(op)is called inOSDMonitor::prepare_pg_created()by the leader, the peon who forwarded the request will get an MRoute message. so no leak is caused.
if we always mark no_reply in preprocess it’s less cognitive overhead to make sure it’s set correctly.
well, i'd say it's a subjective assertion. my point is that no_reply() only takes effect on leader, and we only do prepare on leader. if we can reach a consensus on this, probably it would make more sense to call mon->no_reply() in the prepare methods.
There was a problem hiding this comment.
I mean that we may change the code in the future, so that no_reply() does something on follower monitors as well. In which case we'd have to change them.
And again, you're right that with the current error cases in preprocess, they will not bail out on the leader if the message was forwarded.
But the cost of calling no_reply() in preprocess is...very low. And putting it at the top of that function, instead of down in the bottom of the call stack where only the leader can see it, is a very simple way to practice defensive programming so that we don't leak forwarded messages due to changes in the future.
There was a problem hiding this comment.
okay, but i'd prefer reasoning based on what we have instead of the hypotheses.
There was a problem hiding this comment.
This is reasoning based on what we have. It is simple and obviously correct. You are trying to optimize away a function call on a path that involves passing multiple messages over the wire, because you have chased down at least three different things that must be true for that optimization to be safe and determined that they are. It’s a false economy.
There was a problem hiding this comment.
eh, this kind of blew out of proportion; but given @gregsfortytwo's arguments a wee-bit above, I kinda agree with him. We are losing nothing by marking the op no_reply() early in preprocess, afaict, and we are ensuring that the proxy mon gets to drop its routed request as soon as possible. The only thing that tickles me the wrong way, but it's objectively irrelevant I think, is that we are replying to a message (in this case to the proxy mon) before the message has been handled, which is not the way we typically do things in the monitor and likely why we have been preferring replying at a later stage in the function call instead of at the beginning.
| auto m = static_cast<MOSDPGCreated*>(op->get_req()); | ||
| dout(10) << __func__ << " " << *m << dendl; | ||
| auto session = m->get_session(); | ||
| mon->no_reply(op); |
There was a problem hiding this comment.
Given the function itself even mentions (at the bottom) we "always forward" to the leader, then I agree with @tchaikov that we should have this only on the prepare functions (which are essentially only called on the leader), for both the pg create and the osd beacon.
|
Jenkins test this please |
see also: ceph#20517 Fixes: http://tracker.ceph.com/issues/22114 Signed-off-by: Kefu Chai <[email protected]> (cherry picked from commit 0daccfb)
Fixes: http://tracker.ceph.com/issues/22114
Reported-by: Hongpeng Lu [email protected]
Signed-off-by: Greg Farnum [email protected]