goraft / raft

UNMAINTAINED: A Go implementation of the Raft distributed consensus protocol.
MIT License
2.43k stars 480 forks source link

fix(server.go) fix data race between func LogEntries and func appendEntry #217

Closed xiang90 closed 10 years ago

xiang90 commented 10 years ago

The append function in appendEntry might change the value of the slice pointer when it wants to grow the capacity of the slice. We are not protecting the content of the slice, since the LogEntries func is just used for internal testing. The main reason of this pull request is to make the race detector happy during the testing.

xiang90 commented 10 years ago

/cc @unihorn I further clarify the problem for you in the commit message.

yichengq commented 10 years ago

If it make the detector happy, lgtm then.