smjn commented on code in PR #22835:
URL: https://github.com/apache/kafka/pull/22835#discussion_r3688472819


##########
server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java:
##########
@@ -238,6 +259,24 @@ public PersisterStateManagerHandler(
          */
         protected abstract void handleRequestResponse(ClientResponse response);
 
+        // Overridden per RPC to index the combined response as topicId -> 
partition -> result; null when no usable body.
+        protected Object buildResultIndex(ClientResponse response) {
+            return null;
+        }
+
+        @SuppressWarnings("unchecked")
+        protected final <R> R lookupPartitionResult(ClientResponse response) {
+            Object index = sharedResultIndex;
+            sharedResultIndex = null;
+            Map<Uuid, Map<Integer, R>> resultIndex =
+                (Map<Uuid, Map<Integer, R>>) (index != null ? index : 
buildResultIndex(response));
+            if (resultIndex == null) {
+                return null;
+            }
+            Map<Integer, R> byPartition = 
resultIndex.get(partitionKey().topicId());
+            return byPartition == null ? null : 
byPartition.get(partitionKey().partition());

Review Comment:
   looks legit



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

Reply via email to