Browse Source

raft: re-remove clusterId from raft

Blake Mizerany 11 years ago
parent
commit
4aa15294a8
3 changed files with 2 additions and 7 deletions
  1. 2 2
      raft/log.go
  2. 0 4
      raft/raft_test.go
  3. 0 1
      raft/snapshot.go

+ 2 - 2
raft/log.go

@@ -175,8 +175,8 @@ func (l *raftLog) compact(i int64) int64 {
 	return int64(len(l.ents))
 	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 {
 func (l *raftLog) shouldCompact() bool {

+ 0 - 4
raft/raft_test.go

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

+ 0 - 1
raft/snapshot.go

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