ahuang98 commented on code in PR #19664:
URL: https://github.com/apache/kafka/pull/19664#discussion_r2096493928


##########
clients/src/main/java/org/apache/kafka/common/requests/GetReplicaLogInfoResponse.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.common.requests;
+
+import org.apache.kafka.common.message.GetReplicaLogInfoResponseData;
+import org.apache.kafka.common.protocol.ApiKeys;
+import org.apache.kafka.common.protocol.Errors;
+import org.apache.kafka.common.protocol.Readable;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GetReplicaLogInfoResponse extends AbstractResponse {
+    private final GetReplicaLogInfoResponseData data;
+
+    public GetReplicaLogInfoResponse(GetReplicaLogInfoResponseData data) {
+        super(ApiKeys.GET_REPLICA_LOG_INFO);
+        this.data = data;
+    }
+
+    @Override
+    public GetReplicaLogInfoResponseData data() {
+        return data;
+    }
+
+    @Override
+    public int throttleTimeMs() {
+        return data.throttleTimeMs();
+    }
+
+    @Override
+    public void maybeSetThrottleTimeMs(int throttleTimeMs) {
+        data.setThrottleTimeMs(throttleTimeMs);
+    }
+
+    @Override
+    public Map<Errors, Integer> errorCounts() {
+        Map<Errors, Integer> errorCounts = new HashMap<>();
+        data.topicPartitionLogInfoList().forEach(topicPartitionLogInfo -> {
+            topicPartitionLogInfo.partitionLogInfo().forEach(partitionLogInfo 
-> {
+                updateErrorCounts(errorCounts, 
Errors.forCode(partitionLogInfo.errorCode()));
+            });
+        });
+        return errorCounts;
+    }
+
+
+    public static GetReplicaLogInfoResponse 
prepareResponse(List<GetReplicaLogInfoResponseData.TopicPartitionLogInfo> 
topicPartitionLogInfoList) {
+        GetReplicaLogInfoResponseData responseData = new 
GetReplicaLogInfoResponseData();
+        topicPartitionLogInfoList.forEach(topicPartitionLogInfo -> {
+            
responseData.topicPartitionLogInfoList().add(topicPartitionLogInfo);
+        });
+        return new GetReplicaLogInfoResponse(responseData);
+    }
+
+    public static GetReplicaLogInfoResponse parse(Readable readable, short 
version) {
+        return new GetReplicaLogInfoResponse(new 
GetReplicaLogInfoResponseData(readable, version));
+    }
+}

Review Comment:
   nit, new line at end of files



##########
clients/src/main/resources/common/message/GetReplicaLogInfoRequest.json:
##########
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "apiKey":93,
+  "type": "request",
+  "listeners": ["broker"],
+  "name": "GetReplicaLogInfoRequest",
+  "validVersions": "0",
+  "flexibleVersions": "0+",
+  "fields": [
+    { "name": "TopicPartitions", "type": "[]TopicPartitions", "versions": 
"0+", "nullableVersions": "0+",
+      "about": "The topic partitions to query the log info.",

Review Comment:
   nit, "to query the log info for."



##########
clients/src/main/resources/common/message/GetReplicaLogInfoRequest.json:
##########
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "apiKey":93,
+  "type": "request",
+  "listeners": ["broker"],
+  "name": "GetReplicaLogInfoRequest",
+  "validVersions": "0",
+  "flexibleVersions": "0+",
+  "fields": [
+    { "name": "TopicPartitions", "type": "[]TopicPartitions", "versions": 
"0+", "nullableVersions": "0+",
+      "about": "The topic partitions to query the log info.",
+      "fields": [
+        { "name": "TopicId", "type": "uuid", "versions": "0+", "ignorable": 
true, "about": "The unique topic ID"},

Review Comment:
   just a reminder this is still set to ignorable=true



##########
clients/src/main/resources/common/message/GetReplicaLogInfoResponse.json:
##########
@@ -0,0 +1,43 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "apiKey":93,
+  "type": "response",
+  "name": "GetReplicaLogInfoResponse",
+  "validVersions": "0",
+  "flexibleVersions": "0+",
+  "fields": [
+    { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
+      "about": "The duration in milliseconds for which the request was 
throttled due to a quota violation, or zero if the request did not violate any 
quota." },
+    { "name": "BrokerEpoch", "type": "int64", "versions": "0+",
+      "about": "The epoch for the broker." },

Review Comment:
   nit: "of" instead of "for"



##########
clients/src/main/resources/common/message/GetReplicaLogInfoResponse.json:
##########
@@ -0,0 +1,43 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "apiKey":93,
+  "type": "response",
+  "name": "GetReplicaLogInfoResponse",
+  "validVersions": "0",
+  "flexibleVersions": "0+",
+  "fields": [
+    { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
+      "about": "The duration in milliseconds for which the request was 
throttled due to a quota violation, or zero if the request did not violate any 
quota." },
+    { "name": "BrokerEpoch", "type": "int64", "versions": "0+",
+      "about": "The epoch for the broker." },
+    { "name": "Truncated", "type": "bool", "versions": "0+",
+      "about": "True if topic partitions were truncated. Only the first 1000 
topic partitions are returned."},
+    { "name": "TopicPartitionLogInfoList", "type": "[]TopicPartitionLogInfo", 
"versions": "0+",
+      "about": "The list of the log info.",

Review Comment:
   nit: List of partition log info



##########
clients/src/main/resources/common/message/GetReplicaLogInfoResponse.json:
##########
@@ -0,0 +1,43 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "apiKey":93,
+  "type": "response",
+  "name": "GetReplicaLogInfoResponse",
+  "validVersions": "0",
+  "flexibleVersions": "0+",
+  "fields": [
+    { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
+      "about": "The duration in milliseconds for which the request was 
throttled due to a quota violation, or zero if the request did not violate any 
quota." },
+    { "name": "BrokerEpoch", "type": "int64", "versions": "0+",
+      "about": "The epoch for the broker." },
+    { "name": "Truncated", "type": "bool", "versions": "0+",
+      "about": "True if topic partitions were truncated. Only the first 1000 
topic partitions are returned."},

Review Comment:
   hm, what about 
   "True if response does not include all the topic partitions requested. Only 
the first 1000 ..."
   or maybe
   "True if response is missing topic partitions. Only the first 1000 ..."



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