Jackie-Jiang commented on a change in pull request #5705:
URL: https://github.com/apache/incubator-pinot/pull/5705#discussion_r455410039



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/transport/AsyncQueryResponse.java
##########
@@ -39,6 +39,8 @@
   private final CountDownLatch _countDownLatch;
   private final long _maxEndTimeMs;
 
+  private Exception _brokerRequestSendException;

Review comment:
       Make it volatile? (Although it is always set and read by the same thread)

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/transport/AsyncQueryResponse.java
##########
@@ -105,4 +107,12 @@ void markServerDown(ServerRoutingInstance 
serverRoutingInstance) {
       markQueryFailed();
     }
   }
+
+  public Exception getBrokerRequestSendException() {
+    return _brokerRequestSendException;
+  }
+
+  public void setBrokerRequestSendException(Exception 
brokerRequestSendException) {

Review comment:
       (nit) Package private?

##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
##########
@@ -125,8 +126,17 @@ public static void setMaxLinesOfStackTrace(int 
maxLinesOfStackTrace) {
   }
 
   public static ProcessingException getException(ProcessingException 
processingException, Exception exception) {
+    return getException(processingException, 
getTruncatedStackTrace(exception));
+  }
+
+  public static ProcessingException getException(ProcessingException 
processingException, String errorMessage) {
     String errorType = processingException.getMessage();
     ProcessingException copiedProcessingException = 
processingException.deepCopy();
+    copiedProcessingException.setMessage(errorType + ":\n" + errorMessage);
+    return copiedProcessingException;
+  }
+
+  public static String getTruncatedStackTrace(Exception exception) {

Review comment:
       Not sure if we should expose this method

##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandler.java
##########
@@ -114,6 +118,10 @@ protected BrokerResponse processBrokerRequest(long 
requestId, BrokerRequest orig
     brokerResponse.setNumServersQueried(numServersQueried);
     brokerResponse.setNumServersResponded(numServersResponded);
 
+    if (asyncQueryResponse.getBrokerRequestSendException() != null) {
+      String errorMsg = 
QueryException.getTruncatedStackTrace(asyncQueryResponse.getBrokerRequestSendException());
+      brokerResponse.addToExceptions(new 
QueryProcessingException(BROKER_REQUEST_SEND_ERROR_CODE, errorMsg));
+    }

Review comment:
       ```suggestion
       Exception brokerRequestSendException = 
asyncQueryResponse.getBrokerRequestSendException();
       if (brokerRequestSendException != null) {
         brokerResponse.addToExceptions(new 
QueryProcessingException(BROKER_REQUEST_SEND_ERROR_CODE, 
brokerRequestSendException));
       }
   ```




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



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

Reply via email to