eliben/raft

TestCrashAfterSubmit

dopeter opened this issue · 3 comments

I don't think this is a bug. Maybe it's a doubt.

image

if sleepMs(1) is commented , the test will be failure.

Because mechanism of goroutine will execute leaderSendAEs before leader crashed.

But environment is very complex , I don't think this is a clearness result.

3ks for your sharing & expecting answer.

Best regards.

Well, the idea is to submit the command to a leader before the leader actually crashes. The sleep avoids a race between the two events.

Yep, if sleep is existed, leader had sent log to follower before crashed.
If sleep isn't existed, leader had crashed before sent log to follower.

In my pc , along this way. haha.

So if sleep isn't existed, val 5 of log in this testing will not be stored in follower & testing will be failure.
I think this is an ambiguity.

I don't know how other implementation of Raft handle it , I'm so curious about it.

All right, 3ks.
I have read raft implement of etcd.
Commit is an action in raft state machine , apply is an action which executed by application.
Because in this project ,application is a simulation, so it's not depend on syncing successful here.

3ks for your answering & waiting myself solving.haha.