Skip to content

Commit

Permalink
MB-30072: Respond to DCP_NOOP immediately, in projector dcp consumer
Browse files Browse the repository at this point in the history
DCP_NOOP message is used for keeping alive the connection between
dcp producer and dcp consumer. If DCP_NOOP is added to receive channel,
it will have to wait for all other events in the receive channel to
be processed, before consumer can repond to it. If this takes more
time than dcp noop interval, producer will wrongly close the connection.
To avoid this, respond to DCP_NOOP immediately, without adding
it to receive channel.

Change-Id: I0c4d540e48ad4ecfbd4d380dd209499f09ff626b
  • Loading branch information
amithk committed Jun 15, 2018
1 parent 8d0427c commit 2e56e3d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions secondary/dcp/transport/client/dcp_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,19 +294,6 @@ func (feed *DcpFeed) handlePacket(

sendAck := false
prefix := feed.logPrefix
if pkt.Opcode == transport.DCP_NOOP {
noop := &transport.MCResponse{
Opcode: transport.DCP_NOOP, Opaque: pkt.Opaque,
}
if err := feed.conn.TransmitResponse(noop); err != nil {
logging.Errorf("%v NOOP.Transmit(): %v", prefix, err)
} else {
fmsg := "%v responded to NOOP ok ...\n"
logging.Tracef(fmsg, prefix)
}
return "ok" // for NOOP, bytes are not counted for for buffer-ack
}

stream := feed.vbstreams[vb]
if stream == nil {
feed.stats.TotalSpurious++
Expand Down Expand Up @@ -1102,6 +1089,21 @@ loop:
break loop
}

// Immediately respond to NOOP and listen for next message.
// NOOPs are not accounted for buffer-ack.
if pkt.Opcode == transport.DCP_NOOP {
noop := &transport.MCResponse{
Opcode: transport.DCP_NOOP, Opaque: pkt.Opaque,
}
if err := feed.conn.TransmitResponse(noop); err != nil {
logging.Errorf("%v NOOP.Transmit(): %v", feed.logPrefix, err)
} else {
fmsg := "%v responded to NOOP ok ...\n"
logging.Tracef(fmsg, feed.logPrefix)
}
continue loop
}

logging.LazyTrace(func() string {
return fmt.Sprintf("%v packet received %#v", feed.logPrefix, logging.TagUD(pkt))
})
Expand Down

0 comments on commit 2e56e3d

Please sign in to comment.