Browse Source

rafthttp: fix wrong stream name returned by pick

msgAppWriter uses streamAppV2 type, and it should return the correct name.
Yicheng Qin 10 years ago
parent
commit
33231fccdd
2 changed files with 2 additions and 3 deletions
  1. 1 2
      rafthttp/peer.go
  2. 1 1
      rafthttp/peer_test.go

+ 1 - 2
rafthttp/peer.go

@@ -45,7 +45,6 @@ const (
 	// to hold all proposals.
 	// to hold all proposals.
 	maxPendingProposals = 4096
 	maxPendingProposals = 4096
 
 
-	streamApp   = "streamMsgApp"
 	streamAppV2 = "streamMsgAppV2"
 	streamAppV2 = "streamMsgAppV2"
 	streamMsg   = "streamMsg"
 	streamMsg   = "streamMsg"
 	pipelineMsg = "pipeline"
 	pipelineMsg = "pipeline"
@@ -266,7 +265,7 @@ func (p *peer) pick(m raftpb.Message) (writec chan<- raftpb.Message, picked stri
 	if isMsgSnap(m) {
 	if isMsgSnap(m) {
 		return p.pipeline.msgc, pipelineMsg
 		return p.pipeline.msgc, pipelineMsg
 	} else if writec, ok = p.msgAppWriter.writec(); ok && canUseMsgAppStream(m) {
 	} else if writec, ok = p.msgAppWriter.writec(); ok && canUseMsgAppStream(m) {
-		return writec, streamApp
+		return writec, streamAppV2
 	} else if writec, ok = p.writer.writec(); ok {
 	} else if writec, ok = p.writer.writec(); ok {
 		return writec, streamMsg
 		return writec, streamMsg
 	}
 	}

+ 1 - 1
rafthttp/peer_test.go

@@ -35,7 +35,7 @@ func TestPeerPick(t *testing.T) {
 		{
 		{
 			true, true,
 			true, true,
 			raftpb.Message{Type: raftpb.MsgApp, Term: 1, LogTerm: 1},
 			raftpb.Message{Type: raftpb.MsgApp, Term: 1, LogTerm: 1},
-			streamApp,
+			streamAppV2,
 		},
 		},
 		{
 		{
 			true, true,
 			true, true,