lucasbru commented on code in PR #23571:
URL: https://github.com/apache/kafka/pull/23571#discussion_r4130824580
##########
clients/src/testFixtures/java/org/apache/kafka/test/faultproxy/KafkaProtocolFaultProxy.java:
##########
@@ -417,8 +417,13 @@ private void applyRouting(final AbstractResponse response)
{
((MetadataResponse) response).data().brokers().forEach(b ->
b.setHost(proxyHost).setPort(proxyPort));
} else if (response instanceof FindCoordinatorResponse) {
final FindCoordinatorResponse fc = (FindCoordinatorResponse)
response;
- fc.data().setHost(proxyHost).setPort(proxyPort);
- fc.data().coordinators().forEach(c ->
c.setHost(proxyHost).setPort(proxyPort));
+ // v0-3 carry a single top-level host/port and v4+ only the
coordinators list; setting the
+ // top-level fields on a v4+ response makes re-serialization fail
and the frame go out unrewritten
+ if (fc.data().coordinators().isEmpty()) {
+ fc.data().setHost(proxyHost).setPort(proxyPort);
+ } else {
+ fc.data().coordinators().forEach(c ->
c.setHost(proxyHost).setPort(proxyPort));
Review Comment:
Emptiness isn't guaranteed by the schema though, just by how clients
currently build requests. A v4+ request with zero coordinator keys would still
produce an empty list and land in the v0-3 branch. Passing the version through
explicitly (like the test already does with MIN_BATCHED_VERSION) would remove
that coupling.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]