Onyx-Protocol / Onyx

Onyx
https://Onyx.org
GNU Affero General Public License v3.0
1.79k stars 362 forks source link

net/raft: add unit test for node restart #1381

Closed vickiniu closed 7 years ago

vickiniu commented 7 years ago

Adds unit tests and a fix for restarting a node in a cluster. Previously, restarting the initial node in a cluster would segfault since there was no snapshot to restore from.

Now, we trigger snapshot while initializing a raft cluster to ensure that we can always restart nodes without errors.

vickiniu commented 7 years ago

PTAL :)

jbowens commented 7 years ago

👀

jbowens commented 7 years ago

Previously, restarting the initial node in a cluster would segfault since there was no snapshot to restore from.

Was this true in general or just in the net/raft tests? We produce snapshots pretty infrequently, so when you run a local cored and restart it, most likely it has no snapshot and is booting solely from the write ahead log. That makes me wonder if the bug might be in the state_test.go State implementation.

jbowens commented 7 years ago

lgtm