Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsqd: bench=BenchmarkProtocolV2Sub256 panics #617

Merged
merged 1 commit into from Aug 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions nsqd/protocol_v2_test.go
Expand Up @@ -100,7 +100,6 @@ func readValidate(t *testing.T, conn io.Reader, f int32, d string) []byte {
resp, err := nsq.ReadResponse(conn)
equal(t, err, nil)
frameType, data, err := nsq.UnpackResponse(resp)
t.Logf("%v %s %s", frameType, data, err)
equal(t, err, nil)
equal(t, frameType, f)
equal(t, string(data), d)
Expand Down Expand Up @@ -1582,7 +1581,7 @@ func subWorker(n int, workers int, tcpAddr *net.TCPAddr, topicName string, rdyCh
if err != nil {
panic(err.Error())
}
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriterSize(conn, 65536))

identify(nil, conn, nil, frameTypeResponse)
sub(nil, conn, topicName, "ch")
Expand All @@ -1593,8 +1592,6 @@ func subWorker(n int, workers int, tcpAddr *net.TCPAddr, topicName string, rdyCh
nsq.Ready(rdyCount).WriteTo(rw)
rw.Flush()
num := n / workers
numRdy := num/rdyCount - 1
rdy := rdyCount
for i := 0; i < num; i++ {
resp, err := nsq.ReadResponse(rw)
if err != nil {
Expand All @@ -1612,11 +1609,10 @@ func subWorker(n int, workers int, tcpAddr *net.TCPAddr, topicName string, rdyCh
panic(err.Error())
}
nsq.Finish(nsq.MessageID(msg.ID)).WriteTo(rw)
rdy--
if rdy == 0 && numRdy > 0 {
nsq.Ready(rdyCount).WriteTo(rw)
rdy = rdyCount
numRdy--
if (i+1)%rdyCount == 0 || i+1 == num {
if i+1 == num {
nsq.Ready(0).WriteTo(conn)
}
rw.Flush()
}
}
Expand Down