-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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 ErrCompacted errors for Compact in raftexample #16423
Handle ErrCompacted errors for Compact in raftexample #16423
Conversation
a133deb
to
8cf15c7
Compare
@chenyang8094 Thanks for the patch. For the DCO requirement, you need to |
8cf15c7
to
c28eb3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @chenyang8094 - Thanks for proposing this change.
Please be aware we are planning to remove contrib/raftexample
from etcd.
There is an issue etcd-io/raft#2 to implement a self-contained raft example in the raft repo which has been worked on.
I'm not necessarily opposed to merging this, just making you aware of the other work underway. Will leave final merge decision to maintainers.
@jmhbnz Thanks for the tip, I see it. IIUC, there seems to be a lot more to this work. raftexample is a great code for learning etcd/raft, let's improve it together. |
Hey @chenyang8094 as mentioned above, I am not opposed to merging this, the code change looks ok to me, however it is now up to maintainers if they agree. @ahrtr WDYT? |
Please |
04a39b9
to
e6027df
Compare
Could you squash the commits? |
Signed-off-by: Chen Yang <[email protected]> Signed-off-by: chenyangyang.cy <[email protected]>
e6027df
to
68db708
Compare
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It matchs how etcd processes the compact.
etcd/server/etcdserver/server.go
Lines 2136 to 2138 in 6ef9c53
if err == raft.ErrCompacted { | |
return | |
} |
When I adjust the value of
defaultSnapshotCount
to be smaller thansnapshotCatchUpEntriesN
in raftexample, because thecompactIndex
cannot be updated, a panic will occur when the snapshot is triggered for the second time, and the error is "panic: requested index is unavailable due to compaction".This PR adds ErrCompacted error handling for Compact (keep consistent with etcd server).