Thanks for patch V3. Some more comments.
21.1 There is no need to put requestTypeId in the constructor. We know the constant of the request Id.
21.2 There is no need to put requestId in write(). This will be done in BoundedByteBufferSend. See how a FetchRequest is serialized and sent to socket.
21.3 The above comments apply to StopReplicaRequest too.
21.4 In constructor, leaderAndISRInfos should be just a Map, not a mutable.HashMap.
21.5 To be consistent, let's use leaderEpoc, instead of leaderGenId (see the updated protocol in the wiki).
22.1 The patch doesn't follow the protocol design in the wiki. Is there a reason?
23. Currently, for each type of Response, we have a customized ResponseSend object. Those ResponseSend objects all share the same pattern: writing a header and then the content. It would be good if we can consolidate those ResponseSend objects. The only exception is the response for Fetch request, which uses the sendfile API and has to be customized.
The response shouldn't return dummyTopic. Instead, it should just return NoError for each (topic,partition) in the request.
25. Unit test:
Let's add a unit test that tests the end-to-end RPC protocol for the new requests, similar to BackwardsCompatibilityTest.testProtocolVersion0().
In the new patch, it would be great if you can respond to each of the review comments (whether you agree and have fixed it, or you have a different idea, etc).