mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2272 from yichengq/324
rafthttp: not send 0-entry MsgApp using stream
This commit is contained in:
@@ -194,6 +194,12 @@ func (s *streamWriter) handle(w WriteFlusher) {
|
||||
ew := newEntryWriter(w, s.to)
|
||||
defer ew.stop()
|
||||
for ents := range s.q {
|
||||
// Considering Commit in MsgApp is not recovered when received,
|
||||
// zero-entry appendEntry messages have no use to raft state machine.
|
||||
// Drop it here because it is useless.
|
||||
if len(ents) == 0 {
|
||||
continue
|
||||
}
|
||||
start := time.Now()
|
||||
if err := ew.writeEntries(ents); err != nil {
|
||||
log.Printf("rafthttp: encountered error writing to server log stream: %v", err)
|
||||
@@ -289,12 +295,6 @@ func (s *streamReader) handle(r io.Reader) {
|
||||
}
|
||||
return
|
||||
}
|
||||
// Considering Commit in MsgApp is not recovered, zero-entry appendEntry
|
||||
// messages have no use to raft state machine. Drop it here because
|
||||
// we don't have easy way to recover its Index easily.
|
||||
if len(ents) == 0 {
|
||||
continue
|
||||
}
|
||||
// The commit index field in appendEntry message is not recovered.
|
||||
// The follower updates its commit index through heartbeat.
|
||||
msg := raftpb.Message{
|
||||
|
||||
Reference in New Issue
Block a user