KAFKA-10842; Use InterBrokerSendThread for raft's outbound network channel#9732
KAFKA-10842; Use InterBrokerSendThread for raft's outbound network channel#9732hachikuji merged 10 commits intoapache:trunkfrom
InterBrokerSendThread for raft's outbound network channel#9732Conversation
There was a problem hiding this comment.
It seems like there are many classes where direct access to data is not actually needed. How do you feel about having a public method in RequestUtils that exposes data for the raft layer instead? Something like:
public static ApiMessage requestData(AbstractRequest req)
public static ApiMessage responseData(AbstractResponse resp)Or is it not worth it?
There was a problem hiding this comment.
Yeah, not sure it's worth it, though I don't feel strongly. I think ultimately we're going to start relying more on the generated classes to avoid unnecessary conversions. We're now entering "phase 2" of the request overhaul which means we can start figuring out how to remove the AbstractRequest/AbstractResponse layer. I think it will take more smarts in the generated classes to make a dent here, but if we are agreed on the goal (?), then I do not think preserving the encapsulation here is worthwhile.
There was a problem hiding this comment.
I don't quite understand how we would handle versioning well if we only have data classes. Do you have thoughts on that?
There was a problem hiding this comment.
Support for optional fields would go a long way I think. I am not sure it will be possible to remove all intermediate representations, but perhaps they can be the exception and not the rule. Some version checks in KafkaApis are probably inevitable.
There was a problem hiding this comment.
I can see this:
- AbstractRequest/AbstractResponse methods become part of the ApiMessage hierarchy.
- FooRequest/FooResponse extends FooDataRequest/FooDataResponse (like Colin suggested before)
But I don't think you want to eliminate FooRequest/FooResponse in the example above. You don't need to perform conversions for the inner classes, but it's a place where you can normalize the representation. We do that for many of the existing request/response classes.
0a83589 to
b5e476b
Compare
|
Just to reply #9732 (comment) here, |
|
@abbccdda To clarify, what we are asking is why the implementation of |
There was a problem hiding this comment.
Is it worth adding a size or isEmpty to UnsentRequests?
There was a problem hiding this comment.
nit: (related to style question elsewhere) if we want to change the style of these class definitions, can we do it as a separate PR? I always find it difficult when style changes are conflated with logical changes
There was a problem hiding this comment.
That's fair. I actually held myself back. I tried to only touch the cases that I was modifying anyway, but let me know if there are others. This one was especially obnoxious because of the long parameter list to InterBrokerSendThread.
ebb40be to
74cbbf8
Compare
There was a problem hiding this comment.
I guess we're not sharing these channel managers between anything. In that case, moving them into the classes that need them seems fine.
There was a problem hiding this comment.
Any reason to use Iterator here instead of queue methods (i.e., peek and remove). Is it to ensure a consistent view of the queue while we're going through it?
There was a problem hiding this comment.
Yeah, I just thought it was a little simpler.
35a8d95 to
c31ba33
Compare
This patch contains the following improvements:
KafkaNetworkChannelto useInterBrokerSendThreadwhich fixes a number of bugs/shortcomingsKafkaNetworkChannelKafkaRaftClientby checking correlationId. This fixes a bug which could cause an out of order Fetch to be applied incorrectly.Committer Checklist (excluded from commit message)