This is an automated email from the ASF dual-hosted git repository.

sajjad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new ea63617018 Remove stack trace from logs for multiget calls for getting 
table size (#10568)
ea63617018 is described below

commit ea6361701872a753df6faa60e949a40cb2a86580
Author: Sajjad Moradi <moradi.saj...@gmail.com>
AuthorDate: Sat Apr 8 10:19:41 2023 -0700

    Remove stack trace from logs for multiget calls for getting table size 
(#10568)
---
 .../api/resources/ServerTableSizeReader.java        |  3 ++-
 .../controller/util/CompletionServiceHelper.java    | 21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ServerTableSizeReader.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ServerTableSizeReader.java
index 64eb00c491..6ba049d3db 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ServerTableSizeReader.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ServerTableSizeReader.java
@@ -66,7 +66,8 @@ public class ServerTableSizeReader {
     CompletionServiceHelper completionServiceHelper =
         new CompletionServiceHelper(_executor, _connectionManager, 
endpointsToServers);
     CompletionServiceHelper.CompletionServiceResponse serviceResponse =
-        completionServiceHelper.doMultiGetRequest(serverUrls, 
tableNameWithType, false, timeoutMs);
+        completionServiceHelper.doMultiGetRequest(serverUrls, 
tableNameWithType, false, timeoutMs,
+            "get segment size info from servers");
     Map<String, List<SegmentSizeInfo>> serverToSegmentSizeInfoListMap = new 
HashMap<>();
     int failedParses = 0;
     for (Map.Entry<String, String> streamResponse : 
serviceResponse._httpResponses.entrySet()) {
diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/util/CompletionServiceHelper.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/util/CompletionServiceHelper.java
index 8ec3b28238..c311ef379f 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/util/CompletionServiceHelper.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/util/CompletionServiceHelper.java
@@ -57,7 +57,7 @@ public class CompletionServiceHelper {
 
   public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, 
String tableNameWithType,
       boolean multiRequestPerServer, int timeoutMs) {
-    return doMultiGetRequest(serverURLs, tableNameWithType, 
multiRequestPerServer, null, timeoutMs);
+    return doMultiGetRequest(serverURLs, tableNameWithType, 
multiRequestPerServer, null, timeoutMs, null);
   }
 
   /**
@@ -70,11 +70,14 @@ public class CompletionServiceHelper {
    *                              get response.
    * @param requestHeaders Headers to be set when making the http calls.
    * @param timeoutMs timeout in milliseconds to wait per request.
+   * @param useCase the use case initiating the multi-get request. If not null 
and an exception is thrown, only the
+   *                error message and the use case are logged instead of the 
full stack trace.
    * @return CompletionServiceResponse Map of the endpoint(server instance, or 
full request path if
    * multiRequestPerServer is true) to the response from that endpoint.
    */
   public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, 
String tableNameWithType,
-      boolean multiRequestPerServer, @Nullable Map<String, String> 
requestHeaders, int timeoutMs) {
+      boolean multiRequestPerServer, @Nullable Map<String, String> 
requestHeaders, int timeoutMs,
+      @Nullable String useCase) {
     CompletionServiceResponse completionServiceResponse = new 
CompletionServiceResponse();
 
     // TODO: use some service other than completion service so that we know 
which server encounters the error
@@ -95,7 +98,8 @@ public class CompletionServiceHelper {
         completionServiceResponse._httpResponses
             .put(multiRequestPerServer ? uri.toString() : instance, 
getMethod.getResponseBodyAsString());
       } catch (Exception e) {
-        LOGGER.error("Connection error", e);
+        String reason = useCase == null ? "" : String.format(" in '%s'", 
useCase);
+        LOGGER.error("Connection error{}. Details: {}", reason, 
e.getMessage());
         completionServiceResponse._failedResponseCount++;
       } finally {
         if (getMethod != null) {
@@ -114,6 +118,17 @@ public class CompletionServiceHelper {
     return completionServiceResponse;
   }
 
+  public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, 
String tableNameWithType,
+      boolean multiRequestPerServer, int timeoutMs, @Nullable String useCase) {
+    return doMultiGetRequest(serverURLs, tableNameWithType, 
multiRequestPerServer, null, timeoutMs, useCase);
+  }
+
+  public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, 
String tableNameWithType,
+      boolean multiRequestPerServer, @Nullable Map<String, String> 
requestHeaders, int timeoutMs) {
+    return doMultiGetRequest(serverURLs, tableNameWithType, 
multiRequestPerServer, requestHeaders, timeoutMs, null);
+  }
+
+
   /**
    * Helper class to maintain the completion service response to be sent back 
to the caller.
    */


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to