-
Notifications
You must be signed in to change notification settings - Fork 168
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 Config.DisableProposalForwardingCallback for controlling message level proposal forwarding #88
base: main
Are you sure you want to change the base?
Conversation
|
The callback will be defined like this: https://github.com/etcd-io/etcd/pull/16285/files#diff-2f800da9d8120de4693c10b4171d1824f7382f7854c32f0666eb9e0241479a8dR529
Technically the mechanism of MsgProp (forwarding proposal from a follower to a leader) isn't a part of Raft I think (the spec of Raft doesn't include this IIRC). It's an implementation specific to this raft library. Also the mechanism works at outside of the consensus protocol so it might be safe to have the callback mechanism. But I understand your concern and need to double check the Raft paper for making sure about it. |
I checked the dissertation and section 6.2
According to this description, MsgProp (corresponding to 2) is an optional mechanism for Raft. So
I think this description is related to our lease revoking problem by a stale leader. In our case a client is etcd server itself, so a delayed lease revoke message will be forwarded to a leader and accepted. Anyway I'll try this change with the failpoint based testing when I have time. |
Related idea: I feel it might be good for controlling risks of new parameter of the Raft library by adding a new struct (e.g. I think we have a few candidate of such parameters like etcd-io/etcd#7782 |
…level proposal forwarding Signed-off-by: Hitoshi Mitake <[email protected]>
12b7737
to
ddd5443
Compare
A couple of points:
|
It seems not a problem, because it will be rejected by other nodes due to it's smaller term. |
Sorry let me check the entire of your doc later and reply in a few days @ahrtr . Let me reply to the below comment:
For MsgApp of LeaseRevoke, this is true. But before that MsgProp of LeaseRevoke is sent from the stale leader (etcd layer thinks itself as a leader but raft layer isn't), and it cannot be rejected because MsgProp doesn't have term information and it will be just forwarded to a new leader. I think this behavior is quite complicated so would like to write a doc including diagrams. |
This PR adds the new field
DisableProposalForwardingCallback
to the Config struct. The field is a pointer to callback function which takesraftpb.Message
. A follower node calls this callback when a state machine tries to submit aMsgProp
message. If the callback returns true based on the message, the follower node drops it and returnsErrProposalDropped
.If we pass a callback function which always returns true, the behavior of the Raft library will be same to the case of
DisableProposalForwarding
== true.The motivation is described in #73