Merge pull request #1890 from yichengq/259

raft: set raft.Commit too when setting raftLog.committed
This commit is contained in:
Yicheng Qin 2014-12-09 11:28:05 -08:00
commit 0472ddf05f
2 changed files with 1 additions and 4 deletions

View File

@ -943,10 +943,6 @@ func TestTriggerSnap(t *testing.T) {
ctx := context.Background()
s := raft.NewMemoryStorage()
n := raft.StartNode(0xBAD0, mustMakePeerSlice(t, 0xBAD0), 10, 1, s)
rd := <-n.Ready()
s.Append(rd.Entries)
n.Advance()
n.ApplyConfChange(raftpb.ConfChange{Type: raftpb.ConfChangeAddNode, NodeID: 0xBAD0})
n.Campaign(ctx)
st := &storeRecorder{}
p := &storageRecorder{}

View File

@ -153,6 +153,7 @@ func StartNode(id uint64, peers []Peer, election, heartbeat int, storage Storage
// TODO(bdarnell): These entries are still unstable; do we need to preserve
// the invariant that committed < unstable?
r.raftLog.committed = r.raftLog.lastIndex()
r.Commit = r.raftLog.committed
// Now apply them, mainly so that the application can call Campaign
// immediately after StartNode in tests. Note that these nodes will
// be added to raft twice: here and when the application's Ready