MINOR: Better messaging for invalid fetch response#6427
MINOR: Better messaging for invalid fetch response#6427hachikuji merged 2 commits intoapache:trunkfrom
Conversation
Users have reported that when consumer poll wake up is used, it is possible to receive fetch responses that don't match the copied topic partitions collection for the session when the fetch request was created. This commit improves the error handling here by throwing an IllegalStateException instead of a NullPointerException. And by generating a message for the exception that includes a bit of more information.
There was a problem hiding this comment.
LGTM. I'd suggest changing this to a MINOR PR since we are not addressing the root cause of KAFKA-7565.
Done. |
| if (data.metadata().isFull()) { | ||
| message = MessageFormatter.arrayFormat( | ||
| "Response for missing full request partition: partition={}; metadata={}", | ||
| new Object[]{partition, data.metadata()}).getMessage(); |
There was a problem hiding this comment.
Any reason why we didn't use String.format here?
There was a problem hiding this comment.
No technical reason. I see that String.format is used in a few places already. Let me know if you would like me to change this.
There was a problem hiding this comment.
@ijuma, Actually, I now remember why I did it. MessageFormatter supports Java arrays while String.format does not.
There was a problem hiding this comment.
Why would you want arrays instead of varargs though?
There was a problem hiding this comment.
String.format("array=%s", new Object[]{1,2,3})
array=[I@76f78e3a
MessageFormatter.arrayFormat("array={}", new Object[]{new Object[]{1,2,3}}).getMessage()
array=[1,2,3]
Right?
* apache/trunk: MINOR: Retain public constructors of classes from public API (apache#6455) KAFKA-8118; Ensure ZK clients are closed in tests, fix verification (apache#6456) KAFKA-7813: JmxTool throws NPE when --object-name is omitted KAFKA-8114: Wait for SCRAM credential propagation in DelegationTokenEndToEndAuthorizationTest (apache#6452) KAFKA-8111; Set min and max versions for Metadata requests (apache#6451) KAFKA-7855: Kafka Streams Maven Archetype quickstart fails to compile out of the box (apache#6194) MINOR: Update code to not use deprecated methods (apache#6434) MINOR: Update Trogdor ConnectionStressWorker status at the end of execution (apache#6445) KAFKA-8091; Use commitSync to check connection failure in listener update test (apache#6450) KAFKA-7027: Add an overload build method in scala (apache#6373) MINOR: Fix typos in LogValidator (apache#6449) KAFKA-7502: Cleanup KTable materialization logic in a single place (apache#6174) KAFKA-7730; Limit number of active connections per listener in brokers (KIP-402) KAFKA-8091; Remove unsafe produce from dynamic listener update test (apache#6443) MINOR: Fix JavaDocs warnings (apache#6435) MINOR: Better messaging for invalid fetch response (apache#6427) MINOR: Use Java 8 lambdas in KStreamImplTest (apache#6430)
Users have reported (KAFKA-7565) that when consumer poll wake up is used, it is possible to receive fetch responses that don't match the copied topic partitions collection for the session when the fetch request was created. This commit improves the error handling here by throwing an IllegalStateException instead of a NullPointerException. And by generating a message for the exception that includes a bit of more information. Reviewers: Jason Gustafson <jason@confluent.io>
Users have reported (KAFKA-7565) that when consumer poll wake up is used,
it is possible to receive fetch responses that don't match the copied topic
partitions collection for the session when the fetch request was created.
This commit improves the error handling here by throwing an
IllegalStateException instead of a NullPointerException. And by
generating a message for the exception that includes a bit of more
information.
Committer Checklist (excluded from commit message)