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

mon: clear duplicated logic in MDSMonitor #11209

Merged
merged 1 commit into from Oct 11, 2016

Conversation

david-z
Copy link
Member

@david-z david-z commented Sep 23, 2016

Clear some duplicated logic in MDSMonitor when checking replacement for a failed MDS. It will make this part of logic more clear and readable.

Signed-off-by: Zhi Zhang zhangz.david@outlook.com

} else if (info.state == MDSMap::STATE_STANDBY_REPLAY ||
info.state == MDSMap::STATE_STANDBY) {
dout(10) << " failing and removing " << gid << " " << info.addr << " mds." << info.rank
<< "." << info.inc << " " << ceph_mds_state_name(info.state)
Copy link
Member

Choose a reason for hiding this comment

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

These cases were almost the same, but you've dropped the last_beacon.erase(gid); line. Did you check git logs to see how we got the duplicated cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gregsfortytwo Yes, I dropped last_beacon.erase(gid) because fail_mds_gid(gid) did this work here.

I checked git log and this duplicated case was introduced back to 2011. At that time this part made sense because the logic was a little different from now.

fail_mds_gid(gid);
*mds_propose = true;
} else if (!info.laggy()) {
if (!info.laggy()) {
Copy link
Member

Choose a reason for hiding this comment

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

Also this might as well be an "else if" block instead of nested else-if, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gregsfortytwo This was an "else if" back to 2011 and then changed to nested one. I think current logic looks good and can be easily understand. If it goes here, it means mds doesn't find a replacement and we can not ignore this mds no matter what current mds state is. We should record laggy_since once and report the warning.

The whole checking is almost based on mds state. If we pick up a branch to check whether mds is already laggy or not. I don't think the logic is better and more clear than current one.

What do you think? Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

@gregsfortytwo This was an "else if" back to 2011 and then changed to nested one. I think current logic looks good and can be easily understand. If it goes here, it means mds doesn't find a replacement and we can not ignore this mds no matter what current mds state is. We should record laggy_since once and report the warning.

The whole checking is almost based on mds state. If we pick up a branch to check whether mds is already laggy or not. I don't think the logic is better and more clear than current one.

What do you think? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

The last_beacon.erase part only made sense in the cases where we were actually removing an MDS. When we do last_beacon.erase for a GID that is laggy but staying in the map, it just gets replaced at the start of tick() next time (the "make sure last beacon is fully populated") section.

So I think you can delete that last_beacon.erase line, and then collapse the nested if into an else if as greg suggests

Copy link
Member Author

Choose a reason for hiding this comment

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

@jcsp yes, I looked through the code again and we can delay last_beacon.erase to the next tick().

@jcsp
Copy link
Contributor

jcsp commented Sep 29, 2016

@gregsfortytwo
Copy link
Member

Ping @david-z, looks like we're waiting on a few code changes from you. :)

@david-z
Copy link
Member Author

david-z commented Oct 9, 2016

@gregsfortytwo sorry for the late reply, I was on vacation in the past week.

Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
@david-z david-z force-pushed the wip-clear-dup-logic-mdsmonitor branch from c84719e to 85c3ca1 Compare October 9, 2016 03:39
@david-z
Copy link
Member Author

david-z commented Oct 9, 2016

@gregsfortytwo @jcsp Changes are made as you suggested. Pls help to review. Thanks.

@jcsp jcsp merged commit 9c2dac1 into ceph:master Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants