-
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
replace goraft #874
replace goraft #874
Conversation
I think it would be awesome if this RAFT implementation was go-gettable (ie; it's own github repo). Thanks for this work! |
@bmhatfield It will be go-gettable. Once merged, you can: |
Out of curiosity, can you summarize how this will be different than hashicorp/raft? |
Nice work. Is this still a WIP or complete? In a couple of tests I see a network abstraction ( I just glanced over the code though, might have missed something. |
Grats team! See you at strangeloop, @bmizerany ! |
I guess my question is: where and how will the network/transport be built and plugged against this? |
@divoxx This is a work-in-progress. The network and storage is done outside of etcd/raft. |
@divoxx like:
|
@peterbourgon The major points are stated in the body of this PR. To add to it: We want our implementation to be in Go and not have a hard dependency on a C library. |
@bmizerany Ah—I didn't know about the LMDB cgo thing! Thanks for that. |
@bmizerany interesting. I'm not sure what kind of transport are you guys going for but would be nice to have it as a standalone implementation (separate from etcd as well) to be also re-usable. Something like: import (
"net/http"
"github.com/coreos/etcd/rafthttp"
)
func main() {
// application sets up an m := http.ServeMux
s := rafthttp.NewServer(m)
log.Fatal(s.ListenAndServe())
} |
@divoxx We are working a clean and portable network/storage implement inside etcd. We do hope people can easily reuse that part of code or use it as an implementation reference. |
Perfect. Thanks @bmizerany and @xiangli-cmu |
} | ||
} | ||
|
||
// This function is full of heck now. It will go away when we finish our |
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.
I think we need to change this comment, @unihorn. :)
Just having a glance at this to see how it's getting on (I'm quite excited
but I get lots of errors like: I'm presuming there's a code generation step that I'm missing, but
|
@rogpeppe we have fixed the problem. you can try to build it again. |
I don't see any changes. The last commit I see on the raft branch is 0b2fdd6 from yesterday. |
@rogpeppe please try |
Ah, sorry. I expected all Go packages under that directory to be installable. My mistake. |
Remove testing on 11-node cluster due to lack of fds
When recovering from data dir, the node needs election timeout to elect itself to be the leader.
TestDiscoveryDownNoBackupPeersWithDataDir -> TestRunByDataDir remove TestDiscoveryRestart
…e taken inside step function.
raft: make tick send out messages.
wal: add basic crc
raft: remove configuration
wal: fix broken tests
coerce gogoproto files to import from third_party
wal: move pb files to walpb
snapshot: move pb to snappb; remove clusterId
@bmizerany r.bcastAppend() hi,what is the meaning of this line?And what will happen if we remove this line? thx! |
We - the etcd team - are working on a replacing goraft with a new raft implementation intended to live in the etcd codebase under etcd/raft. Our reasons for this are as follows:
After discussions with users and maintainers of the goraft library we decided that there were some core things that could only be achieved by starting fresh with a new API and tighter codebase:
Our proposed implementation abstracts the store, timing, and network away and leaves us with with a simple state-machine that can be used by other packages that implement their own transport and storage. Implementing a transport is an easier task when it isn't intertwined with the Raft state-machine.
The proposed implementation takes a new approach. It assumes messages can come out of order, so transports need not rely on careful bookkeeping. The new etcd/raft also avoids having a concept of a transport - it simply queues outgoing messages, and committable entires for the transport and storage systems to dequeue and save/send when ready.
By removing the dependency of wall-clock time we can write isolated, wait-free, and race-free unit tests that run in an amount of time measured in milliseconds.
Removing the knowledge of an explicit network allows us to - amongst other things - emulate network partitions and perform other types of fuzzing to prove correctness right in our unit tests as opposed to larger systems that require complicated test harnesess and iptables manipulation. That isn't to say the latter method isn't necessary for a complete picture, but being able to emulate most of the chaos you encounter in a real network in our unit tests allows us to catch regressions much, much faster.
Since Raft is so essential to etcd we felt that investing time and energy into making a better library with these two goals in mind is worth the effort. Please review the PR if you have the chance. We intend for this package to be useful for other projects, too. Also, if you have the need for a simple, pure Go Raft package in your application, please take a look.
I also want to give a huge thank you to Ben and Xiang who put in a ton of work to make github.com/goraft/raft happen. It has gotten etcd a long way. That said they both feel having a few implementations of such an important building block is OK and that new cleaner APIs are possible.