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

Handle FSM.Apply errors in Server.raftApply to avoid missing the error #9970

Closed
dnephin opened this issue Apr 5, 2021 · 0 comments · Fixed by #9991
Closed

Handle FSM.Apply errors in Server.raftApply to avoid missing the error #9970

dnephin opened this issue Apr 5, 2021 · 0 comments · Fixed by #9991

Comments

@dnephin
Copy link
Contributor

dnephin commented Apr 5, 2021

Almost everywhere we call Server.raftApply we have this same code to unpack an error out of the response:

if respErr, ok := resp.(error); ok {
    err = respErr
}

This is because FSM errors are reported from ApplyFuture.Response and only raft errors come from ApplyFuture.Error.

In some cases we completely ignore the response from the future, which would result in missing any errors returned by the FSM.Apply. Generally we want to log or return these errors so that the user knows something failed.

By handling the response error in Server.raftApply we can ensure that any error from the apply is always returned in the error response value, and we remove the need to check the response in every caller. We may be able to completely remove the response value, if the only use is unpacking this error.

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

Successfully merging a pull request may close this issue.

1 participant