fix(join safty) only allow commit to the most recent join command if there is one

pull/820/head
Xiang Li 2014-04-14 17:03:05 -04:00
parent 047192edb1
commit d2d1e26bb7
1 changed files with 9 additions and 0 deletions

9
log.go
View File

@ -379,6 +379,15 @@ func (l *Log) setCommitIndex(index uint64) error {
entry.event.returnValue = returnValue
entry.event.c <- err
}
_, isJoinCommand := command.(JoinCommand)
// we can only commit up to the most recent join command
// if there is a join in this batch of commands.
// after this commit, we need to recalculate the majority.
if isJoinCommand {
return nil
}
}
return nil
}