diff --git a/migrate/etcd4.go b/migrate/etcd4.go index 17abb16ae..2a2d57881 100644 --- a/migrate/etcd4.go +++ b/migrate/etcd4.go @@ -29,6 +29,8 @@ import ( "github.com/coreos/etcd/wal/walpb" ) +const termOffset4to2 = 1 + func snapDir4(dataDir string) string { return path.Join(dataDir, "snapshot") } diff --git a/migrate/log.go b/migrate/log.go index 6d8081380..78fe9d6c9 100644 --- a/migrate/log.go +++ b/migrate/log.go @@ -498,7 +498,7 @@ func toEntry2(ent4 *etcd4pb.LogEntry, raftMap map[string]uint64) (*raftpb.Entry, } ent2 := raftpb.Entry{ - Term: ent4.GetTerm(), + Term: ent4.GetTerm() + termOffset4to2, Index: ent4.GetIndex(), Type: cmd4.Type2(), Data: data, diff --git a/migrate/snapshot.go b/migrate/snapshot.go index bea959ff2..cc071d643 100644 --- a/migrate/snapshot.go +++ b/migrate/snapshot.go @@ -195,7 +195,7 @@ func (s *Snapshot4) Snapshot2() *raftpb.Snapshot { Data: newState, Metadata: raftpb.SnapshotMetadata{ Index: s.LastIndex, - Term: s.LastTerm, + Term: s.LastTerm + termOffset4to2, ConfState: raftpb.ConfState{ Nodes: nodeList, },