jolshan commented on a change in pull request #9944:
URL: https://github.com/apache/kafka/pull/9944#discussion_r572351801



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java
##########
@@ -259,8 +262,49 @@ public T records() {
         }
     }
 
+    public static final class IdError {
+        private final Uuid id;
+        private final Set<Integer> partitions;
+        private final Errors error;
+
+        public IdError(Uuid id,
+                List<Integer> partitions,
+                Errors error) {
+            this.id = id;
+            this.partitions = new HashSet<>(partitions);
+            this.error = error;
+        }
+
+        public Uuid id() {
+            return this.id;
+        }
+
+        public Set<Integer> partitions() {
+            return this.partitions;
+        }
+
+        public void addPartitions(List<Integer> partitions) {
+            partitions.forEach(partition -> {
+                partitions.add(partition);
+            });
+        }
+
+        private List<FetchResponseData.FetchablePartitionResponse> errorData() 
{
+            return partitions.stream().map(partition -> new 
FetchResponseData.FetchablePartitionResponse()
+                    .setPartition(partition)
+                    .setErrorCode(error.code())
+                    .setHighWatermark(FetchResponse.INVALID_HIGHWATERMARK)
+                    
.setLastStableOffset(FetchResponse.INVALID_LAST_STABLE_OFFSET)
+                    .setLogStartOffset(FetchResponse.INVALID_LOG_START_OFFSET)
+                    .setAbortedTransactions(null)
+                    
.setPreferredReadReplica(FetchResponse.INVALID_PREFERRED_REPLICA_ID)
+                    
.setRecordSet(MemoryRecords.EMPTY)).collect(Collectors.toList());
+        }
+
+    }
+
     /**
-     * From version 3 or later, the entries in `responseData` should be in the 
same order as the entries in
+     * From version 3 or later, the 'interesting' entries in `responseData` 
should be in the same order as the entries in

Review comment:
       'interesting' was the name of the map of partitionData. I believe they 
are topic partitions that are authorized and exist.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to