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

HDDS-4580. Datanode can be stuck in leader not ready state after restart #1690

Merged
merged 2 commits into from Dec 14, 2020

Conversation

lokeshj1703
Copy link
Contributor

What changes were proposed in this pull request?

On restart the transactions are reapplied for an existing ratis pipeline. ContainerStateMachine#applyTransaction while processing future can throw NullPointerException leading to the future being completed exceptionally.

      future.thenApply(r -> {
        if (trx.getServerRole() == RaftPeerRole.LEADER) {
          long startTime = (long) trx.getStateMachineContext();
          metrics.incPipelineLatency(cmdType,
              Time.monotonicNowNanos() - startTime);
        }

In the above code snippet trx.getStateMachineContext() will be null during restart and this fails the future itself without updating the applyTransactionCompletionMap. As a result the lastAppliedIndex is not updated for the server and server is stuck in leader not ready state.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-4580

How was this patch tested?

Existing UT

@lokeshj1703 lokeshj1703 self-assigned this Dec 11, 2020
Copy link
Contributor

@xiaoyuyao xiaoyuyao left a comment

Choose a reason for hiding this comment

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

LGTM, +1.

@xiaoyuyao xiaoyuyao merged commit 81b75fd into apache:master Dec 14, 2020
jojochuang pushed a commit to jojochuang/ozone that referenced this pull request Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants