You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "frankvicky (via GitHub)" <gi...@apache.org> on 2025/04/01 09:50:22 UTC
Re: [PR] KAFKA-18935: Ensure brokers do not return null records in FetchResponse [kafka]
frankvicky commented on code in PR #19167:
URL: https://github.com/apache/kafka/pull/19167#discussion_r2022531429
##########
clients/src/main/java/org/apache/kafka/common/requests/ShareFetchResponse.java:
##########
@@ -156,6 +163,23 @@ public static int recordsSize(ShareFetchResponseData.PartitionData partition) {
return partition.records() == null ? 0 : partition.records().sizeInBytes();
}
+ /**
+ * Creates a {@link org.apache.kafka.common.requests.ShareFetchResponse} from the given data.
+ * This method converts null records to {@link org.apache.kafka.common.record.MemoryRecords#EMPTY}
+ * to ensure consistent record representation in the response.
+ *
+ * <p><strong>This method should only be used in server-side.</strong></p>
+ */
+ public static ShareFetchResponse of(ShareFetchResponseData data) {
Review Comment:
Yes.
I have just reviewed the current usage. Refactoring them to `ShareFetchResponse.of(Errors, int, LinkedHashMap, List)` doesn't take too much effort.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org