ndimiduk commented on a change in pull request #754: HBASE-22978 : Online slow 
response log
URL: https://github.com/apache/hbase/pull/754#discussion_r371448759
 
 

 ##########
 File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
 ##########
 @@ -3889,4 +3890,72 @@ private void getProcedureResult(long procId, 
CompletableFuture<Void> future, int
         .call();
   }
 
+  @Override
+  public CompletableFuture<List<SlowLogPayload>> 
getSlowLogResponses(List<ServerName> serverNames)
+      throws IOException {
+    CompletableFuture<List<SlowLogPayload>> slowLoadPayloads = null;
+    if (CollectionUtils.isNotEmpty(serverNames)) {
+      for (ServerName serverName : serverNames) {
+        CompletableFuture<List<SlowLogPayload>> slowLogPayloadFromServer =
+          getSlowLogResponseFromServer(serverName);
+        if (slowLoadPayloads == null) {
+          slowLoadPayloads = slowLogPayloadFromServer;
+          continue;
+        }
+        slowLoadPayloads = 
slowLoadPayloads.thenCombine(slowLogPayloadFromServer, (l1, l2) -> {
+          List<SlowLogPayload> finalSlowLogPayloads = new ArrayList<>();
+          finalSlowLogPayloads.addAll(l1);
+          finalSlowLogPayloads.addAll(l2);
+          return finalSlowLogPayloads;
+        });
+      }
+    }
+    return slowLoadPayloads;
+  }
+
+  private CompletableFuture<List<SlowLogPayload>> getSlowLogResponseFromServer(
+      final ServerName serverName) {
+    return this.<List<SlowLogPayload>>newAdminCaller()
+      .action((controller, stub) -> this
+        .adminCall(
+          controller, stub, RequestConverter.buildSlowLogResponseRequest(),
+          AdminService.Interface::getSlowLogResponses,
+          ProtobufUtil::toSlowLogPayloads))
+      .serverName(serverName).call();
+  }
+
+  @Override
+  public CompletableFuture<List<Boolean>> 
clearSlowLogResponses(List<ServerName> serverNames)
+      throws IOException {
 
 Review comment:
   Same observation re: `IOException` in the interface.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to