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

DAOS-17106 swim: Never change self_id #15929

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jxiong
Copy link
Contributor

@jxiong jxiong commented Feb 18, 2025

In the current implementation of DAOS, when it fails to select a dping target, it will set its self_id to SWIM_ID_INVALID and from now on, the node is not fully functional because only swim_updates_short() will be invoked to respond to PING and IPING request. Once the node enters into this state, it can not be restored.

This PR fixes the problem by not setting the self_id to SWIM_ID_INVALID if it won't be able to find a dping target. It's simply not necessary.

Change-Id: I4a2dad9aeb0571f938a84a97a9e29868a33b01a1

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate owners.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

In the current implementation of DAOS, when it fails to select a dping
target, it will set its self_id to SWIM_ID_INVALID and from now on,
the node is not fully functional because only swim_updates_short() will
be invoked to respond to PING and IPING request. Once the node enters
into this state, it can not be restored.

This PR fixes the problem by setting the self_id to SWIM_ID_INVALID if
it won't be able to find a dping target.

Change-Id: I4a2dad9aeb0571f938a84a97a9e29868a33b01a1
Signed-off-by: Jinshan Xiong <[email protected]>
@jxiong jxiong requested review from a team as code owners February 18, 2025 18:25
@jxiong jxiong requested review from liw and removed request for a team February 18, 2025 18:25
@@ -924,8 +924,7 @@ swim_progress(struct swim_context *ctx, int64_t timeout_us)
ctx->sc_next_event = ctx->sc_deadline;
ctx_state = SCS_PINGED;
} else {
if (ctx->sc_next_tick_time < ctx->sc_next_event)
ctx->sc_next_event = ctx->sc_next_tick_time;
ctx->sc_next_event = MIN(ctx->sc_next_event, ctx->sc_next_tick_time);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liw I don't really understand the usage of sc_next_tick_time, can you please explain it for me?

Copy link

Ticket title is 'SWIM enters into a weird state and never restores'
Status is 'Open'
https://daosio.atlassian.net/browse/DAOS-17106

if (ctx->sc_next_tick_time < ctx->sc_next_event)
ctx->sc_next_event = ctx->sc_next_tick_time;
ctx->sc_next_event =
MIN(ctx->sc_next_event, ctx->sc_next_tick_time);
Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Shall we refrain from making not-strictly-necessary changes, please? I find my brain converts this MIN into the original if structure before it understands what it is happening---this surprises me.

Copy link
Contributor Author

@jxiong jxiong Feb 20, 2025

Choose a reason for hiding this comment

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

This is just better code, IMO.
For the original code, you have to look into what is being compared and what is being assigned to understand what it is doing. I found it sometime difficult to understand.

Therefore, I take this change as an improvement but not 'not-strictly-necessary'; because it will help the other folks understand the code easier.

}
break;
case SCS_SELECT:
ctx->sc_target = ctx->sc_ops->get_dping_target(ctx);
if (ctx->sc_target == SWIM_ID_INVALID) {
swim_ctx_unlock(ctx);
D_GOTO(out, rc = -DER_SHUTDOWN);
Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Since this is the only place generating DER_SHUTDOWN in src/cart, I wonder if removing it allows us to remove some of the code that handles this DER_SHUTDOWN in src/cart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a good idea. Will fix it.

}
break;
case SCS_SELECT:
ctx->sc_target = ctx->sc_ops->get_dping_target(ctx);
if (ctx->sc_target == SWIM_ID_INVALID) {
swim_ctx_unlock(ctx);
D_GOTO(out, rc = -DER_SHUTDOWN);
ctx->sc_next_event = now + swim_period_get();
Copy link
Contributor

Choose a reason for hiding this comment

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

Although I'm not totally clear about how sc_next_event and sc_next_tick_time work, most other places in swim carefully prevent pushing sc_next_event into a future timestamp. This makes me wonder:

  • If we go to out in this case, there's a risk that next time swim_progress is called, we might be (hopefully) a bit pass sc_next_event (which might not be a big deal?).
  • If we leave sc_next_event as it is and continue the loop, will there be any problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sc_next_event is clearly defined which is the next time the swim should be scheduled. sc_next_tick_time seems to be just a copy of it but it's not well maintained or just a variable with bad name.

I don't see an issue to change sc_next_event though. And if we don't break, it will just have loop until the previous deadline comes. I tend to think the current fix is fine regarding this issue.

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

Successfully merging this pull request may close these issues.

2 participants