raft: re-remove clusterId from raft

This commit is contained in:
Blake Mizerany 2014-08-24 20:11:24 -07:00 committed by Yicheng Qin
parent 134a962222
commit 4aa15294a8
3 changed files with 2 additions and 7 deletions

View File

@ -175,8 +175,8 @@ func (l *raftLog) compact(i int64) int64 {
return int64(len(l.ents))
}
func (l *raftLog) snap(d []byte, clusterId, index, term int64, nodes []int64) {
l.snapshot = Snapshot{clusterId, d, nodes, index, term}
func (l *raftLog) snap(d []byte, index, term int64, nodes []int64) {
l.snapshot = Snapshot{d, nodes, index, term}
}
func (l *raftLog) shouldCompact() bool {

View File

@ -792,7 +792,6 @@ func TestRecvMsgBeat(t *testing.T) {
func TestRestore(t *testing.T) {
s := Snapshot{
ClusterId: 0xBEEF,
Index: defaultCompactThreshold + 1,
Term: defaultCompactThreshold + 1,
Nodes: []int64{0, 1, 2},
@ -803,9 +802,6 @@ func TestRestore(t *testing.T) {
t.Fatal("restore fail, want succeed")
}
if sm.clusterId != s.ClusterId {
t.Errorf("sm.cluster = %x, want %x", sm.clusterId, s.ClusterId)
}
if sm.raftLog.lastIndex() != s.Index {
t.Errorf("log.lastIndex = %d, want %d", sm.raftLog.lastIndex(), s.Index)
}

View File

@ -3,7 +3,6 @@ package raft
var emptySnapshot = Snapshot{}
type Snapshot struct {
ClusterId int64
Data []byte
// the configuration
Nodes []int64