etcdserver: do not send out out of date appResp

This commit is contained in:
Xiang Li
2016-04-09 23:30:00 -07:00
parent 345bdc3db6
commit de7692b2b2

View File

@@ -938,11 +938,20 @@ func (s *EtcdServer) publish(timeout time.Duration) {
// TODO: move this function into raft.go
func (s *EtcdServer) send(ms []raftpb.Message) {
for i := range ms {
sentAppResp := false
for i := len(ms) - 1; i >= 0; i-- {
if s.cluster.IsIDRemoved(types.ID(ms[i].To)) {
ms[i].To = 0
}
if ms[i].Type == raftpb.MsgAppResp {
if sentAppResp {
ms[i].To = 0
} else {
sentAppResp = true
}
}
if ms[i].Type == raftpb.MsgSnap {
// There are two separate data store: the store for v2, and the KV for v3.
// The msgSnap only contains the most recent snapshot of store without KV.