lianetm commented on code in PR #17549: URL: https://github.com/apache/kafka/pull/17549#discussion_r1821015724
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java: ########## @@ -944,23 +941,20 @@ public boolean sameRequest(final OffsetFetchRequestState request) { public NetworkClientDelegate.UnsentRequest toUnsentRequest() { OffsetFetchRequest.Builder builder; - if (memberInfo.memberId.isPresent() && memberInfo.memberEpoch.isPresent()) { - builder = new OffsetFetchRequest.Builder( - groupId, - memberInfo.memberId.get(), - memberInfo.memberEpoch.get(), - true, - new ArrayList<>(this.requestedPartitions), - throwOnFetchStableOffsetUnsupported); - } else { - // Building request without passing member ID/epoch to leave the logic to choose - // default values when not present on the request builder. - builder = new OffsetFetchRequest.Builder( - groupId, - true, - new ArrayList<>(this.requestedPartitions), - throwOnFetchStableOffsetUnsupported); - } + // Building request without passing member ID/epoch to leave the logic to choose + // default values when not present on the request builder. + builder = memberInfo.memberEpoch.map(epoch -> new OffsetFetchRequest.Builder( + groupId, + memberInfo.memberId, + epoch, + true, + new ArrayList<>(this.requestedPartitions), + throwOnFetchStableOffsetUnsupported)) + .orElseGet(() -> new OffsetFetchRequest.Builder( + groupId, + true, + new ArrayList<>(this.requestedPartitions), + throwOnFetchStableOffsetUnsupported)); Review Comment: makes sense to me to align and return `memberId` in the consumer group metadata info only if the member is in a group. So after `unsubscribe` (this was my concern btw, not startup), even if internally the `membershipMgr` knows the member ID, we're saying that the consumer group metadata won't include it (change already in place). Agreed. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org