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

Add AllowInvariantViolations config, commit index regression test and… #53

Conversation

CaojiamingAlan
Copy link
Contributor

Attempt to resolve part of etcd-io/etcd#10166, #18, and #29.
IMHO it is hard to keep backwards compatible while introducing event-based log, since it will require the users to implement the new Event method in the log interface if they have implemented their own loggers.
Therefore, this commit only tries to introduce a new config option AllowInvariantViolation. If enabled, raft will try to recover from the commit index regression problem described in the above issues, rather than panic directly. The approach is exactly the one used in #25. This may not be suitable for more complex situations e.g. when leader transfer is happening, but is enough for simple case like the one in the test.
I'm very willing to discuss more about this.

… a naive recovery method.

Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
@tbg tbg requested a review from pav-kv May 26, 2023 14:25
// a naive approach to recover from the panic: send a pb.MsgHeartbeatResp with a reject hint,
// forcing the leader to retransmit the entries.
defer func() {
if v := recover(); v != nil {
Copy link

Choose a reason for hiding this comment

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

imo adding recover adds more complexity. #25 (comment) suggested different approach: default logger would panic but users could define a logger that would just log the event and keep going

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am closing this PR. I was relatively new to this repo when I tried to contribute. Now I don't think this is a good approach either. Thanks.

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

Successfully merging this pull request may close these issues.

2 participants