virajjasani commented on a change in pull request #2261:
URL: https://github.com/apache/hbase/pull/2261#discussion_r487407947



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
##########
@@ -3503,14 +3508,26 @@ private static OnlineLogRecord getSlowLogRecord(
   /**
    * Convert  AdminProtos#SlowLogResponses to list of {@link OnlineLogRecord}
    *
-   * @param slowLogResponses slowlog response protobuf instance
+   * @param logEntry slowlog response protobuf instance
    * @return list of SlowLog payloads for client usecase
    */
-  public static List<OnlineLogRecord> toSlowLogPayloads(
-      final AdminProtos.SlowLogResponses slowLogResponses) {
-    List<OnlineLogRecord> onlineLogRecords = 
slowLogResponses.getSlowLogPayloadsList()
-      
.stream().map(ProtobufUtil::getSlowLogRecord).collect(Collectors.toList());
-    return onlineLogRecords;
+  public static List<LogEntry> toSlowLogPayloads(
+      final HBaseProtos.LogEntry logEntry) {
+    try {
+      final String logClassName = logEntry.getLogClassName();
+      Class<?> logClass = 
Class.forName(logClassName).asSubclass(Message.class);
+      Method method = logClass.getMethod("parseFrom", ByteString.class);
+      if (logClassName.contains("SlowLogResponses")) {

Review comment:
       Oh, we don't leave it up to client, we do throw Exception. The last line 
of this method after try/catch is:
   ```
       throw new RuntimeException("Invalid response from server");
   ```
   I realize since it's last line of the method, while reading, it's bit 
difficult to catch.
   Any specific Exception message recommendation? The reason why I kept 
"Invalid response from server" is because  ultimately we are parsing response 
from RPC call. 
   Open to update error message for better recommendation.




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