mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: re-remove clusterId from raft
This commit is contained in:
parent
134a962222
commit
4aa15294a8
@ -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) {
|
func (l *raftLog) snap(d []byte, index, term int64, nodes []int64) {
|
||||||
l.snapshot = Snapshot{clusterId, d, nodes, index, term}
|
l.snapshot = Snapshot{d, nodes, index, term}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *raftLog) shouldCompact() bool {
|
func (l *raftLog) shouldCompact() bool {
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user